Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
        /// <summary>
        ///   Invoked by the <see cref="BackgroundWorker" /> to perform the background work.
        ///   This compiles the Windows mapping file resource.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">The event arguments.</param>
        private void WinmapWorkerDoWork(object sender, DoWorkEventArgs args)
        {
            // var worker = sender as BackgroundWorker;
            var options = new WindowsMapperCompilerOptions();
            options.SourceFileName = windowsMapModel.FileName;
            options.OutputType = windowsMapModel.OutputType;

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