public bool JudgeTheAnswer() { if (Out.UserSelected == Out.RightAnswer) { Items.Mod(Out.IdSelected, 0); Items.Writ(); return(true); } else { Items.Mod(Out.IdSelected, 1); Items.Writ(); return(false); } }
public void WORK(string ImportFileName, string JsonFileName) { string Content = string.Empty; if (JsonFileName == string.Empty) { MessageBox.Show("先创建一个字典吧"); return; } //if(ChkFileForImport(ImportFileName) != true) //{ // MessageBox.Show("文件格式不对啊"); // return; //} JsonFile.ReadStringFrJsonFile(ImportFileName, ref Content); Content = Content.Replace("$#", "|"); Content = Content.Replace("\r", ""); Content = Content.Replace("\n", ""); string[] Sub = Content.Split('|'); List <ITEM> ItemList = new List <ITEM>(); MessageBox.Show("即将导入" + Sub.Length.ToString()); foreach (string Segment in Sub) { if (Segment != "") { ITEM Item = new ITEM(); string[] Line = Segment.Split(new string[] { "#" }, StringSplitOptions.None); foreach (string Element in Line) { if (Element == "") { continue; } string [] E = Element.Split('$'); string Key = E[1]; string Val = E[2]; string Temp = string.Empty; if (Item.MainBody.TryGetValue(Key, out Temp)) { Item.MainBody[Key] = Val; } else { Item.MainBody.Add(Key, Val); } } ItemList.Add(Item); } } if (ItemList.Count != 0) { Items.Add(ItemList); Items.Writ(); } }