Esempio n. 1
0
        private void ButtonX_AddNew_Click(object sender, EventArgs e)
        {
            var frm = new TweakProfileEditor()
            {
                Titel         = "New Profile",
                Description   = string.Empty,
                Version       = new Version("1.0.0.0"),
                MinAppVersion = new Version(Application.ProductVersion)
            };

            if (frm.ShowDialog() == DialogResult.OK)
            {
                AddNewPatch(frm.Titel, frm.Description, frm.Version, frm.MinAppVersion, frm.MaxAppVersion, "New Script");
            }
        }
Esempio n. 2
0
        private void EditPatch(PatchProfile patch)
        {
            var editor = new TweakProfileEditor()
            {
                Titel         = patch.Name,
                Description   = patch.Description,
                Version       = patch.Version,
                MinAppVersion = patch.MinVersion,
                MaxAppVersion = patch.MaxVersion
            };

            if (editor.ShowDialog(this) == DialogResult.OK)
            {
                string oldName        = patch.Name;
                string oldDescription = patch.Description;

                patch.Name        = editor.Titel.Trim();
                patch.Description = editor.Description.Trim();
                patch.Version     = editor.Version;
                patch.MinVersion  = editor.MinAppVersion;
                patch.MaxVersion  = editor.MaxAppVersion;

                if ((oldName ?? "") != (patch.Name ?? ""))
                {
                    //// Rename File
                    //string newFileName = Path.Combine(Path.GetDirectoryName(patch.FileName), editor.Titel + Path.GetExtension(patch.FileName));
                    //newFileName = EnsureFileNameIsNotUsed(newFileName);
                    //File.Move(patch.FileName, newFileName);
                    //patch.FileName = newFileName;

                    // Update Title in ListBox
                    ItemListBox1.SelectedItem.Text = patch.Name;
                    ItemListBox1.Refresh();
                }
            }
        }