private void TestLocal() { LogForm lf = new LogForm(); VSSUtils.sender = lf.AddToLog; lf.Show(); FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Необходимо выбрать патч для проверки"; DirectoryInfo localDir; bool retry = false; if (fbd.ShowDialog() == DialogResult.OK) { localDir = new DirectoryInfo(fbd.SelectedPath); Thread th = new Thread(() => { string errDesc = ""; if (!VSSUtils.CheckPatchErrors(localDir, ref errDesc)) { ErrorForm ef = new ErrorForm($"Ошибки в патче {localDir.Name}", errDesc); if (ef.ShowDialog() == DialogResult.Retry) { retry = true; } } lf.AddToLog("Проверка завершена!"); }); th.Start(); } }
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); } } }
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); } } }
private void BtFindFirst_Click(object sender, EventArgs e) { TbResult.Clear(); List <string> roots = TbRoots.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); vss = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName); lf = new LogForm(); VSSUtils.sender = lf.AddToLog; lf.Show(); Thread th = new Thread(() => { EnableStopButton(); DisableSearchButtons(); bool found = false; foreach (string root in roots) { if (vss.FirstInEntireBase(root, TbFileName.Text, (int)NudDepth.Value, true, out string match)) { TbResult.Invoke(new Action(() => TbResult.AppendText(match))); found = true; break; } } if (found) { MessageBox.Show("Поиск завершен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Файл не найден", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); } lf.Invoke(new Action(() => lf.Close())); EnableSearchButtons(); DisableStopButton(); }); th.Start(); }
private void BtTest_Click(object sender, EventArgs e) { VSSUtils vss = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName); LogForm lf = new LogForm(); VSSUtils.sender = lf.AddToLog; lf.Show(); FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Необходимо выбрать папку для хранения патчей"; fbd.SelectedPath = Properties.Settings.Default.PatchesLocalDir; DirectoryInfo localDir; if (fbd.ShowDialog() == DialogResult.OK) { localDir = new DirectoryInfo(fbd.SelectedPath); Properties.Settings.Default.PatchesLocalDir = fbd.SelectedPath; Properties.Settings.Default.Save(); Thread th = new Thread(() => { BtTest.Invoke(new Action(() => BtTest.Enabled = false)); foreach (string item in TbPatchList.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { string dir = item.Split('/').Last(); DirectoryInfo patchDir = Directory.CreateDirectory(Path.Combine(localDir.FullName, dir)); vss.Pull(item, patchDir); vss.TestPatchDir(item, out string errDesc, patchDir); TbErrors.Invoke(new Action(() => TbErrors.AppendText(errDesc))); lf.AddToLog("Проверка завершена!"); } BtTest.Invoke(new Action(() => BtTest.Enabled = true)); }); th.Start(); } }
public void CreateStructure(string dirName, string subdir, List <string> repScripts) { VSSUtils vss = new VSSUtils(remoteBaseLocation, Environment.UserName); vss.CreateStructure(dirName, remoteRoot, subdir, repScripts); }
public string CheckPatch(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles) { VSSUtils vss = new VSSUtils(remoteBaseLocation, Environment.UserName); return(vss.CheckDir(localDir, patchFiles, remoteRoot)); }
public bool PushPatch(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles, bool isDMFR) { VSSUtils vss = new VSSUtils(remoteBaseLocation, Environment.UserName); return(vss.PushDir(localDir, patchFiles, remoteRoot, remoteLinkRoot, isDMFR)); }
private void BtTest_Click(object sender, EventArgs e) { VSSUtils vss = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName); LogForm lf = new LogForm(); VSSUtils.sender = lf.AddToLog; lf.Show(); FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Необходимо выбрать папку для хранения патчей"; fbd.SelectedPath = Properties.Settings.Default.PatchesLocalDir; DirectoryInfo localDir; if (fbd.ShowDialog() == DialogResult.OK) { localDir = new DirectoryInfo(fbd.SelectedPath); Properties.Settings.Default.PatchesLocalDir = fbd.SelectedPath; Properties.Settings.Default.Save(); TbErrors.Clear(); th = new Thread(() => { BtStop.Invoke(new Action(() => BtStop.Enabled = true)); BtTest.Invoke(new Action(() => BtTest.Enabled = false)); foreach (string item in TbPatchList.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { string dir = item.Split('/').Last(); DirectoryInfo patchDir = new DirectoryInfo(Path.Combine(localDir.FullName, dir)); if (Directory.Exists(patchDir.FullName)) { OSUtils.SetAttributesNormal(patchDir); Directory.Delete(patchDir.FullName, true); } else { Directory.CreateDirectory(patchDir.FullName); } vss.Pull(item, patchDir); OSUtils.SetAttributesNormal(patchDir); vss.TestPatchDir(item, out string errDesc, patchDir); TbErrors.Invoke(new Action(() => TbErrors.AppendText(errDesc))); using (var sw = File.AppendText("err_log.txt")) { sw.WriteLine(errDesc); } lf.AddToLog("Проверка завершена!"); } BtStop.Invoke(new Action(() => BtStop.Enabled = false)); BtTest.Invoke(new Action(() => BtTest.Enabled = true)); MessageBox.Show("Проверка завершена", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); }); th.Start(); Properties.Settings.Default.PatchesToTest = TbPatchList.Text; Properties.Settings.Default.Save(); } }
public bool PushPatch(DirectoryInfo localDir, List <FileInfoWithPatchOptions> patchFiles, out List <string> vssPathCheckedOutToAnotherUser) { VSSUtils vss = new VSSUtils(remoteBaseLocation, Environment.UserName); return(vss.PushDir(localDir, patchFiles, remoteRoot, remoteLinkRoot, out vssPathCheckedOutToAnotherUser)); }