Files
KJD/Work/ManageClass/AddressSetIni.cs

88 lines
3.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using AllBase;
namespace Work.ManageClass
{
public class AddressSetIni
{
public static Dictionary<int, List<AddressBase>> Addresses = new Dictionary<int, List<AddressBase>>();
public static List<AddressBase> AddressList = new List<AddressBase>();
public static List<AddressBase> AddressAllList = new List<AddressBase>();
public static Dictionary<int, List<AddressBase>> Addressdic = new Dictionary<int, List<AddressBase>>();
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<AddressBase>());
// if (!Addresses.ContainsKey(a.UpId))
// Addresses.Add(a.UpId, new List<AddressBase>());
// Addresses[a.UpId].Add(a);
//}
}
public void getAddress1688()
{
//string strContent = FileBase.ReadAllText("1688_address.tjm");
//strContent = GetHtml.UrlDecode(strContent);
//var m = BaseRegex.GetMatchRegex(ref strContent, @"{[^}]+?}");
//for (int i = 0; m != null && i < m.Count; i++)
//{
// string addressContent = m[i].Groups[0].Value;
// AddressBase a = new AddressBase();
// string[] addressArray = addressContent.Split(',');
// for (int j = 0; j < addressArray.Length; j++)
// {
// var itemMatch = BaseRegex.GetMatchRegex(ref addressArray[j], @"([\w\W]+?):([\w\W]+)");
// string itemname = itemMatch[0].Groups[1].Value.Replace("{", "");
// string itemvalue = itemMatch[0].Groups[2].Value.Replace("\"", "").Replace("}", "");
// if (itemname == "a")
// {
// a.Id = int.Parse(itemvalue);
// }
// if (itemname == "n")
// {
// a.Name = itemvalue;
// }
// if (itemname == "p")
// {
// a.UpId = int.Parse(itemvalue);
// }
// }
// AddressAllList.Add(a);
// if (!Addressdic.ContainsKey(a.Id))
// Addressdic.Add(a.Id, new List<AddressBase>());
// if (!Addressdic.ContainsKey(a.UpId))
// Addressdic.Add(a.UpId, new List<AddressBase>());
// Addressdic[a.UpId].Add(a);
//}
}
}
public class AddressBase
{
public int Id = 0;
public string Name = "";
public int UpId = 0;
//public Dictionary<int, AddressBase> Address = new Dictionary<int, AddressBase>();
}
}