當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。