Exemplo n.º 1
0
        private void CreateInfaRepositoryDirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EnterValueForm evf = new EnterValueForm("Добавление папки информатики в репозиторий");

            if (evf.ShowDialog() == DialogResult.OK)
            {
                LogForm lf = new LogForm();
                VSSUtils.sender = lf.AddToLog;
                lf.Show();

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

                    patchUtils.CreateStructure(
                        evf.Value,
                        Properties.Settings.Default.InfaSubdir,
                        Properties.Settings.Default.RepStructureInfa.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList());

                    if (MessageBox.Show("Папка создана!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        if (!lf.IsDisposed)
                        {
                            lf.Close();
                        }
                    }

                    EnableVSSButtons();
                });

                th.Start();
            }
        }
Exemplo n.º 2
0
        private void BtGetList_Click(object sender, EventArgs e)
        {
            EnterValueForm evf = new EnterValueForm("Папка с патчами", Properties.Settings.Default.MainFolderToTest);

            if (evf.ShowDialog() == DialogResult.OK)
            {
                string dir = evf.Value;
                Properties.Settings.Default.MainFolderToTest = evf.Value;
                Properties.Settings.Default.Save();

                VSSUtils      vss     = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName);
                List <string> subdirs = vss.GetSubdirs(dir);

                if (TbPatchList.Text != "")
                {
                    if (MessageBox.Show("Список патчей непустой. Очистить?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        TbPatchList.Clear();
                    }
                }

                foreach (string subdir in subdirs)
                {
                    TbPatchList.AppendText(subdir + Environment.NewLine);
                }
            }
        }
Exemplo n.º 3
0
        private void BtGetList_Click(object sender, EventArgs e)
        {
            EnterValueForm evf = new EnterValueForm("Папка с патчами");

            if (evf.ShowDialog() == DialogResult.OK)
            {
                string dir = evf.Value;

                VSSUtils      vss     = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName);
                List <string> subdirs = vss.GetSubdirs(dir);

                foreach (string subdir in subdirs)
                {
                    TbPatchList.AppendText(subdir + Environment.NewLine);
                }
            }
        }
Exemplo n.º 4
0
        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();
        }