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


C# System.ConsoleOptions类代码示例

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


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

示例1: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            if (options.Values.Count == 0)
                return false;

            string jsonPath = options.Values[0];
            using (FileStream stream = File.OpenWrite(jsonPath)) {
                using (StreamWriter writer = new StreamWriter(stream)) {
                    if (dataNode is TagDataNode) {
                        TagDataNode tagNode = dataNode as TagDataNode;
                        WriteNbtTag(writer, tagNode.Tag);
                    }
                    else if (dataNode is NbtFileDataNode) {
                        dataNode.Expand();
                        TagNodeCompound root = new TagNodeCompound();

                        foreach (DataNode child in dataNode.Nodes) {
                            TagDataNode childTagNode = child as TagDataNode;
                            if (childTagNode == null)
                                continue;

                            if (childTagNode.Tag != null)
                                root.Add(childTagNode.NodeName, childTagNode.Tag);
                        }

                        WriteNbtTag(writer, root);
                    }
                }
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:32,代码来源:JsonOperation.cs

示例2: SetUp

 public void SetUp()
 {
     assemblyOptions = new ConsoleOptions(new string[]
         { firstAssembly, secondAssembly });
     fixtureOptions = new ConsoleOptions(new string[]
         { "-fixture:"+fixture, firstAssembly, secondAssembly });
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:7,代码来源:CommandLineTests_MultipleAssemblies.cs

示例3: Process

        public override bool Process(DataNode dataNode, ConsoleOptions options)
        {
            string value = options.Values[0];

            TagDataNode tagDataNode = dataNode as TagDataNode;
            return tagDataNode.Parse(value);
        }
开发者ID:Warpten,项目名称:NBTExplorer,代码行数:7,代码来源:EditOperation.cs

示例4: CanRecognizeBooleanOptions

        public void CanRecognizeBooleanOptions(string propertyName, string pattern)
        {
            Console.WriteLine("Testing " + propertyName);
            string[] prototypes = pattern.Split('|');

            PropertyInfo property = GetPropertyInfo(propertyName);
            Assert.AreEqual(typeof(bool), property.PropertyType, "Property '{0}' is wrong type", propertyName);

            foreach (string option in prototypes)
            {
                ConsoleOptions options = new ConsoleOptions("-" + option);
                Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize -" + option);

                options = new ConsoleOptions("-" + option + "+");
                Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize -" + option + "+");

                options = new ConsoleOptions("-" + option + "-");
                Assert.AreEqual(false, (bool)property.GetValue(options, null), "Didn't recognize -" + option + "-");

                options = new ConsoleOptions("--" + option);
                Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize --" + option);

                options = new ConsoleOptions("/" + option);
                Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize /" + option);
            }
        }
开发者ID:rojac07,项目名称:nunit,代码行数:26,代码来源:CommandLineTests.cs

示例5: FixtureNamePlusAssemblyIsValid

 public void FixtureNamePlusAssemblyIsValid()
 {
     ConsoleOptions options = new ConsoleOptions( "-fixture:NUnit.Tests.AllTests", "nunit.tests.dll" );
     Assert.AreEqual("nunit.tests.dll", options.Parameters[0]);
     Assert.AreEqual("NUnit.Tests.AllTests", options.fixture);
     Assert.IsTrue(options.Validate());
 }
开发者ID:torkelo,项目名称:shouldly,代码行数:7,代码来源:CommandLineTests.cs

示例6: HelpTextUsesCorrectDelimiterForPlatform

        public void HelpTextUsesCorrectDelimiterForPlatform()
        {
            string helpText = new ConsoleOptions().GetHelpText();
            char delim = System.IO.Path.DirectorySeparatorChar == '/' ? '-' : '/';

            string expected = string.Format( "{0}output=", delim );
            StringAssert.Contains( expected, helpText );

            expected = string.Format( "{0}out=", delim );
            StringAssert.Contains( expected, helpText );
        }
开发者ID:torkelo,项目名称:shouldly,代码行数:11,代码来源:CommandLineTests.cs

示例7: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            Console.WriteLine(TypePrinter.Print(dataNode, options.ShowTypes));

            if (dataNode.IsContainerType) {
                foreach (var child in dataNode.Nodes)
                    Console.WriteLine(" | " + TypePrinter.Print(child, options.ShowTypes));
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:11,代码来源:PrintOperation.cs

示例8: PrintSubTree

        private void PrintSubTree (DataNode dataNode, ConsoleOptions options, string indent, bool last)
        {
            Console.WriteLine(indent + " + " + TypePrinter.Print(dataNode, options.ShowTypes));

            indent += last ? "  " : " |";
            int cnt = 0;

            dataNode.Expand();
            foreach (DataNode child in dataNode.Nodes) {
                cnt++;
                PrintSubTree(child, options, indent, cnt == dataNode.Nodes.Count);
            }
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:13,代码来源:PrintTreeOperation.cs

示例9: ExcludeCategories

 public void ExcludeCategories()
 {
     ConsoleOptions options = new ConsoleOptions( "tests.dll", "-exclude:Database;Slow" );
     Assert.IsTrue( options.Validate() );
     Assert.IsNotNull(options.exclude);
     Assert.AreEqual(options.exclude, "Database;Slow");
     Assert.IsTrue(options.HasExclude);
     string[] categories = options.ExcludedCategories;
     Assert.IsNotNull(categories);
     Assert.AreEqual(2, categories.Length);
     Assert.AreEqual("Database", categories[0]);
     Assert.AreEqual("Slow", categories[1]);
 }
开发者ID:fotisp,项目名称:conqat,代码行数:13,代码来源:CommandLineTests.cs

示例10: TestBooleanOption

		private void TestBooleanOption( string fieldName, string option )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field '{0}' not found", fieldName );
			Assert.AreEqual( typeof(bool), field.FieldType, "Field '{0}' is wrong type", fieldName );

			ConsoleOptions options = new ConsoleOptions( "-" + option );
			Assert.AreEqual( true, (bool)field.GetValue( options ), "Didn't recognize -" + option );
			options = new ConsoleOptions( "--" + option );
			Assert.AreEqual( true, (bool)field.GetValue( options ), "Didn't recognize --" + option );
			options = new ConsoleOptions( false, "/" + option );
			Assert.AreEqual( false, (bool)field.GetValue( options ), "Incorrectly recognized /" + option );
			options = new ConsoleOptions( true, "/" + option );
			Assert.AreEqual( true, (bool)field.GetValue( options ), "Didn't recognize /" + option );
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:15,代码来源:CommandLineTests.cs

示例11: TestStringOption

		private void TestStringOption( string fieldName, string option )
		{
			FieldInfo field = typeof(ConsoleOptions).GetField( fieldName );
			Assert.IsNotNull( field, "Field {0} not found", fieldName );
			Assert.AreEqual( typeof(string), field.FieldType );

			ConsoleOptions options = new ConsoleOptions( "-" + option + ":text" );
			Assert.AreEqual( "text", (string)field.GetValue( options ), "Didn't recognize -" + option );
			options = new ConsoleOptions( "--" + option + ":text" );
			Assert.AreEqual( "text", (string)field.GetValue( options ), "Didn't recognize --" + option );
			options = new ConsoleOptions( false, "/" + option + ":text" );
			Assert.AreEqual( null, (string)field.GetValue( options ), "Incorrectly recognized /" + option );
			options = new ConsoleOptions( true, "/" + option + ":text" );
			Assert.AreEqual( "text", (string)field.GetValue( options ), "Didn't recognize /" + option );
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:15,代码来源:CommandLineTests.cs

示例12: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            TagListDataNode listNode = dataNode as TagListDataNode;

            listNode.Clear();
            foreach (string value in options.Values) {
                TagNode tag = TagDataNode.DefaultTag(listNode.Tag.ValueType);
                TagDataNode tagData = TagDataNode.CreateFromTag(tag);
                if (!tagData.Parse(value))
                    return false;

                if (!listNode.AppendTag(tagData.Tag))
                    return false;
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:17,代码来源:SetListOperation.cs

示例13: Run

        public void Run()
        {
            this.options = ConsoleOptions.ParseArgs(this.args);
            this.configuration = Configuration.LoadConfig(this.options.ConfigFile);
            if (this.configuration != null)
            {
                Logger.SetupLogger(this.configuration.Get[Configuration.LogConfigFilePath]);
                TestRunner.RunTests(this.configuration);
            }
            else
            {
                Console.WriteLine("Error. File config.xml not found or corrupted.");
            }

            if (this.options.Silent) return;
            Console.Write("Press any key to exit.");
            Console.ReadKey();
        }
开发者ID:ograchikov,项目名称:MailDriver,代码行数:18,代码来源:MailDriverEngine.cs

示例14: ServoSorter

        public ServoSorter(
            ICaptureGrab capture
            ,ConsoleOptions options) : base(capture)
        {
            _servoPosition = 70;

            Settings = options.ColourSettings;

            _debounceWatch = new Stopwatch();

            var deviceFactory = new Pca9685DeviceFactory();
            var device = deviceFactory.GetDevice(options.UseFakeDevice);
            SetLogLevel(device);
            
            _pwmControl = new ServoSortPwmControl(device);
            _pwmControl.Init();

            _detector = new ColourDetector();
        }
开发者ID:neutmute,项目名称:PiCamCV,代码行数:19,代码来源:ServoSorter.cs

示例15: OptionsValid

 public override bool OptionsValid(ConsoleOptions options)
 {
     if (options.Values.Count == 0)
         return false;
     return true;
 }
开发者ID:Warpten,项目名称:NBTExplorer,代码行数:6,代码来源:EditOperation.cs


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