当前位置: 首页>>代码示例>>C#>>正文


C# System.Arguments类代码示例

本文整理汇总了C#中System.Arguments的典型用法代码示例。如果您正苦于以下问题:C# Arguments类的具体用法?C# Arguments怎么用?C# Arguments使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Arguments类属于System命名空间,在下文中一共展示了Arguments类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            Arguments args;
            string arg;

            if (Environment.GetCommandLineArgs().Length > 1)
            {
                args = new Arguments(Environment.CommandLine, true);

                if (TryGetValue(args, "reportType", out arg) && !string.IsNullOrWhiteSpace(arg))
                {
                    arg = arg.Trim();

                    if (arg.Equals("completeness", StringComparison.OrdinalIgnoreCase))
                        GenerateCompletenessReport();
                    else if (arg.Equals("correctness", StringComparison.OrdinalIgnoreCase))
                        GenerateCorrectnessReport();
                }
                else
                {
                    // Generate completeness report by default
                    GenerateCompletenessReport();
                }
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Main());
            }
        }
开发者ID:rmc00,项目名称:gsf,代码行数:31,代码来源:Program.cs

示例2: OnBarCodeRecognized

 protected virtual void OnBarCodeRecognized(Arguments e)
 {
     if (BarCodeRecognizedEvent != null)
     {
         BarCodeRecognizedEvent(this, e);
     }
 }
开发者ID:Amebus,项目名称:KillersWearsPrada,代码行数:7,代码来源:BarCodeRecognized.cs

示例3: GetUsage

 private string GetUsage(Options options, Arguments arguments)
 {
     var usage = new StringBuilder();
     foreach (Option option in options)
     {
         if (usage.Length > 0)
             usage.Append(" ");
         if (option.Usage.MinOccurences == 0)
             usage.Append("[");
         usage.Append($"-{option.Name}");
         if (option.Usage.MaxParameters > 0)
             usage.Append(":(params)");
         if (option.Usage.MinOccurences == 0)
             usage.Append("]");
     }
     foreach (Argument argument in arguments)
     {
         if (usage.Length > 0)
             usage.Append(" ");
         if (argument.IsOptional)
             usage.Append("[");
         usage.Append($"<{argument["Name"] ?? "Arg"}>");
         if (argument.IsOptional)
             usage.Append("]");
     }
     return usage.ToString();
 }
开发者ID:JeevanJames,项目名称:ConsoleFx,代码行数:27,代码来源:MetadataUsageBuilder.cs

示例4: Main

        static void Main(string[] args)
        {
            var arguments = new Arguments(args);
              if(arguments.InvalidArgs().Any()) {
            foreach(var arg in arguments.InvalidArgs()) {
              Console.WriteLine("--{0} : {1}", arg.Item1, arg.Item2);
            }
            return;
              }

              String versionText = File.ReadAllText(arguments.File).Trim();
              var version = RedmondVersion.Parse(versionText);

              switch(arguments.Increment) {
            case "major":
              version.IncrementMajor();
              break;
            case "minor":
              version.IncrementMinor();
              break;
            case "build":
              version.IncrementBuild();
              break;
            case "revision":
            default:
              version.IncrementRevision();
              break;
              }

              File.WriteAllText(arguments.File, version.ToString());
        }
开发者ID:serakrin,项目名称:presentations,代码行数:31,代码来源:Program.cs

示例5: Main

        public static int Main(string[] args)
        {
            //setup log4net
            log4net.Config.XmlConfigurator.Configure();

            int returnValue = -1;

            if (args.Length != 0)
            {
                //create the arguments
                Arguments arguments = new Arguments(args);

                //setup a task and run it
                MigrationTask task = Factory.Get<IMigrationTaskFactory>().GetMigrationTaskByTaskType(arguments);

                returnValue = task.RunTask();
            }
            else
            {
                //no args were passed in, lets display the help contents
                string helpFile = Resources.HelpInstructions;
                Console.Write(helpFile);
            }
            return returnValue;
        }
开发者ID:vermeeca,项目名称:SqlMigration,代码行数:25,代码来源:Program.cs

示例6: GithubRelease

 private GithubRelease(Arguments arguments)
 {
     Version = arguments.Version;
     Download = arguments.Download;
     Size = arguments.Size;
     Author = arguments.Author;
 }
开发者ID:adamhomer88,项目名称:CKAN,代码行数:7,代码来源:GithubRelease.cs

示例7: PostProcess

        protected override void PostProcess()
        {
            //Do the TAB2DB import (tab delimited files)
            Arguments a = new Arguments(this.Arguments);
            String dbFileName = a["db"].Trim().ToLower();
            String fileName = a["tab"].Trim();
            String tableName = a["table"] == null ? "" : a["table"].Trim().ToLower();
            bool hasHeader = a["noheader"] == null ? true : false;

            //new 04/07/11 - append data without recreating the table
            //allows import of data where split across multiple files
            bool append = a["append"] == null ? false : true;

            //char delimiter = a["delimiter"] == null ? ',' : a["delimiter"].PadRight(1,',').ToCharArray(0,1)[0];
            this.Out.WriteLine("Importing file '{0}' to db '{1}'", System.IO.Path.GetFileName(fileName), dbFileName);
            try
            {
                int rowCount = STELLAR.Data.API.Delimited2DB(dbFileName, fileName, tableName, '\t', hasHeader, append);
                this.Out.WriteLine("{0} rows imported", rowCount);
            }
            catch (Exception ex)
            {
                this.Error.WriteLine(ex.Message);
            }
        }
