private void ImportAllFromXmlLocker_Click(object sender, EventArgs e) { Util.WTOpenFileDialog fileDlg = new Util.WTOpenFileDialog("xml", ""); if (fileDlg.ShowDialog() == DialogResult.OK) { LockerTL.ImportFromXml(fileDlg.FileName(), InventoryType.Any); LockerTL.SaveToXml(fileDlg.FileName()); } }
private void OpenLocker_Click(object sender, EventArgs e) { Util.WTOpenFileDialog FromFile = new Util.WTOpenFileDialog("xml", db.OpenedLockerFilename()); try { if (FromFile.ShowDialog() == DialogResult.OK) { LoadLocker(FromFile.FileName()); db.OpenedLockerFilename(FromFile.FileName()); } } catch { MessageBox.Show("Could not load the selected WillowTree Locker."); } }
private void MergeAllFromFileEchoes_Click(object sender, EventArgs e) { int index = GetSelectedEchoList(); if (index == -1) { MessageBox.Show("Select a single echo list to import to first."); return; } Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("echologs", "Default.echologs"); if (tempOpen.ShowDialog() == DialogResult.OK) { try { MergeAllFromXmlEchoes(tempOpen.FileName(), index); } catch (ApplicationException ex) { if (ex.Message == "NoEchoes") { MessageBox.Show("Couldn't find a location section in the file. Action aborted."); } } catch { MessageBox.Show("Couldn't load the file. Action aborted."); } } }
private void ImportEchoes_Click(object sender, EventArgs e) { int index = GetSelectedEchoList(); if (index == -1) { MessageBox.Show("Select a playthrough to import first."); return; } Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("echologs", "Default.echologs"); if (tempOpen.ShowDialog() == DialogResult.OK) { try { LoadEchoes(tempOpen.FileName(), index); } catch (ApplicationException ex) { if (ex.Message == "NoEchoes") { MessageBox.Show("Couldn't find an echoes section in the file. Action aborted."); } } catch (Exception ex) { MessageBox.Show("Error occurred while trying to load: " + ex.ToString()); return; } } }
private void CloneFromSaveEchoes_Click(object sender, EventArgs e) { int index = GetSelectedEchoList(); if (index == -1) { MessageBox.Show("Select a single echo list to import to first."); return; } Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { WillowSaveGame OtherSave = new WillowSaveGame(); try { OtherSave.LoadWsg(tempOpen.FileName()); } catch { MessageBox.Show("Couldn't open the other save file."); return; } if (OtherSave.NumberOfEchoLists - 1 < index) { MessageBox.Show("The echo list does not exist in the other savegame file."); return; } // Replace the old entries in the echo table with the new ones CurrentWSG.EchoLists[index] = OtherSave.EchoLists[index]; WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index]; EchoTree.BeginUpdate(); TreeNodeAdv parent = EchoTree.Root.Children[index]; // Remove the old entries from the tree view TreeNodeAdv[] children = parent.Children.ToArray(); foreach (TreeNodeAdv child in children) { child.Remove(); } // Add the new entries to the tree view foreach (WillowSaveGame.EchoEntry ee in et.Echoes) { string name = ee.Name; ColoredTextNode node = new ColoredTextNode(); node.Tag = name; node.Text = EchoesXml.XmlReadValue(name, "Subject"); if (node.Text == "") { node.Text = "(" + name + ")"; } parent.AddNode(node); } EchoTree.EndUpdate(); } }
private void ImportFromFileQuests_Click(object sender, EventArgs e) { int index = GetSelectedQuestList(); if (index == -1) { MessageBox.Show("Select a playthrough to import to first."); return; } Util.WTOpenFileDialog tempImport = new Util.WTOpenFileDialog("quests", CurrentWSG.CharacterName + ".PT" + (index + 1) + ".quests"); if (tempImport.ShowDialog() == DialogResult.OK) { try { LoadQuests(tempImport.FileName(), index); } catch (ApplicationException ex) { if (ex.Message == "NoQuests") { MessageBox.Show("Couldn't find a quests section in the file. Action aborted."); } } catch (Exception ex) { MessageBox.Show("Error occurred while trying to load: " + ex.ToString()); return; } } }
private void ImportFromFileSkills_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempImport = new Util.WTOpenFileDialog("skills", CurrentWSG.CharacterName + ".skills"); if (tempImport.ShowDialog() == DialogResult.OK) { XmlFile ImportSkills = new XmlFile(tempImport.FileName()); List <string> sectionNames = ImportSkills.stListSectionNames(); int sectionCount = sectionNames.Count; string[] TempSkillNames = new string[sectionCount]; int[] TempSkillLevels = new int[sectionCount]; int[] TempSkillExp = new int[sectionCount]; int[] TempSkillInUse = new int[sectionCount]; for (int Progress = 0; Progress < sectionCount; Progress++) { string name = sectionNames[Progress]; TempSkillNames[Progress] = name; TempSkillLevels[Progress] = Parse.AsInt(ImportSkills.XmlReadValue(name, "Level")); TempSkillExp[Progress] = Parse.AsInt(ImportSkills.XmlReadValue(name, "Experience")); TempSkillInUse[Progress] = Parse.AsInt(ImportSkills.XmlReadValue(name, "InUse")); } CurrentWSG.SkillNames = TempSkillNames; CurrentWSG.LevelOfSkills = TempSkillLevels; CurrentWSG.ExpOfSkills = TempSkillExp; CurrentWSG.InUse = TempSkillInUse; CurrentWSG.NumberOfSkills = sectionCount; DoSkillTree(); } }
private void ImportAllFromXmlGears_Click(object sender, EventArgs e) { Util.WTOpenFileDialog fileDlg = new Util.WTOpenFileDialog("xml", gearFileName); if (fileDlg.ShowDialog() == DialogResult.OK) { GearTL.ImportFromXml(fileDlg.FileName(), GearTL.Unsorted.invType); } }
private void MergeFromSaveLocations_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { try { MergeFromSaveLocations(tempOpen.FileName()); } catch { MessageBox.Show("Couldn't open the other save file."); return; } DoLocationTree(); } }
private void ImportAllFromSaveLocations_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { WillowSaveGame OtherSave = new WillowSaveGame(); try { OtherSave.LoadWSG(tempOpen.FileName()); } catch { MessageBox.Show("Couldn't open the other save file."); return; } CurrentWSG.TotalLocations = OtherSave.TotalLocations; CurrentWSG.LocationStrings = OtherSave.LocationStrings; DoLocationTree(); } }
private void MergeAllFromFileLocations_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("locations", "Default.locations"); if (tempOpen.ShowDialog() == DialogResult.OK) { try { MergeAllFromXmlLocations(tempOpen.FileName()); } catch (ApplicationException ex) { if (ex.Message == "NoLocations") { MessageBox.Show("Couldn't find a location section in the file. Action aborted."); } } catch { MessageBox.Show("Couldn't load the file. Action aborted."); } } }
private void MergeFromSaveEchoes_Click(object sender, EventArgs e) { int index = GetSelectedEchoList(); if (index == -1) { MessageBox.Show("Select a single echo list to import to first."); return; } Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { try { MergeFromSaveEchoes(tempOpen.FileName(), index); } catch { MessageBox.Show("Couldn't open the other save file."); return; } } }
private void ImportAllFromFileLocations_Click(object sender, EventArgs e) { Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("locations", "Default.locations"); if (tempOpen.ShowDialog() == DialogResult.OK) { try { LoadLocations(tempOpen.FileName()); } catch (ApplicationException ex) { if (ex.Message == "NoLocations") { MessageBox.Show("Couldn't find a location section in the file. Action aborted."); } } catch (Exception ex) { MessageBox.Show("Error occurred while trying to load: " + ex.ToString()); return; } } }
private void ImportFromSaveQuests_Click(object sender, EventArgs e) { int index = GetSelectedQuestList(); if (index == -1) { MessageBox.Show("Select a playthrough to import to first."); return; } Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", ""); if (tempOpen.ShowDialog() == DialogResult.OK) { WillowSaveGame OtherSave = new WillowSaveGame(); try { OtherSave.LoadWsg(tempOpen.FileName()); } catch { return; } if (OtherSave.NumberOfQuestLists - 1 < index) { MessageBox.Show("This quest list does not exist in the other savegame file."); return; } // Note that when you set lists equal to one another like this it doesn't copy // the elements, only the pointer to the list. This is only safe here because // OtherSave will be disposed of right away and not modify the values. If OtherSave // was being used actively then a new copy of all the elements in the quest list // would have to be made or else changes to one would affect the quest // list of the other. // Replace the old entries in the quest table with the new ones CurrentWSG.QuestLists[index] = OtherSave.QuestLists[index]; WillowSaveGame.QuestTable qt = CurrentWSG.QuestLists[index]; QuestTree.BeginUpdate(); TreeNodeAdv parent = QuestTree.Root.Children[index]; // Remove the old entries from the tree view TreeNodeAdv[] children = parent.Children.ToArray(); foreach (TreeNodeAdv child in children) { child.Remove(); } // Add the new entries to the tree view foreach (WillowSaveGame.QuestEntry qe in qt.Quests) { string nodeName = qe.Name; ColoredTextNode node = new ColoredTextNode(); node.Tag = nodeName; node.Text = QuestsXml.XmlReadValue(nodeName, "MissionName"); if (node.Text == "") { node.Text = "(" + node.Tag as string + ")"; } parent.AddNode(node); } QuestTree.EndUpdate(); } }