Пример #1
0
        private void BtPatchLocation_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog
            {
                SelectedPath = Properties.Settings.Default.LastSavedDir
            };

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                Properties.Settings.Default.LastSavedDir = fbd.SelectedPath;
                Properties.Settings.Default.Save();

                TbPatchLocation.Text = fbd.SelectedPath;

                if (Directory.Exists(fbd.SelectedPath))
                {
                    DirectoryInfo patchDir = new DirectoryInfo(fbd.SelectedPath);
                    if (!File.Exists(Path.Combine(fbd.SelectedPath, "file_sc.txt")))
                    {
                        PatchUtils.CreateFPScenarioByFiles(patchDir);
                    }
                    RefreshList(patchDir);
                }
                else
                {
                    MessageBox.Show("Папка с патчем не найдена!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
0
        private void RefreshList(DirectoryInfo patchDir)
        {
            Regex addToRepRegex      = new Regex(Properties.Settings.Default.AddToRep);
            Regex addToPatchRegex    = new Regex(Properties.Settings.Default.AddToPatch);
            Regex notAddToRepRegex   = new Regex(Properties.Settings.Default.NotAddToRep);
            Regex notAddToPatchRegex = new Regex(Properties.Settings.Default.NotAddToPatch);

            DgvFileList.Rows.Clear();
            int i = 0;

            foreach (FileInfo fileInfo in patchDir.EnumerateFiles("*", SearchOption.AllDirectories))
            {
                if (!fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
                {
                    if (!fileInfo.Name.Equals("vssver2.scc", StringComparison.InvariantCultureIgnoreCase))
                    {
                        DgvFileList.Rows.Add();
                        DataGridViewRow currRow          = DgvFileList.Rows[i++];
                        string          fromSelectedPath = fileInfo.FullName.Substring(patchDir.FullName.Length + 1);

                        string schema      = "";
                        bool   schemaFound = false;

                        if (fromSelectedPath.Count(x => x == '\\') > 1)
                        {
                            int schemaStart = fromSelectedPath.IndexOf('\\');
                            int schemaEnd   = fromSelectedPath.IndexOf('\\', schemaStart + 1);

                            schema      = fromSelectedPath.Substring(schemaStart + 1, schemaEnd - schemaStart - 1);
                            schemaFound = true;
                        }

                        currRow.Cells[0].Value = fromSelectedPath;

                        bool addToPatch = addToPatchRegex.IsMatch(fileInfo.Name) && !notAddToPatchRegex.IsMatch(fileInfo.Name);
                        bool addToRep   =
                            schemaFound &&
                            addToRepRegex.IsMatch(fromSelectedPath) &&
                            !notAddToRepRegex.IsMatch(fromSelectedPath) &&
                            //папка со скриптами, и подпапка есть в списке допустимых
                            (PatchUtils.IsAcceptableDir(fileInfo.Directory, Properties.Settings.Default.ScriptsSubdir, schema, patchDir, Properties.Settings.Default.RepStructureScripts.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList())
                             ||
                             PatchUtils.IsAcceptableDir(fileInfo.Directory, Properties.Settings.Default.InfaSubdir, schema, patchDir, Properties.Settings.Default.RepStructureInfa.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList()));

                        currRow.Cells[1].Value = addToPatch && addToRep;
                        currRow.Cells[2].Value = addToPatch;
                    }
                }
            }
            BtInstallToTestODH.Enabled = BtInstallToTest.Enabled = BtPush.Enabled = BtCreateFileSc.Enabled = BtEditFileSc.Enabled = true;
            ResizeForm();
        }
Пример #3
0
 private void BtCreateFileSc_Click(object sender, EventArgs e)
 {
     if (Directory.Exists(TbPatchLocation.Text))
     {
         DirectoryInfo patchDir = new DirectoryInfo(TbPatchLocation.Text);
         PatchUtils.CreateFPScenarioByFiles(patchDir);
         RefreshList(patchDir);
     }
     else
     {
         MessageBox.Show("Папка с патчем не найдена!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #4
0
        private void SettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SettingsForm sf = new SettingsForm();

            if (sf.ShowDialog() == DialogResult.OK)
            {
                patchUtils = new PatchUtils(
                    Properties.Settings.Default.RemoteRoot,
                    Properties.Settings.Default.RemoteLinkRoot,
                    Properties.Settings.Default.BaseLocation);
            }

            patchUtils = new PatchUtils(
                Properties.Settings.Default.RemoteRoot,
                Properties.Settings.Default.RemoteLinkRoot,
                Properties.Settings.Default.BaseLocation);
        }