Пример #1
0
 protected bool Equals(ExportConfiguration config)
 {
     return(string.Equals(SourceFileNamePath, config.SourceFileNamePath) &&
            string.Equals(TargetFileNamePath, config.TargetFileNamePath) &&
            string.Equals(Environment, config.Environment) &&
            EnableLogMessageExport.Equals(config.EnableLogMessageExport) &&
            LogMessageFormat == config.LogMessageFormat &&
            MinimumSeverity == config.MinimumSeverity &&
            IncludeSessionSummary.Equals(config.IncludeSessionSummary) &&
            IncludeExceptionDetails.Equals(config.IncludeExceptionDetails));
 }
Пример #2
0
        public ExportConfiguration Clone()
        {
            var clone = new ExportConfiguration
            {
                SourceFileNamePath      = SourceFileNamePath,
                TargetFileNamePath      = TargetFileNamePath,
                Environment             = Environment,
                EnableLogMessageExport  = EnableLogMessageExport,
                LogMessageFormat        = LogMessageFormat,
                MinimumSeverity         = MinimumSeverity,
                IncludeSessionSummary   = IncludeSessionSummary,
                IncludeExceptionDetails = IncludeExceptionDetails
            };

            return(clone);
        }
Пример #3
0
        static int Main(string[] args)
        {
            try
            {
                //Since we're referencing *internal* Loupe assemblies the Agent API looks pretty different, and we
                //have to do a few things explicitly.
                Log.StartSession(null, 0, "Starting Application");

                //parse input arguments to figure out what they meant.
                var arguments = new Arguments(args);

                var config = new ExportConfiguration();

                //gather our input and verify it
                try
                {
                    config.SourceFileNamePath = FindArg(SourceFileArgShort, SourceFileArg, arguments, true);
                    config.TargetFileNamePath = FindArg(DestinationFileArgShort, DestinationFileArg, arguments, false);

                    string format = FindArg(FormatFileArgShort, FormatFileArg, arguments, false);
                    if (string.IsNullOrWhiteSpace(format) == false)
                    {
                        config.LogMessageFormat = (LogMessageFormat)Enum.Parse(typeof(LogMessageFormat), format, true);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    WriteHelpText();
                    return(-1);
                }

                //massage input to enforce defaults
                try
                {
                    if (string.IsNullOrWhiteSpace(config.TargetFileNamePath))
                    {
                        //just strip off the file extension and replace it with txt
                        config.TargetFileNamePath = Path.ChangeExtension(config.SourceFileNamePath, "txt");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(-2);
                }

                try
                {
                    var exporter = new SessionExporter();
                    exporter.Export(config);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(-3);
                }

                return(0);
            }
            catch (Exception ex)
            {
                Log.RecordException(0, ex, null, LogCategory, false);
                Console.WriteLine(ex);
                return(-100);
            }
            finally
            {
                Log.EndSession(SessionStatus.Normal, 0, "Exiting");
            }
        }