Пример #1
0
 /// <summary>
 ///   Runs the compiler from the command line.
 /// </summary>
 /// <param name="arguments">The command line arguments. Each compiler defines its own.</param>
 /// <returns>0 for success, non-0 for error.</returns>
 private static int Main(string[] arguments)
 {
     int result;
     var log = new ConsoleLog();
     if (arguments.Length < 1)
     {
         result = Usage(log);
     }
     else
     {
         var command = arguments[0];
         var remainingArguments = new string[arguments.Length - 1];
         Array.ConstrainedCopy(arguments, 1, remainingArguments, 0, remainingArguments.Length);
         if (command.Equals("tzdb", StringComparison.OrdinalIgnoreCase))
         {
             var compiler = new TzdbZoneInfoCompiler(log);
             result = compiler.Execute(remainingArguments);
         }
         else if (command.Equals("winmap", StringComparison.OrdinalIgnoreCase))
         {
             var compiler = new WindowsMapperCompiler(log);
             result = compiler.Execute(remainingArguments);
         }
         else
         {
             log.Error("Unknown comamnd: {0}", command);
             result = Usage(log);
         }
     }
     return result;
 }
Пример #2
0
        /// <summary>
        ///   Invoked by the <see cref="BackgroundWorker" /> to perform the background work.
        ///   This compiles the time zone data base resources.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">The event arguments.</param>
        private void TzdbWorkerDoWork(object sender, DoWorkEventArgs args)
        {
            var options = new TzdbCompilerOptions();
            options.SourceDirectoryName = tzdbModel.SourceDirectoryName;
            options.OutputFileName = tzdbModel.TargetFileName;
            options.OutputType = tzdbModel.OutputType;

            var compiler = new TzdbZoneInfoCompiler(logger);
            compiler.Execute(options);
        }