コード例 #1
0
        //--------------------//

        #region New mod
        private void buttonNew_Click(object sender, EventArgs e)
        {
            string location = ModPropertyDialog.CreateMod();

            if (!string.IsNullOrEmpty(location))
            {
                OpenMod(location);
            }
        }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
 private void menuFileModProperties_Click(object sender, EventArgs e)
 {
     ModPropertyDialog.EditMod(ModInfo.Current, ModInfo.CurrentLocation);
 }