public void AddAllNodeData() { this.m_MainDataDic.B2S_CollisionsRelationDic.Clear(); this.m_PrefabDic.B2S_CollisionsRelationDic.Clear(); this.m_PrefabDataDic.Clear(); foreach (var nodeGroup in this.groups) { if (nodeGroup.title == "GenerateCollision" || nodeGroup.title == "NoGenerateCollision") { foreach (var VARIABLE1 in nodeGroup.pinnedNodes) { this.m_MainDataDic.B2S_CollisionsRelationDic.Add(VARIABLE1.B2SCollisionRelation_GetNodeData().nodeDataId, VARIABLE1.B2SCollisionRelation_GetNodeData()); } } else { foreach (var VARIABLE2 in nodeGroup.pinnedNodes) { this.m_PrefabDic.B2S_CollisionsRelationDic.Add(VARIABLE2.B2SCollisionRelation_GetNodeData().nodeDataId, VARIABLE2.B2SCollisionRelation_GetNodeData()); this.m_PrefabDataDic.Add(VARIABLE2.B2SCollisionRelation_GetNodeData().nodeDataId, VARIABLE2.Prefab_GetNodeData().colliderNodeIDs); } } } }
private void Start_Click(object sender, EventArgs e) { if (Voice.Count != 0 && Scr.Count != 0) { foreach (var VARIABLE in File.ReadAllLines("名字表.txt")) { var TN = VARIABLE.Split('|'); Name_List.Add(TN[0], TN[1]); } foreach (var VARIABLE in NameList) { if (!Name_List.ContainsKey(VARIABLE)) { Name_List.Add(VARIABLE, VARIABLE); } } var VoiceCopy = new Dictionary <int, Dictionary <string, Dictionary <string, string> > >(Voice); var _NameList = NameList.ToList(); foreach (var VARIABLE in VoiceList.CheckedItems) { _NameList.Remove(VARIABLE.ToString()); } foreach (var VARIABLE in _NameList) { foreach (Dictionary <string, Dictionary <string, string> > VARIABLE2 in VoiceCopy.Values) { VARIABLE2.Remove(VARIABLE); } } foreach (var VARIABLE in Scr) { TextHandler(VARIABLE, VoiceCopy[VARIABLE.Cap]); } var Fol = new DirectoryInfo("处理后文本"); var LOG = new DirectoryInfo("异常记录"); Fol.Create(); LOG.Create(); foreach (var VARIABLE in Scr) { File.WriteAllLines($"{Fol.FullName}\\{VARIABLE.Name}", VARIABLE.Save.ToArray()); File.WriteAllLines($"{LOG.FullName}\\{VARIABLE.Name}", VARIABLE.Log.ToArray()); } MessageBox.Show("完成"); } else { MessageBox.Show("请准备好后再运行"); } }
/// <summary> /// ///////추가 버튼을 눌렀을때 작동하는 함수 /// </summary> public void addinqurylist(List <int> list) { inquryList.Clear(); foreach (var VARIABLE in list) { inquryList.Add(Mallinfo.ElementAt(VARIABLE)); } ////////////////그전에 조회했던 키가 있는지 확인한는 것///////////전에 조회했던게 있다면 삭제 List <string> already = new List <string>(); int count = 0; int samekeycount = 0; foreach (var VARIABLE2 in inquryList) { Console.WriteLine(VARIABLE2[1]); if (this.PRODUCTDATAS.ContainsKey(VARIABLE2[1])) { samekeycount++; already.Add(VARIABLE2.Last()); } else { } count++; } if (samekeycount == 0) { Console.WriteLine("조회하는 리스트중에 전에 조회했던 상품은 없다."); } else { foreach (var VARIABLE3 in already) { try { int tmp = inquryList.FindIndex(x => x.Last().Contains(VARIABLE3)); inquryList.RemoveAt(tmp); } catch (ArgumentException) { } } Console.WriteLine("전에 조회했던 적이 있는 상품이" + samekeycount + "개 만큼 있다."); } }
//데이터를 저장하는 함수 public void storedata() { //데이터를 빼오기위해 필요한 변수들 String totalhtml; int index; int index2; String urlhtml; int count = 0; //url 변수 try { web = new HtmlAgilityPack.HtmlWeb(); document = web.Load(gmarketlink); //encoding 해준다 using (var client = new WebClient()) { using (var stream = client.OpenRead(gmarketlink)) { var reader = new StreamReader(stream, Encoding.GetEncoding("euc-kr")); var html = reader.ReadToEnd(); document.LoadHtml(html); } } } catch (ArgumentException e) { Console.WriteLine("gmarket//url 변수 ArgumentException"); } catch (WebException e) { Console.WriteLine("gmarket//url 변수 WebException "); } catch (HtmlWebException e) { Console.WriteLine("gmarket //url 변수 WebException"); } catch (UriFormatException e) { Console.WriteLine("gmarket //url 변수 WebException"); } //g마켓카테고리 정보 try { var node1 = document.DocumentNode.SelectSingleNode("//div[@class='category']").Descendants().Where(x => x.Name == "span"); if (node1 != null) { foreach (var VARIABLE in node1) { category += VARIABLE.SelectSingleNode(".//a").InnerText.Trim() + ">"; } category = category.Substring(6, category.Length - 1 - 6); } } catch (NullReferenceException) { Console.WriteLine("g마켓카테고리 정보 NullReferenceException"); } // g마켓원래가격정보/할인가격정보 try { realprice = document.DocumentNode.SelectSingleNode(".//tr[@name='trCostPrice0']").InnerText.Trim(); String[] tmp; discountprice = document.DocumentNode.SelectSingleNode(".//tr[@id='trCostPrice1']").InnerText.Trim(); tmp = discountprice.Split('\n'); discountprice = ""; foreach (var VARIABLE in tmp) { discountprice += VARIABLE.Trim(); } } catch (InvalidOperationException e) { Console.WriteLine("g마켓원래가격정보/할인가격정보 InvalidOperationException"); } catch (NullReferenceException e) { Console.WriteLine("g마켓원래가격정보/할인가격정보 NullReferenceException"); } // g마켓상품이름 try { int tmp = 0; name = document.DocumentNode.SelectSingleNode(".//head") .Descendants() .Where(x => x.Name == "title") .First() .InnerText.Trim(); tmp = name.IndexOf('-') + 1; name = name.Substring(tmp, name.Length - tmp).Trim(); } catch (InvalidOperationException e) { Console.WriteLine(" g마켓상품이름 InvalidOperationException"); } catch (NullReferenceException e) { Console.WriteLine(" g마켓상품이름 NullReferenceException"); } catch (ArgumentException e) { Console.WriteLine(" g마켓상품이름 ArgumentException"); } //배송비 try { HtmlNode node4 = document.DocumentNode.SelectSingleNode("//td[@class='smart_ship']"); if (node4 != null) { // a class="detail" if (node4.SelectSingleNode(".//a").GetAttributeValue("class", "") == "detail") { String[] tmp2 = node4.InnerText.Split('\n'); foreach (var VARIABLE in tmp2) { deliveryprice += VARIABLE.Trim(); } index = deliveryprice.IndexOf(" ") - 12; deliveryprice = deliveryprice.Substring(0, index).TrimEnd(); } } } catch (NullReferenceException e) { HtmlNode node4 = document.DocumentNode.SelectSingleNode("//td[@class='smart_ship']"); deliveryprice = node4.SelectSingleNode(".//strong").InnerText; } catch (ArgumentOutOfRangeException e) { Console.WriteLine("g마켓배송비 ArgumentOutOfRangeException"); } //이미지 try { image = document.DocumentNode.SelectSingleNode(".//div[@class='img_cv']") .SelectSingleNode(".//span") .SelectSingleNode(".//img") .GetAttributeValue("src", "") .Trim(); } catch (NullReferenceException e) { Console.WriteLine("g마켓이미지 ArgumentOutOfRangeException"); } catch (ArgumentOutOfRangeException e) { Console.WriteLine("g마켓이미지 ArgumentOutOfRangeException"); } //g마켓구매혜택,바로접속혜택 try { IEnumerable <HtmlAgilityPack.HtmlNode> nodes = document.DocumentNode.Descendants() .Where( x => x.Name == "table" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("goods-info2")); HtmlNode node5 = nodes.ElementAt(1); if (node5 != null) { //바로구매혜택 var tmp = node5.Descendants().Where(x => x.Name == "div" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("in-cont")).Last(); String[] tmp2 = tmp.InnerText.Split('\n'); foreach (var VARIABLE in tmp2) { profit1 += VARIABLE.Trim(); } index = profit1.IndexOf("자세히"); profit1 = "바로구매혜택 : " + profit1.Substring(0, index); //구매혜택 if (node5.Descendants().Where(x => x.Name == "strong" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("tit")).ElementAt(0).InnerText == "구매혜택") { tmp = node5.Descendants().Where(x => x.Name == "div" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("in-cont")).ElementAt(0); tmp2 = tmp.InnerText.Split('\n'); profit1 += "//"; foreach (var VARIABLE2 in tmp2) { profit1 += " " + VARIABLE2.Trim(); } String tmp3 = node5.Descendants().Where(x => x.Name == "div" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("icon-info")).First().GetAttributeValue("id", ""); if (tmp3 == "benefitRow") { profit1 += node5.Descendants().Where(x => x.Name == "em").First().InnerText + "P"; } else if (tmp3 == "benefitRow2") { profit1 += "사은품 :" + node5.SelectSingleNode(".//p[@class='']").InnerText; } } } } catch (NullReferenceException e) { Console.WriteLine("g마켓구매혜택,바로접속혜택 NullReferenceException e"); } catch (ArgumentOutOfRangeException e) { Console.WriteLine("g마켓구매혜택,바로접속혜택 ArgumentOutOfRangeException"); } //g마켓제휴카드 할인 try { IEnumerable <HtmlAgilityPack.HtmlNode> nodes = document.DocumentNode.Descendants().Where(x => x.Name == "table"); HtmlNode node6 = nodes.ElementAt(3); if (node6 != null) { var tmp = node6.Descendants().Where(x => x.Name == "tr"); foreach (var node in tmp) { cardprofit += node.SelectSingleNode(".//img").GetAttributeValue("alt", ""); cardprofit += node.SelectSingleNode(".//strong").InnerText.TrimStart(); cardprofit += node.SelectSingleNode(".//a[@class='cl-style01']").InnerText.TrimStart(); cardprofit += node.Descendants() .Where( x => x.Name == "a" && x.Attributes.Contains("class") && x.Attributes["class"].Value.Split().Contains("cl-style01")) .Last() .InnerText.TrimStart(); cardprofit += "\n"; } cardprofit = cardprofit.TrimEnd(); } } catch (ArgumentOutOfRangeException e) { Console.WriteLine("g마켓제휴카드 ArgumentOutOfRangeException"); } catch (NullReferenceException e) { Console.WriteLine("g마켓제휴카드 NullReferenceException"); } //////////////무이자 혜택//세이브혜택 try { IEnumerable <HtmlAgilityPack.HtmlNode> nodes = document.DocumentNode.Descendants().Where(x => x.Name == "table"); HtmlNode node7 = nodes.ElementAt(3); if (node7 != null) { String[] tmp; tmp = node7.SelectSingleNode(".//a[@class='cl-style01']").GetAttributeValue("onmouseover", "").Split('\''); getif(tmp[3], 1); getif(tmp[3], 2); } } catch (ArgumentOutOfRangeException e) { Console.WriteLine("g마켓무이자 혜택,세이브혜택 ArgumentOutOfRangeException"); } catch (NullReferenceException e) { Console.WriteLine("g마켓무이자 혜택,세이브혜택 NullReferenceException"); } catch (IndexOutOfRangeException e) { Console.WriteLine("g마켓무이자 혜택,세이브혜택 IndexOutOfRangeException"); } catch (UriFormatException e) { Console.WriteLine("g마켓무이자 혜택,세이브혜택 UriFormatException"); } }
public void toJson1() { string path = "Assets/Data/path.json"; string jsonString = File.ReadAllText(path); MyJsonDictionary <String, object> exactResult = new MyJsonDictionary <String, object>(); Dictionary <String, object> result1 = JsonConvert.DeserializeObject <Dictionary <String, object> >(jsonString); // Debug.Log( "result 1 => " + Serialize( result1["Question"] ) ); int count = 0; foreach (object VARIABLE in result1.Keys) { object readquestionStr = result1[VARIABLE.ToString()]; Dictionary <String, object> result2 = JsonConvert.DeserializeObject <Dictionary <String, object> >(readquestionStr.ToString()); MyJsonDictionary <String, object> forOneQuestion = new MyJsonDictionary <String, object>(); exactResult["Question" + count] = forOneQuestion; foreach (object VARIABLE2 in result2.Keys) { if (VARIABLE2.ToString().Equals("__type") || VARIABLE2.ToString().Equals("solved")) { continue; } object readquestion2Str = VARIABLE2.ToString(); Debug.Log("keys => " + readquestion2Str.ToString()); forOneQuestion[readquestion2Str.ToString()] = result2[VARIABLE2.ToString()]; } count++; } MyJsonDictionary <String, object> newQuestion = new MyJsonDictionary <String, object>(); exactResult["Question" + (count)] = newQuestion; int index = 0; foreach (object VARIABLE in key) { newQuestion[VARIABLE.ToString()] = value[index]; index++; } newQuestion["solved"] = false; //object readquestion2Str = result1["Question"]; //Dictionary<String, object> ReadQuestion2 = JsonConvert.DeserializeObject<Dictionary<String, object>>( readquestion2Str.ToString()); //MyJsonDictionary<String, object> result = new MyJsonDictionary<String, object>(); //result["foo"] = "bar"; //result["Name"] = "John Doe"; //result["Age"] = 32; Debug.Log("exact => " + Serialize(exactResult)); string data = Serialize(exactResult); System.IO.File.WriteAllText("Assets/Data/path.json", data); }