private async void OpenLogFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                return;
            }

            DisplayBuild(null);
            this.xmlLogFilePath = filePath;
            SettingsService.AddRecentLogFile(filePath);
            UpdateRecentItemsMenu();
            Title = DefaultTitle + " - " + filePath;

            var progress = new BuildProgress();

            progress.ProgressText = "Opening " + filePath + "...";
            SetContent(progress);
            Build build = await System.Threading.Tasks.Task.Run(() =>
            {
                return(XmlLogReader.ReadFromXml(filePath));
            });

            progress.ProgressText = "Analyzing " + filePath + "...";
            await System.Threading.Tasks.Task.Run(() => BuildAnalyzer.AnalyzeBuild(build));

            DisplayBuild(build);
        }
示例#2
0
        //[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}\"");
        }
示例#3
0
        //[Fact]
        public void SearchPerf()
        {
            var file    = @"D:\contentsync.xml";
            var build   = XmlLogReader.ReadFromXml(file);
            var sw      = Stopwatch.StartNew();
            var search  = new Search(build);
            var results = search.FindNodes("test");
            var elapsed = sw.Elapsed;

            MessageBox.Show(elapsed.ToString());
            File.WriteAllLines(@"D:\2.txt", results.Select(r => r.Field).ToArray());
        }
        public Task <Build> BuildAndGetResult(BuildProgress progress)
        {
            var msbuildExe       = GetMSBuildExe();
            var prefixArguments  = GetPrefixArguments(projectFilePath);
            var postfixArguments = GetPostfixArguments();

            // the command line we display to the user should contain the full path to msbuild.exe
            var commandLine = $@"{prefixArguments} {customArguments} {postfixArguments}";

            progress.MSBuildCommandLine = commandLine;

            // the command line we pass to Process.Start doesn't need msbuild.exe
            commandLine = $@"""{projectFilePath}"" {customArguments} {postfixArguments}";

            return(System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    var arguments = commandLine;
                    var processStartInfo = new ProcessStartInfo(msbuildExe, arguments);
                    processStartInfo.WorkingDirectory = Path.GetDirectoryName(projectFilePath);
                    var process = Process.Start(processStartInfo);
                    process.WaitForExit();

                    var build = XmlLogReader.ReadFromXml(xmlLogFile);
                    File.Delete(xmlLogFile);
                    return build;
                }
                catch (Exception ex)
                {
                    var build = new Build();
                    build.Succeeded = false;
                    build.AddChild(new Message()
                    {
                        Text = "Exception occurred during build:"
                    });
                    build.AddChild(new Error()
                    {
                        Text = ex.ToString()
                    });
                    return build;
                }
            }));
        }
        //[Fact]
        public void TestWriter()
        {
            var build = XmlLogReader.ReadFromXml(@"D:\XmlBuildLogs\contentsync.xml");

            BinaryLogWriter.Write(build, @"D:\1.buildlog");
        }