using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using AllBase; namespace Work { public class AddressSetIni { public static Dictionary> Addresses = new Dictionary>(); public static List AddressList = new List(); public void Ini() { string file = FileBase.ReadAllText("taobao_address.tjm", Encoding.UTF8); if (string.IsNullOrEmpty(file)) { MessageBox.Show("初始化淘宝地址信息错误,请检查网络", "提示"); return; } var m = BaseRegex.GetMatchRegex(ref file, @"\[""([\d]+)"",\[""([^""]+?)"",""[^""]+?""\],""([\d]+)"""); for (int i = 0; i < m.Count; i++) { AddressBase a = new AddressBase(); a.Id = int.Parse(m[i].Groups[1].Value); a.Name = m[i].Groups[2].Value; a.UpId = int.Parse(m[i].Groups[3].Value); AddressList.Add(a); if (!Addresses.ContainsKey(a.Id)) Addresses.Add(a.Id, new List()); if (!Addresses.ContainsKey(a.UpId)) Addresses.Add(a.UpId, new List()); Addresses[a.UpId].Add(a); } } } public class AddressBase { public int Id = 0; public string Name = ""; public int UpId = 0; //public Dictionary Address = new Dictionary(); } }