public void Cleanup() { try { foreach (var path in JournalPaths) { if (File.Exists(path)) { File.Delete(path); } } JournalPaths.Clear(); var journals = Directory.GetFiles(WorkingDirectory, "journal.*.txt"); foreach (var journal in journals) { File.Delete(journal); } if (!string.IsNullOrEmpty(AddinPath) && File.Exists(AddinPath)) { File.Delete(AddinPath); } } catch (IOException ex) { Console.WriteLine("One or more journal files could not be deleted."); } }
private void CreateJournal(string path, string testName, string fixtureName, string assemblyPath, string resultsPath, string modelPath) { using (var tw = new StreamWriter(path, false)) { var journal = String.Format(@"'" + "Dim Jrn \n" + "Set Jrn = CrsJournalScript \n" + "Jrn.Command \"StartupPage\" , \"Open this project , ID_FILE_MRU_FIRST\" \n" + "Jrn.Data \"MRUFileName\" , \"{0}\" \n" + "Jrn.RibbonEvent \"Execute external command:{1}:{2}\" \n" + "Jrn.Data \"APIStringStringMapJournalData\", 5, \"testName\", \"{3}\", \"fixtureName\", \"{4}\", \"testAssembly\", \"{5}\", \"resultsPath\", \"{6}\", \"debug\",\"{7}\" \n" + "Jrn.Command \"Internal\" , \"Flush undo and redo stacks , ID_FLUSH_UNDO\" \n" + "Jrn.Command \"SystemMenu\" , \"Quit the application; prompts to save projects , ID_APP_EXIT\"", modelPath, PluginGuid, PluginClass, testName, fixtureName, assemblyPath, resultsPath, IsDebug); tw.Write(journal); tw.Flush(); JournalPaths.Add(path); } }