The options class which contains the different options to this utility.
コード例 #1
0
 Program(Options options)
 {
     this.options = options;
     // remove "bin\\{Debug|Release}\\Google.Apis.NuGet.Publisher.exe"
     var fileInfo = new FileInfo(Assembly.GetEntryAssembly().Location);
     TemplateDirectory = Path.Combine(fileInfo.Directory.Parent.Parent.FullName, "Template");
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                // TODO(peleyal): add explanation which option is missing. Currently the command line utility just
                // print the whole help without mention what is missing.
            }
            else if (!options.AllApis && (options.ApiName == null || options.ApiVersion == null))
            {
                Console.WriteLine("Please Set '--all_apis true' or the API name and version, e.g. " +
                    "'--api_name=drive --api_version=v2'");
            }
            else if (!new[] { Options.ModePublish, Options.ModeTest }.Contains(options.Mode))
            {
                Console.WriteLine("Mode should be '{0}' or '{1}'", Options.ModeTest, Options.ModePublish);
            }
            else
            {

                try
                {
                    new Program(options).Run().Wait();
                }
                catch (AggregateException ex)
                {
                    foreach (var inner in ex.InnerExceptions)
                    {
                        TraceSource.TraceEvent(TraceEventType.Error, "Exception was thrown. {0}", inner.Message);
                    }
                }
            }
            Console.ReadKey();
        }