コード例 #1
0
ファイル: Value.cs プロジェクト: T145/razordbx
 public Value(byte[] bytes, ValueFlag type)
 {
     byte[] b = new byte[bytes.Length + 1];
     b [0] = (byte)type;
     Array.Copy (bytes, 0, b, 1, bytes.Length);
     _bytes = new ByteArray (b);
 }
コード例 #2
0
ファイル: Value.cs プロジェクト: T145/archive
 public Value(byte[] bytes, ValueFlag type)
 {
     byte[] b = new byte[bytes.Length + 1];
     b [0] = (byte)type;
     Array.Copy(bytes, 0, b, 1, bytes.Length);
     _bytes = new ByteArray(b);
 }
コード例 #3
0
ファイル: FlagTests.cs プロジェクト: mikeruhl/goflag
        public void TestUnquoteUsageBool(string name, bool defaultValue, string usage, string expectedName, string expectedUsage)
        {
            var f = new ValueFlag <bool>(name, defaultValue, usage);

            var(n, u) = f.UnquoteUsage();
            Assert.True(expectedName == n, $"expected name does not match, got: {n}, wanted: {expectedName}");
            Assert.True(expectedUsage == u, $"expected usage does not match, got: {u}, wanted: {expectedUsage}");
        }
コード例 #4
0
 public static string GetStringByStatus(ValueFlag valFlag)
 {
     if (valFlag == ValueFlag.ValueNotInit)
     {
         return("Unknown");
     }
     else if (valFlag == ValueFlag.ValueOk)
     {
         return("OnLine");
     }
     else
     {
         return("OffLine");
     }
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: mikeruhl/goflag
        static void Main(string[] args)
        {
            args = new[] { "-book", "The Hitchhiker's Guide to the Galaxy",
                           "-book", "The Restaurant at the End of the Universe",
                           "-book", "Life, the Universe and Everything" };
            var fs       = Flag.NewFlagSet("ArrayBuilder", ErrorHandling.ContinueOnError);
            var bookFlag = new ValueFlag <string[]>("book", new string[0], "No b", ParseArray);

            fs.Var(bookFlag);
            fs.Parse(args);
            Console.WriteLine("Books:");
            foreach (var b in bookFlag.Value)
            {
                Console.WriteLine($"\t{b}");
            }
        }