private void Construction_Completed()
        {
            if (SaveLogToDisk)
            {
                try
                {
                    if (Path.IsPathRooted(_logFile))
                    {
                        var parentDirectory = Path.GetDirectoryName(_logFile);
                        if (!Directory.Exists(parentDirectory))
                        {
                            Directory.CreateDirectory(parentDirectory);
                        }
                    }

                    Serialization.Write(construction.Build, _logFile);
                }
                catch (Exception ex)
                {
                    ErrorReporting.ReportException(ex);
                }
            }
            else
            {
                CurrentBuild = construction.Build;
            }
        }
Exemple #2
0
        public override void Shutdown()
        {
            base.Shutdown();

            if (projectImportsCollector != null)
            {
                var archiveFilePath = projectImportsCollector.ArchiveFilePath;

                projectImportsCollector.Close();
                projectImportsCollector = null;

                if (File.Exists(archiveFilePath))
                {
                    var bytes = File.ReadAllBytes(archiveFilePath);
                    construction.Build.SourceFilesArchive = bytes;
                    File.Delete(archiveFilePath);
                }
            }

            if (SaveLogToDisk)
            {
                try
                {
                    if (Path.IsPathRooted(_logFile))
                    {
                        var parentDirectory = Path.GetDirectoryName(_logFile);
                        if (!Directory.Exists(parentDirectory))
                        {
                            Directory.CreateDirectory(parentDirectory);
                        }
                    }

                    Serialization.Write(construction.Build, _logFile);
                }
                catch (Exception ex)
                {
                    ErrorReporting.ReportException(ex);
                }
            }
            else
            {
                CurrentBuild = construction.Build;
            }
        }