public void ReadAllItemUrl(string fileName) { string content = CommonFun.ReadCSV(fileName); if (string.IsNullOrEmpty(content)) { string[] lines = content.Split('\r'); foreach (string line in lines) { allItemUrl.Add(line); } } else { Console.WriteLine("ReadAllItemUrl error" + fileName); } }
public void ReadBaseItemInfo(string fileName, bool isBaseItemInfo) { //DataTable data = CommonFun.ReadXLS(fileName); string content = CommonFun.ReadCSV(fileName); if (!string.IsNullOrEmpty(content)) { string[] lines = content.Split('\r'); string[] menu = null; foreach (string line in lines) { try { if (!line.Contains('\n')) { menu = line.Split(','); } else { string newLine = line; MatchCollection ms = CommonFun.GetValues(newLine, "\"\"\"", "\"\"\""); for (int i = 0; i < ms.Count; i++) { if (!string.IsNullOrEmpty(ms[i].Value)) { newLine = newLine.Replace(ms[i].Value, string.Format("{{0}}", i)); } } string[] infoStr = newLine.Split(','); for (int i = 0; i < infoStr.Length; i++) { for (int j = 0; j < ms.Count; j++) { infoStr[i] = infoStr[i].Replace(string.Format("{{0}}", j), ms[j].Value); } } if (infoStr.Length > 1) { BaseItemInfo info = isBaseItemInfo ? new BaseItemInfo() : new ItemInfo(); string[] menuName = info.GetLogHeadLine().Split(','); SetBaseItemInfo(info, infoStr, menu); if (!isBaseItemInfo) { SetItemInfo(info as ItemInfo, infoStr, menu); } string key = info.Name + info.Format + info.Created; if (!shopAllItems.ContainsKey(key)) { shopAllItems.Add(key, info); } else if (shopAllItems[key].ShopPrice > info.ShopPrice) { shopAllItems[key] = info; } } } } catch (Exception ex) { Console.WriteLine(ex); } } } else { Console.WriteLine("ReadBaseItemInfo error" + fileName); } }