public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("TDDIArgumentationElementUnion"); oprot.WriteStructBegin(struc); TField field = new TField(); if (ArgumentGroup != null && __isset.ArgumentGroup) { field.Name = "ArgumentGroup"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); ArgumentGroup.Write(oprot); oprot.WriteFieldEnd(); } if (ArgumentPackage != null && __isset.ArgumentPackage) { field.Name = "ArgumentPackage"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); ArgumentPackage.Write(oprot); oprot.WriteFieldEnd(); } if (ArgumentAsset != null && __isset.ArgumentAsset) { field.Name = "ArgumentAsset"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); ArgumentAsset.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public static void Main(string[] args) { args = new String[] { "-s", "0", "-u", @"HELLO\world", "-e", "-b", "This is a test", "-c", "This", "is", "a", "test" }; UserParameters parameters = new UserParameters(); ArgumentGroup manual = new ArgumentGroup( new ManualArgument( "aaaaa", "a", "Example Description 1", () => Console.WriteLine("Occurs when supplied"), () => Console.WriteLine("Occurs when not supplied")), new ManualArgument( "bbbbb", "b", "Example Value", "Example Description 2", x => Console.WriteLine($"Test: {x}")), new ManualArgument( "ccccc", "c", "Example Value 2", "Example Description 3", 4, x => Console.WriteLine($"Test: {string.Join(" ", x)}"))); bool helpRequested = Context.Initialize(args, new string[] { "-" }, "?", manual); Context.Invoke(); Console.WriteLine($"{parameters.StatusCode}, {parameters.Username}, {parameters.Execute}"); Console.WriteLine( string.Join( "\r\n", Context .Arguments .Select(x => $"{x.LongName} ({x.ShortName}): Required - {x.Required}. Example - {x.ExampleValue}. {x.Description}"))); Console.ReadLine(); }