Exemple #1
0
        private void depotSaveButton_Click(object sender, EventArgs e)
        {
            Depot depot = new Depot(int.Parse(depotListBox.SelectedItem.ToString()))
            {
                ContentRoot  = depotContentRootPath.Text,
                FileMappings = new List <FileMapping>()
            };

            AppendLog($"Saving depot '{depot.DepotId}'...");
            foreach (
                DataGridViewRow row in FileMappingGrid.Rows.Cast <DataGridViewRow>().Where(x => x.Cells[0].Value != null)
                )
            {
                depot.FileMappings.Add(new FileMapping {
                    LocalPath = row.Cells[0].Value.ToString(),
                    DepotPath = row.Cells[1].Value.ToString(),
                    Recursive = int.Parse(row.Cells[2].Value.ToString())
                });
            }
            depot.FileExclusions = new List <FileExclusion>();
            foreach (DataGridViewRow row in ExclusionsDataGrid.Rows)
            {
                if (row.Cells[0].Value == null)
                {
                    continue;
                }
                depot.FileExclusions.Add(new FileExclusion {
                    Pattern = row.Cells[0].Value.ToString()
                });
            }
            File.WriteAllText(Application.StartupPath + $@"\scripts\depot_build_{depot.DepotId}.vdf", depot.ToString());
            depotSaveButton.Enabled = depotRevertButton.Enabled = false;
            AppendLog($"Depot '{depot.DepotId}' saved successfully.");
        }
Exemple #2
0
        private void AddNewDepotButton_Click(object sender, EventArgs e)
        {
            if (depotSaveButton.Enabled)
            {
                if (MessageBox.Show("All unsaved changes will be lost. Are you sure want to continue?", "Warning",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }
            }
            AddDepotForm form   = new AddDepotForm();
            DialogResult result = form.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            if (depotListBox.Items.Contains(form.depotId.Text))
            {
                return;
            }
            depotListBox.Items.Add(form.depotId.Text);
            Depot depot = new Depot(int.Parse(form.depotId.Text));

            File.WriteAllText(Application.StartupPath + $@"\scripts\depot_build_{depot.DepotId}.vdf", depot.ToString());
            depotSaveButton.Enabled   = false;
            depotListBox.SelectedItem = form.depotId.Text;
            AppendLog($"Depot '{depot.DepotId}' created successfully.");
        }
Exemple #3
0
        private void LoadDepot()
        {
            depotGroup.Text = $"Depot '{depotListBox.SelectedItem}'";
            Depot selectedDepot =
                File.Exists(Application.StartupPath + $@"\scripts\depot_build_{depotListBox.SelectedItem}.vdf")
                    ? new Depot(Application.StartupPath + $@"\scripts\depot_build_{depotListBox.SelectedItem}.vdf")
                    : new Depot(int.Parse(depotListBox.SelectedItem.ToString()));

            depotContentRootPath.Text = selectedDepot.ContentRoot;
            FileMappingGrid.Rows.Clear();
            ExclusionsDataGrid.Rows.Clear();
            foreach (FileMapping fm in selectedDepot.FileMappings)
            {
                FileMappingGrid.Rows.Add(fm.LocalPath, fm.DepotPath, fm.Recursive);
            }
            foreach (FileExclusion ex in selectedDepot.FileExclusions)
            {
                ExclusionsDataGrid.Rows.Add(ex.Pattern);
            }
        }