コード例 #1
0
        private void Apply_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(PatchFile.Text) && string.IsNullOrEmpty(PatchDir.Text))
            {
                MessageBox.Show(this, _noFileSelectedText.Text);
                return;
            }
            Cursor.Current = Cursors.WaitCursor;
            if (PatchFileMode.Checked)
            {
                if (IgnoreWhitespace.Checked)
                {
                    FormProcess.ShowDialog(this, GitCommandHelpers.PatchCmdIgnoreWhitespace(PatchFile.Text));
                }
                else
                {
                    FormProcess.ShowDialog(this, GitCommandHelpers.PatchCmd(PatchFile.Text));
                }
            }
            else
            if (IgnoreWhitespace.Checked)
            {
                GitCommandHelpers.ApplyPatch(PatchDir.Text, GitCommandHelpers.PatchDirCmdIgnoreWhitespace());
            }
            else
            {
                GitCommandHelpers.ApplyPatch(PatchDir.Text, GitCommandHelpers.PatchDirCmd());
            }

            EnableButtons();

            if (!GitModule.Current.InTheMiddleOfConflictedMerge() && !GitModule.Current.InTheMiddleOfRebase() && !GitModule.Current.InTheMiddleOfPatch())
            {
                Close();
            }
            Cursor.Current = Cursors.Default;
        }