コード例 #1
0
        private void PushPatch(DirectoryInfo patchCopyDir, List <FileInfoWithPatchOptions> patchFiles, bool isDMFR)
        {
            LogForm lf = new LogForm();

            VSSUtils.sender = lf.AddToLog;
            lf.Show();

            Thread th = new Thread(() =>
            {
                DisableVSSButtons();

                lf.AddToLog("Выкладывание патча");
                if (patchUtils.PushPatch(patchCopyDir, patchFiles, isDMFR))
                {
                    lf.AddToLog(Environment.NewLine + "Патч выложен!");
                    if (MessageBox.Show("Патч выложен!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        if (!lf.IsDisposed)
                        {
                            lf.Invoke(new Action(() => lf.Close()));
                        }
                    }
                }

                OSUtils.SetAttributesNormal(patchCopyDir);
                Directory.Delete(patchCopyDir.FullName, true);

                EnableVSSButtons();
            });

            th.Start();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: ledenevdmitry/PatchLoader
        private void PushPatch(DirectoryInfo patchCopyDir, List <FileInfoWithPatchOptions> patchFiles)
        {
            LogForm lf = new LogForm();

            VSSUtils.sender = lf.AddToLog;
            lf.Show();

            lf.AddToLog("Проверка патча");
            Thread th = new Thread(() =>
            {
                DisableVSSButtons();

                if (CheckPatch(patchCopyDir, patchFiles))
                {
                    lf.AddToLog("Выкладывание патча");
                    if (patchUtils.PushPatch(patchCopyDir, patchFiles, out List <string> vssPathCheckedOutToAnotherUser))
                    {
                        lf.AddToLog(Environment.NewLine + "Патч выложен!");
                        if (MessageBox.Show("Патч выложен!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (!lf.IsDisposed)
                            {
                                lf.Invoke(new Action(() => lf.Close()));
                            }
                        }
                    }
                    else
                    {
                        EnterValueForm ef = new EnterValueForm("Файлы checked out другим пользователем. Невозможно добавить:", string.Join(Environment.NewLine, vssPathCheckedOutToAnotherUser));
                        ef.ShowDialog();
                    }
                }

                OSUtils.SetAttributesNormal(patchCopyDir);
                Directory.Delete(patchCopyDir.FullName, true);

                EnableVSSButtons();
            });

            th.Start();
        }