internal void SerializeObject(string filename, TourGuideProject project) { Stream stream = File.Open(filename, FileMode.Create); BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream, project); stream.Close(); }
public TourGuideGenGUI() { this.FormClosing += new FormClosingEventHandler(TourGuideGenGUI_FormClosing); itemIDManager = new IDManager("items.txt"); questIDManager = new IDManager("wowquests-sorted.txt"); project = new TourGuideProject(); InitializeComponent(); this.tabControl1.SelectedIndexChanged += new EventHandler(tabControl1_SelectedIndexChanged); this.Text = formTitle; this.MaximumSize = new Size(this.Size.Width, this.Size.Height); this.MinimumSize = new Size(this.Size.Width, this.Size.Height); TextBoxList_Objectives = new List<TextBox>(); CheckBoxList_Objectives = new List<CheckBox>(); RadioButtonDict_ItemObjectiveType = new Dictionary<ItemObjectiveType, RadioButton>(); RadioButtonDict_ObjectiveType = new Dictionary<ObjectiveType, RadioButton>(); TextBoxList_Objectives.Add(TextBox_CoordX); TextBoxList_Objectives.Add(TextBox_CoordY); TextBoxList_Objectives.Add(TextBox_ItemID); TextBoxList_Objectives.Add(TextBox_ItemName); TextBoxList_Objectives.Add(TextBox_ItemQuantity); TextBoxList_Objectives.Add(TextBox_Notes); TextBoxList_Objectives.Add(TextBox_ObjectOfInterest); TextBoxList_Objectives.Add(TextBox_QuestID); TextBoxList_Objectives.Add(TextBox_QuestName); CheckBoxList_Objectives.Add(CheckBox_DisableDebug); CheckBoxList_Objectives.Add(CheckBox_ObjectiveInTown); CheckBoxList_Objectives.Add(CheckBox_OptionalObjective); RadioButtonDict_ItemObjectiveType.Add(ItemObjectiveType.LOOT_ITEM, RadioButton_Item_LootItem); RadioButtonDict_ItemObjectiveType.Add(ItemObjectiveType.USE_ITEM, RadioButton_Item_UseItem); RadioButtonDict_ItemObjectiveType.Add(ItemObjectiveType.NONE, RadioButton_Item_NA); RadioButtonDict_ObjectiveType.Add(ObjectiveType.BOAT, RadioButton_Boat); RadioButtonDict_ObjectiveType.Add(ObjectiveType.FLY, RadioButton_Fly); RadioButtonDict_ObjectiveType.Add(ObjectiveType.GENERAL_NOTE, RadioButton_GeneralNote); RadioButtonDict_ObjectiveType.Add(ObjectiveType.GET_FLIGHTPATH, RadioButton_GetFlightPath); RadioButtonDict_ObjectiveType.Add(ObjectiveType.HEARTH_SET, RadioButton_SetHearth); RadioButtonDict_ObjectiveType.Add(ObjectiveType.HEARTH_USE, RadioButton_UseHearth); RadioButtonDict_ObjectiveType.Add(ObjectiveType.ITEM_BUY, RadioButton_BuyItem); RadioButtonDict_ObjectiveType.Add(ObjectiveType.ITEM_USE, RadioButton_UseItem); RadioButtonDict_ObjectiveType.Add(ObjectiveType.KILL_MOB, RadioButton_KillMob); RadioButtonDict_ObjectiveType.Add(ObjectiveType.QUEST_ACCEPT, RadioButton_QuestAccept); RadioButtonDict_ObjectiveType.Add(ObjectiveType.QUEST_COMPLETE, RadioButton_QuestComplete); RadioButtonDict_ObjectiveType.Add(ObjectiveType.QUEST_TURNIN, RadioButton_QuestTurnIn); RadioButtonDict_ObjectiveType.Add(ObjectiveType.RUN, RadioButton_Run); RefreshWindow(); }
private void Open(string path) { Serializer serializer = new Serializer(); project = serializer.DeSerializeObject(path); this.currentFilePath = path; RefreshWindow(); ApplyChanges_Guide(); savedRecently = true; RefreshWindow(); }
private bool CloseProject() { if (!savedRecently) { switch (MessageBox.Show("Save before closing project?", "Save File", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation)) { case DialogResult.Yes: if (!SaveProject()) return false; break; case DialogResult.No: break; case DialogResult.Cancel: return false; default: break; } } project = new TourGuideProject(); this.currentFilePath = String.Empty; savedRecently = true; RefreshWindow(); return true; }