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


C# OptionSet.Add方法代码示例

本文整理汇总了C#中OptionSet.Add方法的典型用法代码示例。如果您正苦于以下问题:C# OptionSet.Add方法的具体用法?C# OptionSet.Add怎么用?C# OptionSet.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OptionSet的用法示例。


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

示例1: SetOptions

 protected override void SetOptions(OptionSet options)
 {
     SetCommonOptions(options);
     options.Add("project=", "Name of the project", v => ProjectName = v);
     options.Add("from=", "Name of the environment to get the current deployment from, e.g., Staging", v => FromEnvironmentName = v);
     options.Add("to=|deployto=", "Environment to deploy to, e.g., Production", v => DeployToEnvironmentNames.Add(v));
 }
开发者ID:nishanperera,项目名称:Octopus-Tools,代码行数:7,代码来源:PromoteReleaseCommand.cs

示例2: Main

        static void Main(string[] args)
        {
            OptionSet Options = new OptionSet();
            bool SaveToFile = false;
            string FileName = null;
            int SleepDuration = 0;

            Options.Add("?|h|help", value => PrintUsage());
            Options.Add("f", value => SaveToFile = (value != null));
            Options.Add("filename=", value => FileName = value);
            Options.Add("timeout=", value => SleepDuration = Convert.ToInt32(value));

            Options.Parse(args);

            if (SleepDuration != 0)
            {
                System.Threading.Thread.Sleep(SleepDuration * 1000);
            }

            InjectPrintscreenKeySequence();

            using (Stream stream = printscreen.Properties.Resources.CameraSnap)
            {
                new SoundPlayer(stream).PlaySync();
            }

            if (SaveToFile || FileName != null)
            {
                SaveImageToFile(FileName);
            }
        }
开发者ID:jasonsch,项目名称:WindowsCLI,代码行数:31,代码来源:Program.cs

示例3: AddOptions

        public void AddOptions(OptionSet options)
        {
            ArgumentUtility.CheckNotNull ("options", options);

              options.Add (
            "att|attribute=",
            "Mark affected methods with custom attribute [None | Generated | Custom] (default = Generated)",
            att => _mode = (AttributeMode) Enum.Parse (typeof (AttributeMode), att));
              options.Add (
            "attPrefix=",
            "The unspeakable prefix for the virtual method. (default value: '<>virtualized_')",
            prefix => _unspeakablePrefix = prefix);
              options.Add (
            "attFullName=",
            "Fullname of the attribute type (default value: 'NonVirtualAttributeNonVirtualAttribute').",
              at => {
                _attName = at.Substring (at.LastIndexOf (".") + 1, at.Length - at.LastIndexOf (".") - 1);
                _attNamespace = at.Substring (0, at.LastIndexOf ("."));
              } );
              options.Add (
            "attFile|attributeFile=",
            "Assembly containing the custom attribute (dll or exe). ONLY applicable in 'Custom' attribute mode!",
            custAtt => _attributeAssembly = custAtt);

              _selectionFactory = new TargetSelectorFactory ();
              _selectionFactory.AddOptions (options);
        }
开发者ID:rubicon-oss,项目名称:AssemblyTransformer,代码行数:27,代码来源:AssemblyMethodVirtualizerFactory.cs

示例4: Main

        public static void Main(string[] args)
        {
            var libs = new List<Assembly> ();
            var opts = new OptionSet ();

            opts.Add ("r=", "load extra {ASSEMBLY}",
            x => {
                try {
                    libs.Add (System.Reflection.Assembly.LoadFile (x));
                } catch (System.IO.FileNotFoundException) {
                    Console.Error.WriteLine ("Error: no such assembly file " + x);
                    System.Environment.Exit (1);
                } catch (Exception e) {
                    Console.Error.WriteLine ("Error: " + e.Message);
                    System.Environment.Exit (1);
                }
            });

            opts.Add ("help", "print this message",
            x => {
                Console.WriteLine ("Usage: xamlpreviewer [OPTIONS] [FILE.xaml]");
                Console.WriteLine ();
                opts.WriteOptionDescriptions (Console.Out);
                Console.WriteLine ();
                System.Environment.Exit (1);
            });

            var remain = opts.Parse (args);
            string file = null;
            if (remain.Count > 0)
                file = remain [0];

            Start (file, libs);
        }
开发者ID:inorton,项目名称:XamlPreviewer,代码行数:34,代码来源:Main.cs

