private void ExportWeapons_Click(object sender, EventArgs e) { SaveFileDialog tempExport = new SaveFileDialog(); tempExport.DefaultExt = "*.xml"; tempExport.Filter = "WillowTree Locker(*.xml)|*.xml"; tempExport.FileName = CurrentWSG.CharacterName + "'s Weapons.xml"; //string ExportText = ""; if (tempExport.ShowDialog() == DialogResult.OK) { // Create empty xml file XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding()); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartDocument(); writer.WriteStartElement("INI"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); XmlFile LockerSave = new XmlFile(tempExport.FileName); List<string> itemparts = new List<string>(); List<int> itemvalues = new List<int>(); if (IsDLCWeaponMode) for (int Progress = 0; Progress < CurrentWSG.DLC.WeaponParts.Count; Progress++) { itemparts.Clear(); //ExportText = ExportText + "[" + WeaponTree.Nodes[Progress].Text + "]\r\nType=Weapon\r\nRating=0\r\nDescription=Type in a description for the weapon here.\r\n"; for (int PartProgress = 0; PartProgress < 14; PartProgress++) itemparts.Add(CurrentWSG.DLC.WeaponParts[Progress][PartProgress]); //ExportText = ExportText + "Part" + (PartProgress + 1) + "=" + CurrentWSG.DLC.WeaponParts[Progress][PartProgress] + "\r\n"; itemvalues.Add(CurrentWSG.DLC.WeaponAmmo[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponQuality[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponEquippedSlot[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponLevel[Progress]); LockerSave.AddItem(WeaponTree.Nodes[Progress].Text, "Weapon", itemparts, itemvalues); } else for (int Progress = 0; Progress < CurrentWSG.NumberOfWeapons; Progress++) { itemparts.Clear(); itemvalues.Clear(); for (int PartProgress = 0; PartProgress < 14; PartProgress++) itemparts.Add(CurrentWSG.WeaponStrings[Progress][PartProgress]); for (int PartProgress = 0; PartProgress < 4; PartProgress++) itemvalues.Add(CurrentWSG.WeaponValues[Progress][PartProgress]); LockerSave.AddItem(WeaponTree.Nodes[Progress].Text, "Weapon", itemparts, itemvalues); } } }
private void ExportItems_Click(object sender, EventArgs e) { SaveFileDialog tempExport = new SaveFileDialog(); tempExport.DefaultExt = "*.xml"; tempExport.Filter = "WillowTree Locker(*.xml)|*.xml"; tempExport.FileName = CurrentWSG.CharacterName + "'s Items.xml"; //string ExportText = ""; if (tempExport.ShowDialog() == DialogResult.OK) { // Create empty xml file XmlTextWriter writer = new XmlTextWriter(tempExport.FileName, new System.Text.ASCIIEncoding()); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartDocument(); writer.WriteStartElement("INI"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); XmlFile LockerSave = new XmlFile(tempExport.FileName); List<string> itemparts = new List<string>(); List<int> itemvalues = new List<int>(); if (IsDLCItemMode) { for (int Progress = 0; Progress < CurrentWSG.DLC.ItemParts.Count; Progress++) { itemparts.Clear(); for (int PartProgress = 0; PartProgress < 9; PartProgress++) itemparts.Add(CurrentWSG.DLC.ItemParts[Progress][PartProgress]); itemvalues.Add(CurrentWSG.DLC.WeaponAmmo[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponQuality[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponEquippedSlot[Progress]); itemvalues.Add(CurrentWSG.DLC.WeaponLevel[Progress]); LockerSave.AddItem(ItemTree.Nodes[Progress].Text, "Item", itemparts, itemvalues); } } else { for (int Progress = 0; Progress < CurrentWSG.NumberOfItems; Progress++) { itemparts.Clear(); itemvalues.Clear(); for (int PartProgress = 0; PartProgress < 9; PartProgress++) itemparts.Add(CurrentWSG.ItemStrings[Progress][PartProgress]); for (int PartProgress = 0; PartProgress < 4; PartProgress++) itemvalues.Add(CurrentWSG.ItemValues[Progress][PartProgress]); LockerSave.AddItem(ItemTree.Nodes[Progress].Text, "Item", itemparts, itemvalues); } } } }