private bool LoadFile(string fileName) { try { if (fileName != null && fileName != "") { StreamReader reader = new StreamReader(fileName); if (reader != null) { System.Xml.Serialization.XmlSerializer xr = new System.Xml.Serialization.XmlSerializer(typeof(ModifierConfig)); modifierConfig = (ModifierConfig)xr.Deserialize(reader); gameNameTxtbox.Text = modifierConfig.GameName; processNameTxtbox.Text = modifierConfig.ProcessName; moduleNameTxtbox.Text = modifierConfig.ModuleName; reader.Close(); LoadVersions(); return(true); } } } catch (Exception ex) { MessageBox.Show("读取文件失败,已重新创建工程"); } return(false); }
private void CreateProject() { modifierConfig = new ModifierConfig(); modifierConfig.FileIdentifier = fileIdentifier; gameNameTxtbox.Text = "GameName"; processNameTxtbox.Text = "ProcessName"; moduleNameTxtbox.Text = "ModuleName"; modifierConfig.GameName = gameNameTxtbox.Text; modifierConfig.ProcessName = processNameTxtbox.Text; modifierConfig.ModuleName = moduleNameTxtbox.Text; LoadVersions();//清空 }