private void BtnSaveToFile_Click(object sender, EventArgs eventArgs) { try { CopyDir.Copy(this.SelectedSave.SaveFolder, this.tbSaveLocation.Text); foreach (KeyValuePair <string, byte[]> convertSaveByte in this.SaveFilesDictionary) { string saveTo = Directory.GetFiles(this.tbSaveLocation.Text, "*.sav", SearchOption.AllDirectories) .First(e => Path.GetFileName(convertSaveByte.Key) == "option.sav" || Path.GetFileName(e) == Path.GetFileName(convertSaveByte.Key) && Directory.GetParent(e).Name == Directory.GetParent(convertSaveByte.Key).Name); File.WriteAllBytes(saveTo, convertSaveByte.Value); } this.SelectedSave = new Save(this.tbSaveLocation.Text, true); } catch (Exception exception) { File.WriteAllText(Path.Combine(Application.StartupPath, $"error-{DateTime.Now.ToFileTime()}.log"), exception.ToString()); MessageBox.Show("Error writing save files to disk! Create an issue at https://github.com/JordanZeotni/BotW-Save-Manager with the error log **IF** you think its **NOT** a permission error.", exception.Message); return; } MessageBox.Show("Files written successfully!"); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { _noExifPath = _folderPath + @"\" + NoExifsFolder + DateTime.Now.ToString("_yyyy-MM-dd_hhmmss"); // Create file sansexif. var di = Directory.CreateDirectory(_noExifPath); backgroundWorker1.ReportProgress(10); // Côpy pict in folder. Copy(); backgroundWorker1.ReportProgress(20); // Copy the exif exec. CopyExec();// File.Copy(@"C:\_NICO\perso\winform\exiftool.exe", _noExifPath); backgroundWorker1.ReportProgress(30); var command = "start exiftool.exe -all= *.jpg"; var removeBatPath = MakeBatFile(command, BatNameSup); backgroundWorker1.ReportProgress(40); System.Diagnostics.Process.Start(removeBatPath); backgroundWorker1.ReportProgress(50); /* var artist = string.IsNullOrEmpty(textBoxArtist.Text) ? @"Sortido Pict" : textBoxArtist.Text; * var copyrights = string.IsNullOrEmpty(textBoxCopyrights.Text) ? @"sortidopict" : textBoxCopyrights.Text;*/ command = "start exiftool -artist=\"" + _artist + "\" -copyright=\"" + _copyrights + "\" *.jpg"; var addBatPath = MakeBatFile(command, BatNameAdd); backgroundWorker1.ReportProgress(60); System.Diagnostics.Process.Start(addBatPath); backgroundWorker1.ReportProgress(70); // After delete all the tmp files. deleteFilesTmp(); backgroundWorker1.ReportProgress(80); if (!string.IsNullOrEmpty(_nasPath)) { var sourceDirectory = _noExifPath; var targetDirectory = _nasPath + @"\" + DateTime.Now.ToString("yyyy-MM-dd_hhmmss"); CopyDir.Copy(sourceDirectory, targetDirectory); } backgroundWorker1.ReportProgress(90); backgroundWorker1.ReportProgress(100); }
//public static string WINDOWS = "windows"; //public static string MAC = "mac"; //public static string LINUX = "linux"; public Project(string file = "") { passages = new List <Passage>(); events = new List <GameEvent>(); if (file != "") { this.file = file; path = file.Substring(0, file.LastIndexOf("\\")); CopyDir.Copy("engine/", path + "/engine/"); } }
public static void ClassInit(TestContext TC) { mTC = TC; string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest"); SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest"); if (Directory.Exists(SolutionFolder)) { Directory.Delete(SolutionFolder, true); } CopyDir.Copy(sampleSolutionFolder, SolutionFolder); mGingerAutomator = GingerAutomator.StartSession(); mGingerAutomator.OpenSolution(SolutionFolder); }
public bool ExportAllDatabases(string destinationDir = null) { DataBaseParam param = this.InitializeAndGetDataBaseParams(destinationDir); CleanDirectoryForBackUp(param); CopyDir.Copy(param.DbStorageLocation, param.ExportDir); CopyDir.Copy(param.DestinationFilesStorage, param.ExportDir + "\\" + param.DestinationFilesStorageName); string dest = param.BackUpDir + "\\" + param.ExportDirName + "-" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff") + ".zip"; ZipFile.CreateFromDirectory(param.ExportDir, dest); return(true); }
public static void ClassInit(TestContext testContext) { //Arrange string name = "MyNewPOM"; string description = "MyDescription"; string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\POMsTest"); string SolutionFolder = TestResources.GetTestTempFolder(@"Solutions\POMsTest"); if (Directory.Exists(SolutionFolder)) { Directory.Delete(SolutionFolder, true); } CopyDir.Copy(sampleSolutionFolder, SolutionFolder); GingerAutomator mGingerAutomator = GingerAutomator.StartSession(); mGingerAutomator.OpenSolution(SolutionFolder); mPOMsPOM = mGingerAutomator.MainWindowPOM.GotoPOMs(); Agent mChromeAgent = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Name == "ChromeAgent" select x).SingleOrDefault(); //Act prioritizedLocatorsList = new List <ElementLocator>() { new ElementLocator() { Active = false, LocateBy = eLocateBy.ByName }, new ElementLocator() { Active = true, LocateBy = eLocateBy.ByID }, new ElementLocator() { Active = false, LocateBy = eLocateBy.ByXPath }, new ElementLocator() { Active = true, LocateBy = eLocateBy.ByRelXPath } }; mLearnedPOM = mPOMsPOM.CreatePOM(name, description, "MyWebApp", mChromeAgent, @"HTML\HTMLControls.html", new List <eElementType>() { eElementType.HyperLink, eElementType.Table, eElementType.ListItem }, prioritizedLocatorsList); }
private static void CreateTestSolution() { string sourceFolder = TestResources.GetTestResourcesFolder(@"Solutions\ReportSR"); solutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\ReportSR"); if (Directory.Exists(solutionFolder)) { Directory.Delete(solutionFolder, true); } CopyDir.Copy(sourceFolder, solutionFolder); SolutionRepository SR = new SolutionRepository(); SR = Ginger.App.CreateGingerSolutionRepository(); SR.Open(solutionFolder); SR.Close(); }
private void setupBid() { if (IsFileLocked(BidLog)) { MessageBox.Show("Please close the bid log before proceeding."); } else if (!File.Exists(BidFolder + @"\Proposal Opening Form.docx")) { MessageBox.Show("Please provide a reference fodler with a propopsal opening form."); } else { CopyDir.Copy(ReferenceFolder, BidFolder); writeToProposalOpening(); writeToBidLog(BidLog); setupEvent(BidNumber, ProjectName, DueDate); } }
public static void ClassInit(TestContext TC) { mTC = TC; mGingerAutomator.StartGinger(); string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest"); SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest"); if (Directory.Exists(SolutionFolder)) { Directory.Delete(SolutionFolder, true); } CopyDir.Copy(sampleSolutionFolder, SolutionFolder); mGingerAutomator.OpenSolution(SolutionFolder); LogFile = mTC.TestLogsDir + @"\GingerWPF_BasicsTest.txt"; }
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { var sourceDirectory = "TestAssets/Clean"; var destDirectory = new FileInfo(pathToBuiltProject).Directory.FullName; var sourceDirectoryInfo = new DirectoryInfo(sourceDirectory); foreach (var sourceSubDirectory in sourceDirectoryInfo.GetDirectories()) { var destSubDirectory = Path.Combine(destDirectory, sourceSubDirectory.Name); CopyDir.Copy(sourceSubDirectory.FullName, destSubDirectory); } foreach (var file in sourceDirectoryInfo.GetFiles()) { var destFile = Path.Combine(destDirectory, file.Name); if (!File.Exists(destFile)) { File.Copy(file.FullName, destFile); } } }
public static void ClassInit(TestContext TC) { TC.WriteLine("@@@@@@@@@@@@@@@@@@@@@@ ClassInit @@@@@@@@@@@@@@@@@@@@@@@@@@@@"); mTC = TC; Console.WriteLine("===> Starting Ginger"); mGingerAutomator = new GingerAutomator(); mGingerAutomator.StartGinger(); string sampleSolutionFolder = TestResources.GetTestResourcesFolder(@"Solutions\EnvsTest"); SolutionFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\EnvsTest"); if (Directory.Exists(SolutionFolder)) { Directory.Delete(SolutionFolder, true); } CopyDir.Copy(sampleSolutionFolder, SolutionFolder); Console.WriteLine("===> Open solution"); TC.WriteLine("@@@@@@@@@@@@@@@@@@@@@@ Open solution @@@@@@@@@@@@@@@@@@@@@@@@@@@@"); mGingerAutomator.OpenSolution(SolutionFolder); LogFile = mTC.TestLogsDir + @"\Ginger_BasicsTest.txt"; }
private void BtnSaveToFile_Click(object sender, EventArgs eventArgs) { try { Logger.Info($"Initiating write process for converted save with projected folder {this.tbSaveLocation.Text}."); Logger.Info("Making duplicate of original folder to preserve non-save files."); CopyDir.Copy(this.SelectedSave.SaveFolder, this.tbSaveLocation.Text); } catch (Exception exception) { Logger.Error("Generic exception caught while duplicating save files."); Logger.Error(exception); MessageBox.Show("Error writing save files to disk! Create an issue at https://github.com/JordanZeotni/BotW-Save-Manager with the error log **IF** you think its **NOT** a permission error.", exception.Message); return; } foreach (KeyValuePair <string, byte[]> convertSaveByte in this.SaveFilesDictionary) { Logger.Info($"Generating output path from original file {convertSaveByte.Key}"); string saveTo; try { saveTo = Directory.GetFiles(this.tbSaveLocation.Text, "*.sav", SearchOption.AllDirectories) .First(e => Path.GetFileName(convertSaveByte.Key) == "option.sav" || Path.GetFileName(e) == Path.GetFileName(convertSaveByte.Key) && Directory.GetParent(e).Name == Directory.GetParent(convertSaveByte.Key).Name); } catch (InvalidOperationException e) { Logger.Error("Unexpected .sav file in the save directory. Full exception:"); Logger.Error(e); MessageBox.Show($"Unexpected file \"{convertSaveByte.Key}\" was unable to be converted. " + $"Try first deleting it from the original save folder, then restarting this application, and finally retrying the conversion. " + $"If that doesn't work, make an issue with your log at https://github.com/JordanZeotni/BotW-Save-Manager.", e.Message); return; } catch (Exception e) { Logger.Error("Generic exception caught while finding the output for a .sav file."); Logger.Error(e); MessageBox.Show("Error writing save files to disk! Create an issue at https://github.com/JordanZeotni/BotW-Save-Manager with the error log **IF** you think its **NOT** a permission error.", e.Message); return; } Logger.Info($"Writing save file {saveTo}."); try { File.WriteAllBytes(saveTo, convertSaveByte.Value); } catch (Exception e) { Logger.Error($"Generic exception caught while writing .sav file {convertSaveByte.Key}."); Logger.Error(e); MessageBox.Show("Error writing a save file to disk! Create an issue at https://github.com/JordanZeotni/BotW-Save-Manager with the error log **IF** you think its **NOT** a permission error.", e.Message); return; } } Logger.Info("Loading converted save as the selected save."); try { this.SelectedSave = new Save(this.tbSaveLocation.Text, true); } catch (Exception e) { Logger.Error("Failed to load converted save. Alerting user that the save may be corrupt but could be potentially still usable."); Logger.Error(e); MessageBox.Show("The converted save was unable to be verified. The save may still work on the intended system, " + "but if it doesn't please make an issue at https://github.com/JordanZeotni/BotW-Save-Manager with your log."); Logger.Info("Process complete. Application entering standby.\nInkling is the best Smash Ultimate character :)\n" + Encoding.UTF8.GetString(Convert.FromBase64String(Program.SS))); return; } Logger.Info("Process complete. Application entering standby.\nInkling is the best Smash Ultimate character :)\n" + Encoding.UTF8.GetString(Convert.FromBase64String(Program.SS))); MessageBox.Show("Files written successfully!"); }
public static void Main(string[] args) { Console.WriteLine("Breath of the Wild Save Manager by Jordan Zeotni, fork of https://github.com/WemI0/BOTW_SaveConv"); Console.Write("Enter the path of the save folder in your save folder or press enter if the application is in the root of the save folder: "); string folderLocation = Console.ReadLine()?.Trim('"'); if (string.IsNullOrWhiteSpace(folderLocation)) { if (Directory.GetFiles(Globals.AppPath, "*.sav").First() == null) { Console.WriteLine("There are no files with the extension *.sav in this folder. Either place this application in the same folder as option.sav or enter the save folder's path."); Main(args); return; } folderLocation = Path.Combine(Globals.AppPath, Directory.GetFiles(Globals.AppPath, "*.sav").First()); } else if (!Directory.Exists(folderLocation)) { Console.WriteLine("The directory does not exist at this path. Either place this application in the root directory or enter the path of the save folder."); Main(args); return; } Save selectedSave; try { selectedSave = new Save(folderLocation); } catch (UnsupportedSaveException e) { if (e.IsSwitch) { Console.Write("Cannot find switch version from save. If you would like to attempt to use this file anyways, enter \"Y\": "); if (Console.ReadKey().Key == ConsoleKey.Y) { selectedSave = new Save(folderLocation, true); Console.WriteLine(); } else { Console.WriteLine(); Console.WriteLine("This save is not supported. If you think this is an error report the following stacktrace:"); Console.WriteLine(e); Console.WriteLine(); Console.WriteLine(); Main(args); return; } } else { Console.WriteLine("This save is not supported. If you think this is an error report the following stacktrace:"); Console.WriteLine(e); Console.WriteLine(); Console.WriteLine(); Main(args); return; } } Console.WriteLine(selectedSave.SaveConsoleType + " - Versions:"); Console.WriteLine(string.Join("\n", selectedSave.SaveVersionList)); Console.WriteLine("Press any key to begin conversion, or ESC to cancel..."); ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(true); if (consoleKeyInfo.Key == ConsoleKey.Escape) { return; } Dictionary <string, byte[]> convertSaveBytes = selectedSave.ConvertSave(); Console.Write("Enter a folder to write the save to, or press enter to overwrite the existing save with the converted version: "); string saveLocation = Console.ReadLine()?.Trim('"'); try { if (string.IsNullOrWhiteSpace(saveLocation)) { foreach (KeyValuePair <string, byte[]> convertSaveByte in convertSaveBytes) { File.WriteAllBytes(convertSaveByte.Key, convertSaveByte.Value); } } else { CopyDir.Copy(selectedSave.SaveFolder, saveLocation); foreach (KeyValuePair <string, byte[]> convertSaveByte in convertSaveBytes) { string saveTo = Directory.GetFiles(saveLocation, "*.sav", SearchOption.AllDirectories) .First(e => Path.GetFileName(convertSaveByte.Key) == "option.sav" || Path.GetFileName(e) == Path.GetFileName(convertSaveByte.Key) && Directory.GetParent(e).Name == Directory.GetParent(convertSaveByte.Key).Name); File.WriteAllBytes(saveTo, convertSaveByte.Value); } } } catch (Exception e) { Console.WriteLine("The files cannot be saved at this path. If you think this is an error report the following stacktrace:"); Console.WriteLine(e); Console.WriteLine(); Console.WriteLine(); Main(args); return; } Console.WriteLine($"Files saved successfully! \nPress any key to close..."); Console.ReadKey(true); }
public void parameterRecipeSaveDialog() { FolderBrowserDialog svDlg = new FolderBrowserDialog(); svDlg.SelectedPath = "C:\\PROTEC\\BackUp"; svDlg.ShowNewFolderButton = true; DialogResult rst = svDlg.ShowDialog(); if (rst == DialogResult.OK) { try { string selected = svDlg.SelectedPath; mc.para.write(out ret.b, selected); if (!ret.b) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_SAVE_FAIL, "Parameter")); return; } if (!mc.hd.tool.X.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry X Motion Parameter Write ERROR!"); return; } if (!mc.hd.tool.Y.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry Y Motion Parameter Write ERROR!"); return; } for (int i = 0; i < mc.activate.headCnt; i++) { if (!mc.hd.tool.Z[i].config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry Z Motion Parameter Write ERROR!"); return; } if (!mc.hd.tool.T[i].config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry T Motion Parameter Write ERROR!"); return; } } //if (!mc.pd.X.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Pedestal X Motion Parameter Write ERROR!"); return; } //if (!mc.pd.Y.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Pedestal Y Motion Parameter Write ERROR!"); return; } //if (!mc.pd.W.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Pedestal W Motion Parameter Write ERROR!"); return; } if (!mc.sf.Z2.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "StackFeeder Z2 Motion Parameter Write ERROR!"); return; } if (!mc.sf.Z.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "StackFeeder Z Motion Parameter Write ERROR!"); return; } if (!mc.cv.W.config.write(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Conveyor W homing para write error"); return; } selected += "\\Vision"; CopyDir.Copy("C:\\PROTEC\\Data\\Vision", selected); if (ret.b) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.INFORMATION, String.Format(textResource.MB_ETC_FILE_SAVE_OK, "Parameter")); } else { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_SAVE_FAIL, "Parameter")); } } catch { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_SAVE_FAIL, "Parameter")); } } }
// parameter recipe가 아니라, parameter back-up 용도로 사용한다. 뭐 여하튼 필요할 수도 있는 기능이니까.. public void parameterRecipeOpenDialog() { // Default Directory : C:\Users\protec\Documents\PROTEC\PSA\Recipe\ FolderBrowserDialog opDlg = new FolderBrowserDialog(); opDlg.SelectedPath = "C:\\PROTEC\\BackUp"; opDlg.ShowNewFolderButton = false; DialogResult rst = opDlg.ShowDialog(); if (rst == DialogResult.OK) { try { string selected = opDlg.SelectedPath; mc.para.read(out ret.b, selected); if (!ret.b) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_LOAD_FAIL, "Parameter")); return; } if (!mc.hd.tool.X.config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry X Motion Parameter Read ERROR!"); return; } if (!mc.hd.tool.Y.config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry Y Motion Parameter Read ERROR!"); return; } for (int i = 0; i < mc.activate.headCnt; i++) { if (!mc.hd.tool.Z[i].config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry Z Motion Parameter Read ERROR!" + " #" + i.ToString()); return; } if (!mc.hd.tool.T[i].config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Gantry T Motion Parameter Read ERROR!" + " #" + i.ToString()); return; } } if (!mc.sf.Z2.config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "StackFeeder Z2 Motion Parameter Read ERROR!"); return; } if (!mc.sf.Z.config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "StackFeeder Z Motion Parameter Read ERROR!"); return; } if (!mc.cv.W.config.read(selected)) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, "Conveyor W homing para write error"); return; } selected += "\\Vision"; CopyDir.Copy(selected, "C:\\PROTEC\\Data\\Vision"); for (int i = 0; i < mc.hdc.cam.MODEL_MAX_CNT; i++) { mc.hdc.cam.readModel(i); } //mc.hdc.cam.readGrabber(); mc.hdc.cam.readIntensity(); mc.hdc.cam.readCircleCenter(); mc.hdc.cam.readRectangleCenter(); mc.hdc.cam.readCornerEdge(); for (int i = 0; i < mc.ulc.cam.MODEL_MAX_CNT; i++) { mc.ulc.cam.readModel(i); } //mc.ulc.cam.readGrabber(); mc.ulc.cam.readIntensity(); mc.ulc.cam.readCircleCenter(); mc.ulc.cam.readRectangleCenter(); mc.ulc.cam.readCornerEdge(); if (ret.b) { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.INFORMATION, String.Format(textResource.MB_ETC_FILE_LOAD_OK, "Parameter")); } else { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_LOAD_FAIL, "Parameter")); } } catch { EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.FAILURE, String.Format(textResource.MB_ETC_FILE_LOAD_FAIL, "Parameter")); } } }