예제 #1
0
 public int Execute(WindowsMapperCompilerOptions options)
 {
     log.Info("Starting compilation of {0}", options.SourceFileName);
     DateTimeZone.SetUtcOnly(true);
     var inputFile = new FileInfo(options.SourceFileName);
     if (!inputFile.Exists)
     {
         log.Error("Source file {0} does not exist", inputFile.FullName);
         return 2;
     }
     var mappings = ReadInput(inputFile);
     using (var output = new ResourceOutput(WindowsToPosixResource.WindowToPosixMapBase, options.OutputType))
     {
         log.Info("Compiling to {0}", output.OutputFileName);
         output.WriteDictionary(WindowsToPosixResource.WindowToPosixMapKey, mappings);
     }
     log.Info("Finished compiling.", options.SourceFileName);
     return 0;
 }
예제 #2
0
 /// <summary>
 ///   Executes the specified arguments.
 /// </summary>
 /// <param name="arguments">The arguments.</param>
 /// <returns></returns>
 internal int Execute(string[] arguments)
 {
     var options = new WindowsMapperCompilerOptions();
     ICommandLineParser parser = new CommandLineParser(new CommandLineParserSettings(log.InfoWriter));
     return parser.ParseArguments(arguments, options) ? Execute(options) : 1;
 }
예제 #3
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);
        }