예제 #1
0
 public PatcherForm()
 {
     InitializeComponent();
     string title = String.Format(this.Text, version);
     this.Text = title.Slice(0, title.LastIndexOf("."));
     MainForm = this;
 }
예제 #2
0
        private void NewProjectForm_Load(object sender, EventArgs e)
        {
            PatcherForm         owner    = Owner as PatcherForm;
            PatcherFormSettings settings = owner.CurrentSettings;

            selectdirectorydialog.SelectedPath = settings.LastTargetDirectory;
            directorytextbox.Text = settings.LastTargetDirectory;

            //selectfilenamedialog.FileName = settings.LastProjectDirectory;
        }
예제 #3
0
        private void selectdirectorybutton_Click(object sender, EventArgs e)
        {
            DialogResult result = selectdirectorydialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                if (!Directory.EnumerateFiles(selectdirectorydialog.SelectedPath).Any((x) => Path.GetExtension(x) == ".dll"))
                {
                    if (MessageBox.Show(this, "The specified directory does not contain any dll files. Continue anyway?", "Oxide Patcher", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        return;
                    }
                }

                PatcherForm owner = Owner as PatcherForm;

                PatcherFormSettings settings = owner.CurrentSettings;
                settings.LastTargetDirectory = selectdirectorydialog.SelectedPath;
                settings.Save();

                directorytextbox.Text = selectdirectorydialog.SelectedPath;
            }
        }
예제 #4
0
        private void createbutton_Click(object sender, EventArgs e)
        {
            // Verify
            if (!Directory.Exists(directorytextbox.Text))
            {
                MessageBox.Show(this, "The target directory is invalid.", "Oxide Patcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(filenametextbox.Text)))
            {
                MessageBox.Show(this, "The filename is invalid.", "Oxide Patcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (nametextbox.TextLength == 0)
            {
                MessageBox.Show(this, "The project name is invalid.", "Oxide Patcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Create project
            Project newproj = new Project();

            newproj.Name            = nametextbox.Text;
            newproj.TargetDirectory = directorytextbox.Text;
            newproj.Save(filenametextbox.Text);

            // Set parent form to load it
            PatcherForm owner = Owner as PatcherForm;

            owner.OpenProject(filenametextbox.Text);

            // Close
            Close();
        }
예제 #5
0
 public PatcherForm(string filename)
 {
     InitializeComponent();
     string title = String.Format(this.Text, version);
     this.Text = title.Slice(0, title.LastIndexOf("."));
     if (File.Exists(filename))
     {
         CurrentProjectFilename = filename;
     }
     else
     {
         MessageBox.Show(filename + " does not exist!", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     MainForm = this;
 }