//--------------------// #region New mod private void buttonNew_Click(object sender, EventArgs e) { string location = ModPropertyDialog.CreateMod(); if (!string.IsNullOrEmpty(location)) { OpenMod(location); } }
/// <summary> /// Edits the properties of an existing mod. Changes are automatically saved to the XML info file. /// </summary> /// <param name="info">The mod information to be edited</param> /// <param name="path">The path of the mod info file</param> public static void EditMod(ModInfo info, string path) { var dialog = new ModPropertyDialog { _info = info, _location = Path.GetDirectoryName(path) }; if (dialog.ShowDialog() == DialogResult.OK) { ModInfo.Current.SaveXml(path); } }
/// <summary> /// Creates a new mod. Information is automatically saved to the XML info file. /// </summary> /// <returns>The path of the newly created mod info file, <c>null</c> if none was created</returns> public static string CreateMod() { var dialog = new ModPropertyDialog(); if (dialog.ShowDialog() == DialogResult.OK) { string path = Path.Combine(dialog._location, dialog._info.Name + ModInfo.FileExt); dialog._info.SaveXml(path); return(path); } return(null); }
private void menuFileModProperties_Click(object sender, EventArgs e) { ModPropertyDialog.EditMod(ModInfo.Current, ModInfo.CurrentLocation); }