private void SaveAs() { if (currentBuild != null) { var saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Structured XML Log Files (*.xml)|*.xml"; saveFileDialog.Title = "Save log file as"; saveFileDialog.CheckFileExists = false; saveFileDialog.OverwritePrompt = true; saveFileDialog.ValidateNames = true; var result = saveFileDialog.ShowDialog(this); if (result != true) { return; } xmlLogFilePath = saveFileDialog.FileName; System.Threading.Tasks.Task.Run(() => { XmlLogWriter.WriteToXml(currentBuild.Build, xmlLogFilePath); Dispatcher.InvokeAsync(() => { currentBuild.UpdateBreadcrumb(new Message { Text = $"Saved {xmlLogFilePath}" }); }); SettingsService.AddRecentLogFile(xmlLogFilePath); }); } }
//[Fact] public void RoundtripTest() { var file = @"D:\1.xml"; var build = XmlLogReader.ReadFromXml(file); var newName = Path.ChangeExtension(file, ".new.xml"); XmlLogWriter.WriteToXml(build, newName); Process.Start("devenv", $"/diff \"{file}\" \"{newName}\""); }
//[Fact] public void RoundtripTest() { foreach (var file in Directory.GetFiles(@"D:\XmlBuildLogs", "*.xml", SearchOption.AllDirectories).ToArray()) { var build = XlinqLogReader.ReadFromXml(file); var newName = Path.ChangeExtension(file, ".new.xml"); XmlLogWriter.WriteToXml(build, newName); var source = File.ReadAllText(file); var destination = File.ReadAllText(newName); if (source != destination) { Process.Start("devenv", $"/diff \"{file}\" \"{newName}\""); break; } else { File.Delete(newName); } } }