public static void GenerateTraceFile(OperationController operation)
        {
            if (Properties.Settings.Default.SaveOutTrace)
            {
                var fInfo = new FileInfo(operation.InputFile);

                string fName = fInfo.Name.Split('.')[0];
                if (!fInfo.Exists)
                {
                    fInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory);
                }

                DirectoryInfo saveDirectory = GetSaveDirectory(fInfo);

                string outputFile = Path.Combine(
                    saveDirectory.FullName,
                    $"{fName}.log"
                    );
                operation.GeneratedFiles.Add(outputFile);
                operation.OutLocation = saveDirectory.FullName;
                using (var fs = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
                    using (var sw = new StreamWriter(fs))
                    {
                        operation.WriteLogMessages(sw);
                    }
            }
        }
Пример #2
0
        public static void GenerateLogFile(OperationController operation)
        {
            var fInfo = new FileInfo(operation.Location);

            string fName = fInfo.Name.Split('.')[0];

            if (!fInfo.Exists)
            {
                fInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory);
            }

            DirectoryInfo saveDirectory = GetSaveDirectory(fInfo);

            if (saveDirectory == null)
            {
                return;
            }

            string outputFile = Path.Combine(
                saveDirectory.FullName,
                $"{fName}.log"
                );

            using (var fs = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
                using (var sw = new StreamWriter(fs))
                {
                    operation.WriteLogMessages(sw);
                }
        }