コード例 #1
0
ファイル: Account.cs プロジェクト: herbfunk/ItemTracker
 public static void SerializeToXML(Account settings, string path)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(Account));
     TextWriter textWriter = new StreamWriter(path);
     serializer.Serialize(textWriter, settings);
     textWriter.Close();
 }
コード例 #2
0
        private void LoadCharacterData(string File)
        {
            CurrentAccount = Account.DeserializeFromXML(File);
            AllItems = new List<TrackedItem>(CurrentAccount.StashedItems);

            foreach (var i in CurrentAccount.Characters)
            {
                CharacterSlot cs = new CharacterSlot(i);
                AllItems.AddRange(i.InventoryItems);
                AllItems.AddRange(i.EquippedItems);

                cs.OnMouseClicked += CharacterSlot_MouseClick;
                flowlayout_Characters.Controls.Add(cs);
            }

            AllItems = AllItems.OrderBy(i => i.Name).ToList();
            label1.Text = "Total Items: " + AllItems.Count.ToString();
        }