コード例 #1
0
 internal static void GenerateTSV(GenerateProcessedFilesTSVOptions options)
 {
     using (ProcessedFilesInfoGenerator generator = new ProcessedFilesInfoGenerator(options))
     {
         generator.GenerateProcessedFilesTSV();
     }
 }
コード例 #2
0
        public static void Main(string[] args)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                // See  https://issues.bloomlibrary.org/youtrack/issue/BL-8475.
                Console.WriteLine("Harvester cannot run on Linux until we verify that phash computations always yield the same result on both Windows and Linux!");
                return;
            }

            // See https://github.com/commandlineparser/commandline for documentation about CommandLine.Parser
            var parser = new CommandLine.Parser((settings) =>
            {
                settings.CaseInsensitiveEnumValues = true;
                settings.CaseSensitive             = false;
                settings.HelpWriter = Console.Error;
            });

            try
            {
                parser.ParseArguments <HarvesterOptions, UpdateStateInParseOptions, BatchUpdateStateInParseOptions, GenerateProcessedFilesTSVOptions>(args)
                .WithParsed <HarvesterOptions>(options =>
                {
                    options.ValidateOptions();
                    Harvester.RunHarvest(options);
                })
                .WithParsed <UpdateStateInParseOptions>(options =>
                {
                    HarvestStateUpdater.UpdateState(options.ParseDBEnvironment, options.ObjectId, options.NewState);
                })
                .WithParsed <BatchUpdateStateInParseOptions>(options =>
                {
                    HarvestStateBatchUpdater.RunBatchUpdateStates(options);
                })
                .WithParsed <GenerateProcessedFilesTSVOptions>(options =>
                {
                    ProcessedFilesInfoGenerator.GenerateTSV(options);
                })
                .WithNotParsed(errors =>
                {
                    Console.Out.WriteLine("Error parsing command line arguments.");
                    Environment.Exit(1);
                });
            }
            catch (Exception e)
            {
                YouTrackIssueConnector.GetInstance(EnvironmentSetting.Unknown).ReportException(e, "An exception was thrown which was not handled by the program.", null);
                throw;
            }
        }