示例#1
0
文件: Program.cs 项目: schellap/cli
        public static int Run(IEnumerable <string> inputFiles, string culture, string outputFile, string version, IEnumerable <string> compilationReferences)
        {
            if (!inputFiles.Any())
            {
                Reporter.Error.WriteLine("No input files specified");
                return(1);
            }

            ResgenCommand resgenCommand = new ResgenCommand();

            resgenCommand.Args                  = inputFiles;
            resgenCommand.OutputFileName        = outputFile;
            resgenCommand.AssemblyCulture       = culture;
            resgenCommand.AssemblyVersion       = version;
            resgenCommand.CompilationReferences = compilationReferences;

            try
            {
                return(resgenCommand.Execute());
            }
            catch (Exception ex)
            {
#if DEBUG
                Reporter.Error.WriteLine(ex.ToString());
#else
                Reporter.Error.WriteLine(ex.Message);
#endif
                return(1);
            }
        }
示例#2
0
        public static int Run(IEnumerable<string> inputFiles, string culture, string outputFile, string version, IEnumerable<string> compilationReferences)
        {
            if (!inputFiles.Any())
            {
                Reporter.Error.WriteLine("No input files specified");
                return 1;
            }

            ResgenCommand resgenCommand = new ResgenCommand();

            resgenCommand.Args = inputFiles;
            resgenCommand.OutputFileName = outputFile;
            resgenCommand.AssemblyCulture = culture;
            resgenCommand.AssemblyVersion = version;
            resgenCommand.CompilationReferences = compilationReferences;

            try
            {
                return resgenCommand.Execute();
            }
            catch (Exception ex)
            {
#if DEBUG
                Reporter.Error.WriteLine(ex.ToString());
#else
                Reporter.Error.WriteLine(ex.Message);
#endif
                return 1;
            }
        }
示例#3
0
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            var    help       = false;
            string helpText   = null;
            var    returnCode = 0;

            var resgenCommand = new ResgenCommand();

            try
            {
                ArgumentSyntax.Parse(args, syntax =>
                {
                    syntax.ApplicationName = "Resource compiler";

                    syntax.HandleHelp   = false;
                    syntax.HandleErrors = false;

                    syntax.DefineOption("o|output", ref resgenCommand.OutputFileName, "Output file name");
                    syntax.DefineOption("c|culture", ref resgenCommand.AssemblyCulture, "Ouput assembly culture");
                    syntax.DefineOption("v|version", ref resgenCommand.AssemblyVersion, "Ouput assembly version");
                    syntax.DefineOption("h|help", ref help, "Help for compile native.");

                    syntax.DefineOptionList("r", ref resgenCommand.CompilationReferences, "Compilation references");
                    syntax.DefineParameterList("args", ref resgenCommand.Args, "Input files");

                    helpText = syntax.GetHelpText();
                });
            }
            catch (ArgumentSyntaxException exception)
            {
                Console.Error.WriteLine(exception.Message);
                help       = true;
                returnCode = 1;
            }

            if (resgenCommand.Args.Count == 0)
            {
                Reporter.Error.WriteLine("No input files specified");
                help       = true;
                returnCode = 1;
            }

            if (help)
            {
                Console.WriteLine(helpText);
                return(returnCode);
            }

            try
            {
                return(resgenCommand.Execute());
            }
            catch (Exception ex)
            {
#if DEBUG
                Reporter.Error.WriteLine(ex.ToString());
#else
                Reporter.Error.WriteLine(ex.Message);
#endif
                return(1);
            }
        }
示例#4
0
文件: Program.cs 项目: noahfalk/cli
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            var help = false;
            string helpText = null;
            var returnCode = 0;

            var resgenCommand = new ResgenCommand();
            try
            {
                ArgumentSyntax.Parse(args, syntax =>
                {
                    syntax.ApplicationName = "Resource compiler";

                    syntax.HandleHelp = false;
                    syntax.HandleErrors = false;

                    syntax.DefineOption("o|output", ref resgenCommand.OutputFileName, "Output file name");
                    syntax.DefineOption("c|culture", ref resgenCommand.AssemblyCulture, "Ouput assembly culture");
                    syntax.DefineOption("v|version", ref resgenCommand.AssemblyVersion, "Ouput assembly version");
                    syntax.DefineOption("h|help", ref help, "Help for compile native.");

                    syntax.DefineOptionList("r", ref resgenCommand.CompilationReferences, "Compilation references");
                    syntax.DefineParameterList("args", ref resgenCommand.Args, "Input files");

                    helpText = syntax.GetHelpText();
                });
            }
            catch (ArgumentSyntaxException exception)
            {
                Console.Error.WriteLine(exception.Message);
                help = true;
                returnCode = 1;
            }

            if (resgenCommand.Args.Count == 0)
            {
                Reporter.Error.WriteLine("No input files specified");
                help = true;
                returnCode = 1;
            }

            if (help)
            {
                Console.WriteLine(helpText);
                return returnCode;
            }

            try
            {
                return resgenCommand.Execute();
            }
            catch (Exception ex)
            {
#if DEBUG
                Reporter.Error.WriteLine(ex.ToString());
#else
                Reporter.Error.WriteLine(ex.Message);
#endif
                return 1;
            }
        }