示例#1
0
        private static void Main(string[] args)
        {
            var options = new Options();

            if (Parser.Default.ParseArgumentsStrict(args, options))
            {
                var stateInputPath  = options.StateInputPath;
                var inputPath       = options.InputPath;
                var stateOutputPath = options.StateOutputPath;
                var outputPath      = options.OutputPath;
                var publisher       = new Publisher(stateInputPath, stateOutputPath, outputPath);
                var logFiles        = new LogDirectory(inputPath).Publish();
                logFiles
                .Subscribe(logFile =>
                {
                    logFile.Subscribe(line =>
                    {
                        publisher.Add(line);
                    });
                },
                           () =>
                {
                    publisher.Dispose();
                });
                logFiles
                .Where(logFile => options.Delete)
                .Subscribe(logFile =>
                {
                    File.Delete(logFile.Path);
                });
                logFiles.Connect();
            }
            else
            {
                throw new ArgumentException();
            }
        }