示例5: Program

        public Program()
        {
            options = new OptionSet();

            options.Add("offset=", "", v => offset_type = v);
            options.Add("all", "", v => show_all = v != null);
            options.Add("dos-header", "", v => show_dos_header = v != null);
            options.Add("dos-stub", "", v => show_dos_stub = v != null);
            options.Add("file-header", "", v => show_file_header = v != null);
            options.Add("optional-header", "", v => show_opt_header = v != null);
            options.Add("data-directories", "", v => show_data_directories = v != null);
            options.Add("sections", "", v => show_section_table = v != null);
            options.Add("debug", "", v => show_debug = v != null);
            options.Add("load-config", "", v => show_load_config = v != null);

            offset_type = "fo";
            show_all = false;
            show_dos_header = false;
            show_dos_stub = false;
            show_file_header = false;
            show_opt_header = false;
            show_data_directories = false;
            show_section_table = false;
            show_debug = false;
            show_load_config = false;
        }
开发者ID:Workshell,项目名称:pe,代码行数:26,代码来源:Program.cs

示例6: ParseOptions

 internal static LexerOptions ParseOptions(string[] args)
 {
     var options = new OptionSet();
     var help = false;
     options.Add("h|?|help", "output this help information", o => help = true);
     var version = false;
     options.Add("V|version", "report version", o => version = true);
     var operands = options.Parse(args);
     if(help)
     {
         PrintHelp(options);
         return null;
     }
     if(version)
     {
         PrintVersion();
         return null;
     }
     if(operands.Count != 1)
     {
         Console.WriteLine("Must specify a single lexer file");
         PrintHelp(options);
         return null;
     }
     return new LexerOptions(operands[0]);
 }
开发者ID:adamant-deprecated,项目名称:AdamantTemporaryCompiler,代码行数:26,代码来源:Program.cs

示例7: SignatureCommand

 public SignatureCommand()
 {
     options = new OptionSet();
     options.Positional("basis-file", "The file to read and create a signature from.", v => basisFilePath = v);
     options.Positional("signature-file", "The file to write the signature to.", v => signatureFilePath = v);
     options.Add("chunk-size=", string.Format("Maximum bytes per chunk. Defaults to {0}. Min of {1}, max of {2}.", SignatureBuilder.DefaultChunkSize, SignatureBuilder.MinimumChunkSize, SignatureBuilder.MaximumChunkSize), v => configuration.Add(builder => builder.ChunkSize = short.Parse(v)));
     options.Add("progress", "Whether progress should be written to stdout", v => configuration.Add(builder => builder.ProgressReporter = new ConsoleProgressReporter()));
 }
开发者ID:NsdWorkBook,项目名称:Octodiff,代码行数:8,代码来源:SignatureCommand.cs

示例8: Run

        public static void Run(params string[] args)
        {
            var logger = LoggerFactory();

            var config = new ElevatorConfiguration();
            var optionSet = new OptionSet();
            optionSet.Add("up", option =>
            {
                config.Direction = option;
            });
            optionSet.Add("assembly=", option =>
            {
                config.AssemblyIsSpecified = true;
                config.AssemblyName = option;
            });
            optionSet.Parse(args);

            if (string.IsNullOrEmpty(config.Direction))
            {
                logger.Log("You have to specify direction:");
                logger.Log("\tElevator.exe -up, for going up");
                logger.Log("\tElevator.exe -down, for going down (not supported yet)");
            }
            else if (!config.AssemblyIsSpecified)
            {
                logger.Log("You have to specify migration assembly:");
                logger.Log("\tElevator.exe -up -assembly:name.dll");
            }

            if (config.IsValid())
            {
                var migrationAssembly = Assembly.LoadFrom(Path.Combine(Environment.CurrentDirectory, config.AssemblyName));
                var levelDataStorageClasses = new LevelDataStorageClassFinder().Find(migrationAssembly);
                if (levelDataStorageClasses.Any())
                {
                    var levelDataStorage = Activator.CreateInstance(levelDataStorageClasses.First()) as ILevelDataStorage;
                    levelDataStorage.Initialize();

                    var levelsCalsses = new ElevatorLevelClassFinder().Find(migrationAssembly);
                    var levelFactory = new LevelFactory();
                    var levels = new List<Level>();

                    foreach (var levelClass in levelsCalsses)
                    {
                        levels.Add(levelFactory.NewLevel(levelClass));
                    }

                    var elevator = new Lift(new ConsoleLogger(), levelDataStorage);
                    elevator.AddLevel(levels.ToArray());
                    elevator.Start();
                    elevator.Top();
                }
                else
                {
                    logger.Log("Could not find a class in assembly 'Tests.Empty.dll' that implements the ILevelDataStorage interface.");
                }
            }
        }
开发者ID:goeran,项目名称:Elevator,代码行数:58,代码来源:Shell.cs