开发者ID:varixto,项目名称:stellar,代码行数:25,代码来源:CommandTAB2DB.cs

示例8: lt

/// <summary>
/// <para>Test if the first value is less than other.</para>
/// </summary>
/// <example><para>Example: Is 2 less than 2?</para>
/// <code>r.expr(2).lt(2).run(conn, callback)
/// </code></example>
                        public Lt lt ( Object exprA, params object[] exprs )
                        {
                        Arguments arguments = new Arguments(this);
                                arguments.CoerceAndAdd(exprA);
                                arguments.CoerceAndAddAll(exprs);
                        return new Lt (arguments );
                        }
开发者ID:gitter-badger,项目名称:RethinkDb.Driver,代码行数:13,代码来源:ReqlExpr.cs

示例9: Invoke

        public static string Invoke()
        {
            var subcommands = getSubcommands();

            // Retrieve the sub-command from the command line input.
            var arg = EnvUtils.GetArg(0);
            
            // Check for case of no input.
            if (arg == null)
            {
                return getSubcommandError(subcommands, SUB_CMD_REQ);
            }

            // Retrieve the sub-command method to execute.
            var method = findSubcommand(subcommands, arg);

            // Check for case of no sub-command found.
            if (method == null)
            {
                var msg = string.Format(SUB_CMD_INVALID_FMT, arg);
                return getSubcommandError(subcommands, msg);
            }

            // Invoke the sub-command.
            var subcommandArgs = new Arguments(EnvUtils.GetArgs(1));
            method.Invoke(null, new object[] { subcommandArgs });
            return null;
        }
开发者ID:c0ns0le,项目名称:avocado,代码行数:28,代码来源:Subcommand.cs

示例10: Main

        static int Main(String[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            Arguments arguments = new Arguments();
            arguments.Parse(args);

            Runner runner = new Runner();

            var prevCtx = SynchronizationContext.Current;
            try
            {
                var syncCtx = new SingleThreadSynchronizationContext();
                SynchronizationContext.SetSynchronizationContext(syncCtx);

                var t = runner.RunAsync(arguments);
                t.ContinueWith(
                    delegate { syncCtx.Complete(); }, TaskScheduler.Default);

                syncCtx.RunOnCurrentThread();

                var results = t.GetAwaiter().GetResult();
                return results;
            }
            finally { SynchronizationContext.SetSynchronizationContext(prevCtx); }
        }
开发者ID:holtsoftware,项目名称:HandBrakeRunner,代码行数:26,代码来源:Program.cs

示例11: ValidateArguments

 protected override bool ValidateArguments()
 {
     Arguments a = new Arguments(this.Arguments);
     if (a["rdf"] == null)
         return false;
     return true;
 }
开发者ID:varixto,项目名称:stellar,代码行数:7,代码来源:CommandRDFSTATS.cs

示例12: CachedFileGeneratorBase

        /// <summary>
        /// This implementation will not be implementing remote tokens, but will define the interface
        /// to be extended by ScriptCoreLib.Ultra.
        /// </summary>
        public CachedFileGeneratorBase(Arguments Arguments)
        {
            this.SourceVersionDir = Arguments.TargetDirectory.CreateSubdirectory("version");
            this.ConstructorArguments = Arguments;
            this.SourceVersion = new FileInfo(SourceVersionDir.FullName + "/" + Arguments.AssamblyFile.Name + "." + Arguments.Language.ToString() + ".version.txt");

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:11,代码来源:CachedFileGeneratorBase.cs

示例13: Invoke

 public override JSObject Invoke(JSObject thisBind, Arguments args)
 {
     var res = del(thisBind, args);
     if (res == null)
         return JSObject.Null;
     return res;
 }
开发者ID:modulexcite,项目名称:NiL.JS,代码行数:7,代码来源:ExternalFunction.cs

示例14: RunWithArgumentsUnchecked

        protected void RunWithArgumentsUnchecked(params string[] arguments)
        {
            var args = new Arguments(arguments);
            var runner = new ShovelRunner(ShovelStaticContext.TaskManager, args);

            runner.Execute();
        }
开发者ID:tleviathan,项目名称:Shovel,代码行数:7,代码来源:ShovelAcceptanceTestsBase.cs

示例15: GetArgument

 public Arguments GetArgument()
 {
     var result = new Arguments();
     if (TransportMode.HasValue)
     {
         result.Add("TransportMode", TransportMode.Value.ToTrafficDeviationInformationString());
     }
     if (!string.IsNullOrEmpty(LineNumber))
     {
         result.Add("LineNumber", LineNumber);
     }
     if (SiteId.HasValue)
     {
         result.Add("SiteId",SiteId.Value.ToString());
     }
     if (FromDate.HasValue && ToDate.HasValue)
     {
         result.Add("FromDate", FromDate.Value.ToString("yyyy-MM-dd"));
         result.Add("ToDate", ToDate.Value.ToString("yyyy-MM-dd"));
     }
     if (FromDate.HasValue ^ ToDate.HasValue)
     {
         throw new ArgumentException("if any of the parameters FromDate or ToDate is set then both must be set");
     }
     return result;
 }
开发者ID:arins,项目名称:dotNetSlApi,代码行数:26,代码来源:TrafficDeviationInformationRequest.cs


注:本文中的System.Arguments类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。