示例9: Program

        private Program()
        {
            Context.Clear();
            AppDomain.CurrentDomain.ProcessExit += (sender, eventArgs) => Context.Clear();

            optionSet = new OptionSet();
            optionSet.Add("port:", OptionCategory.General, "Change default port (8585).", s => port = int.Parse(s));
            optionSet.Add("h|?|help", OptionCategory.Help, string.Empty, v => PrintUsageAndExit(0));
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:9,代码来源:Program.cs

示例10: PatchCommand

 public PatchCommand()
 {
     options = new OptionSet();
     options.Positional("basis-file", "The file that the delta was created for.", v => basisFilePath = v);
     options.Positional("delta-file", "The delta to apply to the basis file", v => deltaFilePath = v);
     options.Positional("new-file", "The file to write the result to.", v => newFilePath = v);
     options.Add("progress", "Whether progress should be written to stdout", v => progressReporter = new ConsoleProgressReporter());
     options.Add("skip-verification", "Skip checking whether the basis file is the same as the file used to produce the signature that created the delta.", v => skipHashCheck = true);
 }
开发者ID:NsdWorkBook,项目名称:Octodiff,代码行数:9,代码来源:PatchCommand.cs

示例11: ParseJoinedOptions

 protected static void ParseJoinedOptions(string[] args, OptionSet set1, OptionSet set2)
 {
     var temp = new OptionSet();
     foreach (var s in set1)
         temp.Add(s);
     foreach (var s in set2)
         temp.Add(s);
     temp.Parse(args);
 }
开发者ID:vosen,项目名称:Juiz,代码行数:9,代码来源:ProgramBase.cs

示例12: Main

        public static void Main(string[] args)
        {
            bool showHelp = false;
            bool showVersion = false;

            // search in the local directory for espg files
            // so Windows ppl don't have to have it installed
            ProjFourWrapper.CustomSearchPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            MapSerializer ms = new MapSerializer();
            ms.AddDatabaseFeatureSourceType<PostGISFeatureSource>();
            ms.AddDatabaseFeatureSourceType<Cumberland.Data.SqlServer.SqlServerFeatureSource>();

            OptionSet options = new OptionSet();

            options.Add("h|help",  "show this message and exit",
                        delegate (string v) { showHelp = v!= null; });
            options.Add("v|version",
                        "Displays the version",
                        delegate(string v) { showVersion = v != null; });

            options.Parse(args);

            if (showVersion)
            {
                System.Console.WriteLine("Version " +
                                         System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
                return;
            }

            if (showHelp)
            {
                ShowHelp(options);
                return;
            }

            if (args.Length == 0)
            {
                Console.WriteLine("No Map file specified");
                ShowHelp(options);
                return;
            }

            if (args.Length == 1)
            {
                Console.WriteLine("No output file specified");
                ShowHelp(options);
                return;
            }

            Map map = ms.Deserialize(args[0]);

            File.WriteAllText(args[1],
                KeyholeMarkupLanguage.CreateFromMap(map),
                Encoding.UTF8);
        }
开发者ID:agrath,项目名称:cumberland,代码行数:56,代码来源:Main.cs

示例13: OctopusSessionFactory

        public OctopusSessionFactory(ILog log, ICommandLineArgsProvider commandLineArgsProvider)
        {
            this.log = log;

            var options = new OptionSet();
            options.Add("server=", "The base URL for your Octopus server - e.g., http://myserver/", v => serverBaseUrl = v);
            options.Add("user=", "[Optional] Username to use when authenticating with the server.", v => user = v);
            options.Add("pass=", "[Optional] Password to use when authenticating with the server.", v => pass = v);

            options.Parse(commandLineArgsProvider.Args);
        }
开发者ID:pawelpabich,项目名称:Octopus-Tools,代码行数:11,代码来源:OctopusSessionFactory.cs

示例14: AddOptions

        public void AddOptions(OptionSet options)
        {
            ArgumentUtility.CheckNotNull ("options", options);

              options.Add (
            "k|defaultKey=",
            "The default key (.snk) to be used to sign Assemblies.",
            key => _defaultKeyFile = key);
              options.Add (
            "y|keyDir=",
            "The root dir of all available keys (.snk) to sign Assemblies.",
            allKeys => _allKeysDirectory = allKeys);
        }
开发者ID:rubicon-oss,项目名称:AssemblyTransformer,代码行数:13,代码来源:AssemblySignerFactory.cs

示例15: AddOptions

        public void AddOptions(OptionSet options)
        {
            ArgumentUtility.CheckNotNull ("options", options);

              options.Add (
              "e|exclude=",
              "The targeted assemblies (eg: -b=Remotion.Interfaces.dll -b=SomeLibrary.*.dll)",
              b => _blackList.Add (b));
              options.Add (
              "s|subdirs",
              "Include subdirectories of the workingdir.",
              b => _includeSubDirs = (b != null ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly));
        }
开发者ID:rubicon-oss,项目名称:AssemblyTransformer,代码行数:13,代码来源:DirectoryBasedAssemblyTrackerFactory.cs


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