static LimitsConstants() { EDAM_MIME_TYPES.Add("image/gif"); EDAM_MIME_TYPES.Add("image/jpeg"); EDAM_MIME_TYPES.Add("image/png"); EDAM_MIME_TYPES.Add("audio/wav"); EDAM_MIME_TYPES.Add("audio/mpeg"); EDAM_MIME_TYPES.Add("audio/amr"); EDAM_MIME_TYPES.Add("application/vnd.evernote.ink"); EDAM_MIME_TYPES.Add("application/pdf"); EDAM_MIME_TYPES.Add("video/mp4"); EDAM_MIME_TYPES.Add("audio/aac"); EDAM_MIME_TYPES.Add("audio/mp4"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/msword"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/mspowerpoint"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/excel"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.ms-word"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.ms-powerpoint"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.ms-excel"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.openxmlformats-officedocument.presentationml.presentation"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.apple.pages"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.apple.numbers"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/vnd.apple.keynote"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/x-iwork-pages-sffpages"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/x-iwork-numbers-sffnumbers"); EDAM_INDEXABLE_RESOURCE_MIME_TYPES.Add("application/x-iwork-keynote-sffkey"); EDAM_INDEXABLE_PLAINTEXT_MIME_TYPES.Add("application/x-sh"); EDAM_INDEXABLE_PLAINTEXT_MIME_TYPES.Add("application/x-bsh"); EDAM_INDEXABLE_PLAINTEXT_MIME_TYPES.Add("application/sql"); EDAM_INDEXABLE_PLAINTEXT_MIME_TYPES.Add("application/x-sql"); EDAM_PUBLISHING_URI_PROHIBITED.Add("."); EDAM_PUBLISHING_URI_PROHIBITED.Add(".."); }
static TCLIServiceConstants() { PRIMITIVE_TYPES.Add(TTypeId.BOOLEAN_TYPE); PRIMITIVE_TYPES.Add(TTypeId.TINYINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.SMALLINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.INT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.BIGINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.FLOAT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.DOUBLE_TYPE); PRIMITIVE_TYPES.Add(TTypeId.STRING_TYPE); PRIMITIVE_TYPES.Add(TTypeId.TIMESTAMP_TYPE); PRIMITIVE_TYPES.Add(TTypeId.BINARY_TYPE); PRIMITIVE_TYPES.Add(TTypeId.DECIMAL_TYPE); PRIMITIVE_TYPES.Add(TTypeId.NULL_TYPE); PRIMITIVE_TYPES.Add(TTypeId.DATE_TYPE); PRIMITIVE_TYPES.Add(TTypeId.VARCHAR_TYPE); PRIMITIVE_TYPES.Add(TTypeId.CHAR_TYPE); PRIMITIVE_TYPES.Add(TTypeId.INTERVAL_YEAR_MONTH_TYPE); PRIMITIVE_TYPES.Add(TTypeId.INTERVAL_DAY_TIME_TYPE); COMPLEX_TYPES.Add(TTypeId.ARRAY_TYPE); COMPLEX_TYPES.Add(TTypeId.MAP_TYPE); COMPLEX_TYPES.Add(TTypeId.STRUCT_TYPE); COMPLEX_TYPES.Add(TTypeId.UNION_TYPE); COMPLEX_TYPES.Add(TTypeId.USER_DEFINED_TYPE); COLLECTION_TYPES.Add(TTypeId.ARRAY_TYPE); COLLECTION_TYPES.Add(TTypeId.MAP_TYPE); TYPE_NAMES[TTypeId.ARRAY_TYPE] = "ARRAY"; TYPE_NAMES[TTypeId.BIGINT_TYPE] = "BIGINT"; TYPE_NAMES[TTypeId.BINARY_TYPE] = "BINARY"; TYPE_NAMES[TTypeId.BOOLEAN_TYPE] = "BOOLEAN"; TYPE_NAMES[TTypeId.CHAR_TYPE] = "CHAR"; TYPE_NAMES[TTypeId.DATE_TYPE] = "DATE"; TYPE_NAMES[TTypeId.DECIMAL_TYPE] = "DECIMAL"; TYPE_NAMES[TTypeId.DOUBLE_TYPE] = "DOUBLE"; TYPE_NAMES[TTypeId.FLOAT_TYPE] = "FLOAT"; TYPE_NAMES[TTypeId.INTERVAL_DAY_TIME_TYPE] = "INTERVAL_DAY_TIME"; TYPE_NAMES[TTypeId.INTERVAL_YEAR_MONTH_TYPE] = "INTERVAL_YEAR_MONTH"; TYPE_NAMES[TTypeId.INT_TYPE] = "INT"; TYPE_NAMES[TTypeId.MAP_TYPE] = "MAP"; TYPE_NAMES[TTypeId.NULL_TYPE] = "NULL"; TYPE_NAMES[TTypeId.SMALLINT_TYPE] = "SMALLINT"; TYPE_NAMES[TTypeId.STRING_TYPE] = "STRING"; TYPE_NAMES[TTypeId.STRUCT_TYPE] = "STRUCT"; TYPE_NAMES[TTypeId.TIMESTAMP_TYPE] = "TIMESTAMP"; TYPE_NAMES[TTypeId.TINYINT_TYPE] = "TINYINT"; TYPE_NAMES[TTypeId.UNION_TYPE] = "UNIONTYPE"; TYPE_NAMES[TTypeId.VARCHAR_TYPE] = "VARCHAR"; }
/// <summary> /// Loops on processing a client forever /// threadContext will be a TTransport instance /// </summary> /// <param name="threadContext"></param> private void Execute() { while (!stop) { TTransport client; Thread t; lock (clientLock) { //don't dequeue if too many connections while (clientThreads.Count >= maxThreads) { Monitor.Wait(clientLock); } while (clientQueue.Count == 0) { Monitor.Wait(clientLock); } client = clientQueue.Dequeue(); t = new Thread(new ParameterizedThreadStart(ClientWorker)); clientThreads.Add(t); } //start processing requests from client on new thread t.Start(client); } }
/// <summary> /// 增加实体Key /// </summary> /// <param name="indexValue"></param> internal void Add(string indexValue) { if (!_indexHashSet.Contains(indexValue)) { _indexHashSet.Add(indexValue); } }
/// <summary> /// Loops on processing a client forever /// threadContext will be a TTransport instance /// </summary> /// <param name="threadContext"></param> private void Execute() { while (!stop) { Thread t = null; lock (clientLock) { bool goAhead = false; //don't dequeue if too many connections goAhead = (clientThreads.Count < maxThreads); goAhead = goAhead && (clientQueue.Count > 0); if (goAhead) { TTransport client = clientQueue.Dequeue(); ClientWorker worker = new ClientWorker(client, this); t = new Thread(new ThreadStart(worker.DoWork)); clientThreads.Add(t); } } if (t == null) { Thread.Sleep(100); } else { //start processing requests from client on new thread t.Start(); } } }
public static void AddExprerience(GameUser user, int experience) { string userID = user.UserID; var userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(userID, m => m.MagicID == user.UseMagicID); THashSet<int> generalHash = new THashSet<int>(); foreach (UserEmbattle userEmbattle in userEmbattleList) { //wuzf 8-18 修复多个相同佣兵阵形数据 if (generalHash.Contains(userEmbattle.GeneralID)) { userEmbattle.GeneralID = 0; //userEmbattle.Update(); continue; } else { generalHash.Add(userEmbattle.GeneralID); } //UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(userID, userEmbattle.GeneralID); //if (userGeneral != null) //{ // userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, experience); //} } //UserHelper.UserGeneralExp(user.UserID, experience); }
public Extension(string launchKey, string canonicalName, Version version, string vendor, ISet <string> supportedLanguages, string hostname = "localhost", int port = 36888) { transport = new TSocket(hostname, port); transport.Open(); protocol = new TBinaryProtocol(transport); extensionProtocol = new TMultiplexedProtocol(protocol, "Extension"); controllerProtocol = new TMultiplexedProtocol(protocol, "Controller"); pendantProtocol = new TMultiplexedProtocol(protocol, "Pendant"); client = new API.Extension.Client(extensionProtocol); var languages = new THashSet <string>(); foreach (var language in supportedLanguages) { languages.Add(language); } id = client.registerExtension(launchKey, canonicalName, version, vendor, languages); if (id == 0) { throw new Exception("Extension registration failed."); } controllerMap = new Dictionary <long, Controller>(); pendantMap = new Dictionary <long, Pendant>(); }
static Constants() { EDAM_MIME_TYPES.Add("image/gif"); EDAM_MIME_TYPES.Add("image/jpeg"); EDAM_MIME_TYPES.Add("image/png"); EDAM_MIME_TYPES.Add("audio/wav"); EDAM_MIME_TYPES.Add("audio/mpeg"); EDAM_MIME_TYPES.Add("audio/amr"); EDAM_MIME_TYPES.Add("application/vnd.evernote.ink"); EDAM_MIME_TYPES.Add("application/pdf"); EDAM_MIME_TYPES.Add("video/mp4"); EDAM_PUBLISHING_URI_PROHIBITED.Add(".."); }
static Constants() { PrimitiveTypes.Add("void"); PrimitiveTypes.Add("boolean"); PrimitiveTypes.Add("tinyint"); PrimitiveTypes.Add("smallint"); PrimitiveTypes.Add("int"); PrimitiveTypes.Add("bigint"); PrimitiveTypes.Add("float"); PrimitiveTypes.Add("double"); PrimitiveTypes.Add("string"); PrimitiveTypes.Add("date"); PrimitiveTypes.Add("datetime"); PrimitiveTypes.Add("timestamp"); CollectionTypes.Add("array"); CollectionTypes.Add("map"); }
public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Set) { { TSet _set200 = await iprot.ReadSetBeginAsync(cancellationToken); With_default = new THashSet <string>(_set200.Count); for (int _i201 = 0; _i201 < _set200.Count; ++_i201) { string _elem202; _elem202 = await iprot.ReadStringAsync(cancellationToken); With_default.Add(_elem202); } await iprot.ReadSetEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } }
public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 2: if (field.Type == TType.Set) { { TSet _set365 = await iprot.ReadSetBeginAsync(cancellationToken); Mids = new THashSet <string>(_set365.Count); for (int _i366 = 0; _i366 < _set365.Count; ++_i366) { string _elem367; _elem367 = await iprot.ReadStringAsync(cancellationToken); Mids.Add(_elem367); } await iprot.ReadSetEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Set) { { KeysOnly = new THashSet<string>(); TSet _set8 = iprot.ReadSetBegin(); for( int _i9 = 0; _i9 < _set8.Count; ++_i9) { string _elem10 = null; _elem10 = iprot.ReadString(); KeysOnly.Add(_elem10); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Map) { { FullMap = new Dictionary<string, string>(); TMap _map11 = iprot.ReadMapBegin(); for( int _i12 = 0; _i12 < _map11.Count; ++_i12) { string _key13; string _val14; _key13 = iprot.ReadString(); _val14 = iprot.ReadString(); FullMap[_key13] = _val14; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
private static THashSet <int> CreateIntHashSet(int count) { var retval = new THashSet <int>(); for (var i = 0; i < count; ++i) { retval.Add(i); } return(retval); }
private static THashSet <List <Dictionary <Insanity, string> > > CreateListFieldDataDictValue(int count) { var retval = new THashSet <List <Dictionary <Insanity, string> > >(); for (var i = 0; i < count; ++i) { retval.Add(CreateListFieldDataDictValueList(count)); } return(retval); }
private static THashSet <Insanity> CreateSetField(int count) { var retval = new THashSet <Insanity>(); for (var i = 0; i < count; ++i) { retval.Add(CreateInsanity(count)); } return(retval); }
public void THashSet_Equals_Primitive_Test() { const int value = 1; var hashSet = new THashSet <int> { value }; Assert.IsTrue(hashSet.Contains(value)); hashSet.Remove(value); Assert.IsTrue(hashSet.Count == 0); hashSet.Add(value); Assert.IsTrue(hashSet.Contains(value)); hashSet.Clear(); Assert.IsTrue(hashSet.Count == 0); var newArr = new int[1]; hashSet.Add(value); hashSet.CopyTo(newArr, 0); Assert.IsTrue(newArr.Contains(value)); var en = hashSet.GetEnumerator(); en.MoveNext(); Assert.IsTrue((int)en.Current == value); using (var ien = ((IEnumerable <int>)hashSet).GetEnumerator()) { ien.MoveNext(); Assert.IsTrue(ien.Current == value); } }
static void Main(string[] args) { try { TTransport tr = new TSocket("localhost", 9091); tr.Open(); TProtocol prot = new TBinaryProtocol(tr); MAPResService.Client client = new MAPResService.Client(prot); Program pr = new Program(); if (client.loginToServer("Adnan", "12345")) { //Console.WriteLine(client.getDOEC("Sajeel")); THashSet <string> ModSites = new THashSet <string>(); ModSites.Add("S"); ModSites.Add("T"); ModSites.Add("Y"); //THashSet<string> PseudoAminoSet = new THashSet<string>(); //PseudoAminoSet = pr.generatePseudoSet(); //client.setProjectProfileWithStandardAminoAcids("ABC","Sajeel",3,ModSites,"thisPath"); client.setProjectProfileWithStandardAminoAcids("FirstANalysis", "Sajeel", 10, ModSites); client.openDatasetLocationForAnalysis(@"C:\Users\Sajeel\Desktop\Results\Carboxylation\XML Files\CarboxylEncoded.XML"); var list = client.getDeviationParameter(); //DataTable dt = ToDataTable(list); client.getModsite("S"); client.runPreferenceEstimationProcess(); client.SaveProject(); Console.WriteLine(client.getDOEC()); Console.ReadKey(); } else { Console.WriteLine("Improper User Name & Password"); Console.ReadKey(); return; } } catch (Exception e) { Console.Write(e.StackTrace); } }
public void subscribeEventTypes(ISet <PendantEventType> types) { var ts = new THashSet <PendantEventType>(); foreach (var t in types) { ts.Add(t); } client.subscribeEventTypes(id, ts); }
public void unsubscribeEventTypes(ISet <ControllerEventType> types) { var ts = new THashSet <ControllerEventType>(); foreach (var t in types) { ts.Add(t); } client.unsubscribeEventTypes(id, ts); }
public void Read (TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Set) { { UpdateAttributes = new THashSet<SquareFeatureSetAttribute>(); TSet _set501 = iprot.ReadSetBegin(); for( int _i502 = 0; _i502 < _set501.Count; ++_i502) { SquareFeatureSetAttribute _elem503; _elem503 = (SquareFeatureSetAttribute)iprot.ReadI32(); UpdateAttributes.Add(_elem503); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { SquareFeatureSet = new SquareFeatureSet(); SquareFeatureSet.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read (TProtocol iprot) { bool isset_node = false; bool isset_port = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { Node = iprot.ReadString(); isset_node = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Set) { { Port = new THashSet<long>(); TSet _set181 = iprot.ReadSetBegin(); for( int _i182 = 0; _i182 < _set181.Count; ++_i182) { long _elem183; _elem183 = iprot.ReadI64(); Port.Add(_elem183); } iprot.ReadSetEnd(); } isset_port = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_node) throw new TProtocolException(TProtocolException.INVALID_DATA); if (!isset_port) throw new TProtocolException(TProtocolException.INVALID_DATA); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 2: if (field.Type == TType.Set) { { Mids = new THashSet <string>(); TSet _set365 = iprot.ReadSetBegin(); for (int _i366 = 0; _i366 < _set365.Count; ++_i366) { string _elem367; _elem367 = iprot.ReadString(); Mids.Add(_elem367); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Set) { { Success = new THashSet <long>(); TSet _set37 = iprot.ReadSetBegin(); for (int _i38 = 0; _i38 < _set37.Count; ++_i38) { long _elem39; _elem39 = iprot.ReadI64(); Success.Add(_elem39); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public THashSet <string> generatePseudoSet() { var set = new THashSet <String>(); String str = null; Console.WriteLine("Give Pseudo Set"); str = Console.ReadLine(); while (!string.Equals(str, "-1")) { set.Add(str.ToUpper()); str = Console.ReadLine(); } return(set); }
public void Read(TProtocol iprot) { bool isset_value = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Set) { { Value = new THashSet <int>(); TSet _set5 = iprot.ReadSetBegin(); for (int _i6 = 0; _i6 < _set5.Count; ++_i6) { int _elem7; _elem7 = iprot.ReadI32(); Value.Add(_elem7); } iprot.ReadSetEnd(); } isset_value = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_value) { throw new TProtocolException(TProtocolException.INVALID_DATA); } }
public static THashSet <string> DeepCopy(this THashSet <string> source) { if (source == null) { return(null); } var tmp382 = new THashSet <string>(source.Count); foreach (var elem in source) { tmp382.Add((elem != null) ? elem : null); } return(tmp382); }
static cli_serviceConstants() { PRIMITIVE_TYPES.Add(TTypeId.BOOLEAN_TYPE); PRIMITIVE_TYPES.Add(TTypeId.TINYINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.SMALLINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.INT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.BIGINT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.FLOAT_TYPE); PRIMITIVE_TYPES.Add(TTypeId.DOUBLE_TYPE); PRIMITIVE_TYPES.Add(TTypeId.STRING_TYPE); PRIMITIVE_TYPES.Add(TTypeId.TIMESTAMP_TYPE); PRIMITIVE_TYPES.Add(TTypeId.BINARY_TYPE); PRIMITIVE_TYPES.Add(TTypeId.DECIMAL_TYPE); COMPLEX_TYPES.Add(TTypeId.ARRAY_TYPE); COMPLEX_TYPES.Add(TTypeId.MAP_TYPE); COMPLEX_TYPES.Add(TTypeId.STRUCT_TYPE); COMPLEX_TYPES.Add(TTypeId.UNION_TYPE); COMPLEX_TYPES.Add(TTypeId.USER_DEFINED_TYPE); COLLECTION_TYPES.Add(TTypeId.ARRAY_TYPE); COLLECTION_TYPES.Add(TTypeId.MAP_TYPE); TYPE_NAMES[TTypeId.BOOLEAN_TYPE] = "BOOLEAN"; TYPE_NAMES[TTypeId.TINYINT_TYPE] = "TINYINT"; TYPE_NAMES[TTypeId.SMALLINT_TYPE] = "SMALLINT"; TYPE_NAMES[TTypeId.INT_TYPE] = "INT"; TYPE_NAMES[TTypeId.BIGINT_TYPE] = "BIGINT"; TYPE_NAMES[TTypeId.FLOAT_TYPE] = "FLOAT"; TYPE_NAMES[TTypeId.DOUBLE_TYPE] = "DOUBLE"; TYPE_NAMES[TTypeId.STRING_TYPE] = "STRING"; TYPE_NAMES[TTypeId.TIMESTAMP_TYPE] = "TIMESTAMP"; TYPE_NAMES[TTypeId.BINARY_TYPE] = "BINARY"; TYPE_NAMES[TTypeId.ARRAY_TYPE] = "ARRAY"; TYPE_NAMES[TTypeId.MAP_TYPE] = "MAP"; TYPE_NAMES[TTypeId.STRUCT_TYPE] = "STRUCT"; TYPE_NAMES[TTypeId.UNION_TYPE] = "UNIONTYPE"; TYPE_NAMES[TTypeId.DECIMAL_TYPE] = "DECIMAL"; }
public static THashSet <global::OptReqDefTest.Distance> DeepCopy(this THashSet <global::OptReqDefTest.Distance> source) { if (source == null) { return(null); } var tmp221 = new THashSet <global::OptReqDefTest.Distance>(source.Count); foreach (var elem in source) { tmp221.Add(elem); } return(tmp221); }
public static THashSet <long> DeepCopy(this THashSet <long> source) { if (source == null) { return(null); } var tmp222 = new THashSet <long>(source.Count); foreach (var elem in source) { tmp222.Add(elem); } return(tmp222); }
public static THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > DeepCopy(this THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > > source) { if (source == null) { return(null); } var tmp379 = new THashSet <List <Dictionary <global::ThriftTest.Insanity, string> > >(source.Count); foreach (var elem in source) { tmp379.Add((elem != null) ? elem.DeepCopy() : null); } return(tmp379); }
public static THashSet <THashSet <global::OptReqDefTest.Distance> > DeepCopy(this THashSet <THashSet <global::OptReqDefTest.Distance> > source) { if (source == null) { return(null); } var tmp220 = new THashSet <THashSet <global::OptReqDefTest.Distance> >(source.Count); foreach (var elem in source) { tmp220.Add((elem != null) ? elem.DeepCopy() : null); } return(tmp220); }
public static THashSet <global::ThriftTest.Insanity> DeepCopy(this THashSet <global::ThriftTest.Insanity> source) { if (source == null) { return(null); } var tmp380 = new THashSet <global::ThriftTest.Insanity>(source.Count); foreach (var elem in source) { tmp380.Add((elem != null) ? elem.DeepCopy() : null); } return(tmp380); }
public static THashSet <int> DeepCopy(this THashSet <int> source) { if (source == null) { return(null); } var tmp381 = new THashSet <int>(source.Count); foreach (var elem in source) { tmp381.Add(elem); } return(tmp381); }
public static void ClientTest(TTransport transport) { TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport); ThriftTest.Client client = new ThriftTest.Client(binaryProtocol); try { if (!transport.IsOpen) { transport.Open(); } } catch (TTransportException ttx) { Console.WriteLine("Connect failed: " + ttx.Message); return; } long start = DateTime.Now.ToFileTime(); Console.Write("testVoid()"); client.testVoid(); Console.WriteLine(" = void"); Console.Write("testString(\"Test\")"); string s = client.testString("Test"); Console.WriteLine(" = \"" + s + "\""); Console.Write("testByte(1)"); byte i8 = client.testByte((byte)1); Console.WriteLine(" = " + i8); Console.Write("testI32(-1)"); int i32 = client.testI32(-1); Console.WriteLine(" = " + i32); Console.Write("testI64(-34359738368)"); long i64 = client.testI64(-34359738368); Console.WriteLine(" = " + i64); Console.Write("testDouble(5.325098235)"); double dub = client.testDouble(5.325098235); Console.WriteLine(" = " + dub); Console.Write("testStruct({\"Zero\", 1, -3, -5})"); Xtruct o = new Xtruct(); o.String_thing = "Zero"; o.Byte_thing = (byte)1; o.I32_thing = -3; o.I64_thing = -5; Xtruct i = client.testStruct(o); Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}"); Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})"); Xtruct2 o2 = new Xtruct2(); o2.Byte_thing = (byte)1; o2.Struct_thing = o; o2.I32_thing = 5; Xtruct2 i2 = client.testNest(o2); i = i2.Struct_thing; Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}"); Dictionary<int, int> mapout = new Dictionary<int, int>(); for (int j = 0; j < 5; j++) { mapout[j] = j - 10; } Console.Write("testMap({"); bool first = true; foreach (int key in mapout.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapout[key]); } Console.Write("})"); Dictionary<int, int> mapin = client.testMap(mapout); Console.Write(" = {"); first = true; foreach (int key in mapin.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapin[key]); } Console.WriteLine("}"); List<int> listout = new List<int>(); for (int j = -2; j < 3; j++) { listout.Add(j); } Console.Write("testList({"); first = true; foreach (int j in listout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); List<int> listin = client.testList(listout); Console.Write(" = {"); first = true; foreach (int j in listin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); //set THashSet<int> setout = new THashSet<int>(); for (int j = -2; j < 3; j++) { setout.Add(j); } Console.Write("testSet({"); first = true; foreach (int j in setout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); THashSet<int> setin = client.testSet(setout); Console.Write(" = {"); first = true; foreach (int j in setin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); Console.Write("testEnum(ONE)"); Numberz ret = client.testEnum(Numberz.ONE); Console.WriteLine(" = " + ret); Console.Write("testEnum(TWO)"); ret = client.testEnum(Numberz.TWO); Console.WriteLine(" = " + ret); Console.Write("testEnum(THREE)"); ret = client.testEnum(Numberz.THREE); Console.WriteLine(" = " + ret); Console.Write("testEnum(FIVE)"); ret = client.testEnum(Numberz.FIVE); Console.WriteLine(" = " + ret); Console.Write("testEnum(EIGHT)"); ret = client.testEnum(Numberz.EIGHT); Console.WriteLine(" = " + ret); Console.Write("testTypedef(309858235082523)"); long uid = client.testTypedef(309858235082523L); Console.WriteLine(" = " + uid); Console.Write("testMapMap(1)"); Dictionary<int, Dictionary<int, int>> mm = client.testMapMap(1); Console.Write(" = {"); foreach (int key in mm.Keys) { Console.Write(key + " => {"); Dictionary<int, int> m2 = mm[key]; foreach (int k2 in m2.Keys) { Console.Write(k2 + " => " + m2[k2] + ", "); } Console.Write("}, "); } Console.WriteLine("}"); Insanity insane = new Insanity(); insane.UserMap = new Dictionary<Numberz, long>(); insane.UserMap[Numberz.FIVE] = 5000L; Xtruct truck = new Xtruct(); truck.String_thing = "Truck"; truck.Byte_thing = (byte)8; truck.I32_thing = 8; truck.I64_thing = 8; insane.Xtructs = new List<Xtruct>(); insane.Xtructs.Add(truck); Console.Write("testInsanity()"); Dictionary<long, Dictionary<Numberz, Insanity>> whoa = client.testInsanity(insane); Console.Write(" = {"); foreach (long key in whoa.Keys) { Dictionary<Numberz, Insanity> val = whoa[key]; Console.Write(key + " => {"); foreach (Numberz k2 in val.Keys) { Insanity v2 = val[k2]; Console.Write(k2 + " => {"); Dictionary<Numberz, long> userMap = v2.UserMap; Console.Write("{"); if (userMap != null) { foreach (Numberz k3 in userMap.Keys) { Console.Write(k3 + " => " + userMap[k3] + ", "); } } else { Console.Write("null"); } Console.Write("}, "); List<Xtruct> xtructs = v2.Xtructs; Console.Write("{"); if (xtructs != null) { foreach (Xtruct x in xtructs) { Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, "); } } else { Console.Write("null"); } Console.Write("}"); Console.Write("}, "); } Console.Write("}, "); } Console.WriteLine("}"); byte arg0 = 1; int arg1 = 2; long arg2 = long.MaxValue; Dictionary<short, string> multiDict = new Dictionary<short, string>(); multiDict[1] = "one"; Numberz arg4 = Numberz.FIVE; long arg5 = 5000000; Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")"); Xtruct multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5); Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); Console.WriteLine("Test Async(1)"); client.testAsync(1); }
public static async Task<int> ExecuteClientTestAsync(ThriftAsync.Test.ThriftTest.Client client) { var token = CancellationToken.None; var returnCode = 0; Console.Write("testVoid()"); await client.testVoidAsync(token); Console.WriteLine(" = void"); Console.Write("testString(\"Test\")"); var s = await client.testStringAsync("Test", token); Console.WriteLine(" = \"" + s + "\""); if ("Test" != s) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testBool(true)"); var t = await client.testBoolAsync((bool)true, token); Console.WriteLine(" = " + t); if (!t) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testBool(false)"); var f = await client.testBoolAsync((bool)false, token); Console.WriteLine(" = " + f); if (f) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testByte(1)"); var i8 = await client.testByteAsync((sbyte)1, token); Console.WriteLine(" = " + i8); if (1 != i8) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testI32(-1)"); var i32 = await client.testI32Async(-1, token); Console.WriteLine(" = " + i32); if (-1 != i32) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testI64(-34359738368)"); var i64 = await client.testI64Async(-34359738368, token); Console.WriteLine(" = " + i64); if (-34359738368 != i64) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } // TODO: Validate received message Console.Write("testDouble(5.325098235)"); var dub = await client.testDoubleAsync(5.325098235, token); Console.WriteLine(" = " + dub); if (5.325098235 != dub) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testDouble(-0.000341012439638598279)"); dub = await client.testDoubleAsync(-0.000341012439638598279, token); Console.WriteLine(" = " + dub); if (-0.000341012439638598279 != dub) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } var binOut = PrepareTestData(true); Console.Write("testBinary(" + BytesToHex(binOut) + ")"); try { var binIn = await client.testBinaryAsync(binOut, token); Console.WriteLine(" = " + BytesToHex(binIn)); if (binIn.Length != binOut.Length) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } for (var ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs) if (binIn[ofs] != binOut[ofs]) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } } catch (Thrift.TApplicationException ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } // binary equals? only with hashcode option enabled ... Console.WriteLine("Test CrazyNesting"); var one = new CrazyNesting(); var two = new CrazyNesting(); one.String_field = "crazy"; two.String_field = "crazy"; one.Binary_field = new byte[] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; if (typeof(CrazyNesting).GetMethod("Equals")?.DeclaringType == typeof(CrazyNesting)) { if (!one.Equals(two)) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorContainers; throw new Exception("CrazyNesting.Equals failed"); } } // TODO: Validate received message Console.Write("testStruct({\"Zero\", 1, -3, -5})"); var o = new Xtruct(); o.String_thing = "Zero"; o.Byte_thing = (sbyte)1; o.I32_thing = -3; o.I64_thing = -5; var i = await client.testStructAsync(o, token); Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}"); // TODO: Validate received message Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})"); var o2 = new Xtruct2(); o2.Byte_thing = (sbyte)1; o2.Struct_thing = o; o2.I32_thing = 5; var i2 = await client.testNestAsync(o2, token); i = i2.Struct_thing; Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}"); var mapout = new Dictionary<int, int>(); for (var j = 0; j < 5; j++) { mapout[j] = j - 10; } Console.Write("testMap({"); var first = true; foreach (var key in mapout.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapout[key]); } Console.Write("})"); var mapin = await client.testMapAsync(mapout, token); Console.Write(" = {"); first = true; foreach (var key in mapin.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapin[key]); } Console.WriteLine("}"); // TODO: Validate received message var listout = new List<int>(); for (var j = -2; j < 3; j++) { listout.Add(j); } Console.Write("testList({"); first = true; foreach (var j in listout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); var listin = await client.testListAsync(listout, token); Console.Write(" = {"); first = true; foreach (var j in listin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); //set // TODO: Validate received message var setout = new THashSet<int>(); for (var j = -2; j < 3; j++) { setout.Add(j); } Console.Write("testSet({"); first = true; foreach (int j in setout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); var setin = await client.testSetAsync(setout, token); Console.Write(" = {"); first = true; foreach (int j in setin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); Console.Write("testEnum(ONE)"); var ret = await client.testEnumAsync(Numberz.ONE, token); Console.WriteLine(" = " + ret); if (Numberz.ONE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(TWO)"); ret = await client.testEnumAsync(Numberz.TWO, token); Console.WriteLine(" = " + ret); if (Numberz.TWO != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(THREE)"); ret = await client.testEnumAsync(Numberz.THREE, token); Console.WriteLine(" = " + ret); if (Numberz.THREE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(FIVE)"); ret = await client.testEnumAsync(Numberz.FIVE, token); Console.WriteLine(" = " + ret); if (Numberz.FIVE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(EIGHT)"); ret = await client.testEnumAsync(Numberz.EIGHT, token); Console.WriteLine(" = " + ret); if (Numberz.EIGHT != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testTypedef(309858235082523)"); var uid = await client.testTypedefAsync(309858235082523L, token); Console.WriteLine(" = " + uid); if (309858235082523L != uid) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } // TODO: Validate received message Console.Write("testMapMap(1)"); var mm = await client.testMapMapAsync(1, token); Console.Write(" = {"); foreach (var key in mm.Keys) { Console.Write(key + " => {"); var m2 = mm[key]; foreach (var k2 in m2.Keys) { Console.Write(k2 + " => " + m2[k2] + ", "); } Console.Write("}, "); } Console.WriteLine("}"); // TODO: Validate received message var insane = new Insanity(); insane.UserMap = new Dictionary<Numberz, long>(); insane.UserMap[Numberz.FIVE] = 5000L; var truck = new Xtruct(); truck.String_thing = "Truck"; truck.Byte_thing = (sbyte)8; truck.I32_thing = 8; truck.I64_thing = 8; insane.Xtructs = new List<Xtruct>(); insane.Xtructs.Add(truck); Console.Write("testInsanity()"); var whoa = await client.testInsanityAsync(insane, token); Console.Write(" = {"); foreach (var key in whoa.Keys) { var val = whoa[key]; Console.Write(key + " => {"); foreach (var k2 in val.Keys) { var v2 = val[k2]; Console.Write(k2 + " => {"); var userMap = v2.UserMap; Console.Write("{"); if (userMap != null) { foreach (var k3 in userMap.Keys) { Console.Write(k3 + " => " + userMap[k3] + ", "); } } else { Console.Write("null"); } Console.Write("}, "); var xtructs = v2.Xtructs; Console.Write("{"); if (xtructs != null) { foreach (var x in xtructs) { Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, "); } } else { Console.Write("null"); } Console.Write("}"); Console.Write("}, "); } Console.Write("}, "); } Console.WriteLine("}"); sbyte arg0 = 1; var arg1 = 2; var arg2 = long.MaxValue; var multiDict = new Dictionary<short, string>(); multiDict[1] = "one"; var tmpMultiDict = new List<string>(); foreach (var pair in multiDict) tmpMultiDict.Add(pair.Key +" => "+ pair.Value); var arg4 = Numberz.FIVE; long arg5 = 5000000; Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + ",{" + string.Join(",", tmpMultiDict) + "}," + arg4 + "," + arg5 + ")"); var multiResponse = await client.testMultiAsync(arg0, arg1, arg2, multiDict, arg4, arg5, token); Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); try { Console.WriteLine("testException(\"Xception\")"); await client.testExceptionAsync("Xception", token); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception ex) { if (ex.ErrorCode != 1001 || ex.Message != "Xception") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testException(\"TException\")"); await client.testExceptionAsync("TException", token); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Thrift.TException) { // OK } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testException(\"ok\")"); await client.testExceptionAsync("ok", token); // OK } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"Xception\", ...)"); await client.testMultiExceptionAsync("Xception", "ignore", token); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception ex) { if (ex.ErrorCode != 1001 || ex.Message != "This is an Xception") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"Xception2\", ...)"); await client.testMultiExceptionAsync("Xception2", "ignore", token); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception2 ex) { if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"success\", \"OK\")"); if ("OK" != (await client.testMultiExceptionAsync("success", "OK", token)).String_thing) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } var sw = new Stopwatch(); sw.Start(); Console.WriteLine("Test Oneway(1)"); await client.testOnewayAsync(1, token); sw.Stop(); if (sw.ElapsedMilliseconds > 1000) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("Test Calltime()"); var times = 50; sw.Reset(); sw.Start(); for (var k = 0; k < times; ++k) await client.testVoidAsync(token); sw.Stop(); Console.WriteLine(" = {0} ms a testVoid() call", sw.ElapsedMilliseconds / times); return returnCode; }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Set) { { Success = new THashSet<Dictionary<string, string>>(); TSet _set104 = iprot.ReadSetBegin(); for( int _i105 = 0; _i105 < _set104.Count; ++_i105) { Dictionary<string, string> _elem106 = new Dictionary<string, string>(); { _elem106 = new Dictionary<string, string>(); TMap _map107 = iprot.ReadMapBegin(); for( int _i108 = 0; _i108 < _map107.Count; ++_i108) { string _key109; string _val110; _key109 = iprot.ReadString(); _val110 = iprot.ReadString(); _elem106[_key109] = _val110; } iprot.ReadMapEnd(); } Success.Add(_elem106); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Set) { { Success = new THashSet<string>(); TSet _set222 = iprot.ReadSetBegin(); for( int _i223 = 0; _i223 < _set222.Count; ++_i223) { string _elem224 = null; _elem224 = iprot.ReadString(); Success.Add(_elem224); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 1: if (field.Type == TType.Struct) { E = new TalkException(); E.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public static void ClientTest(TTransport transport) { TProtocol proto; if (protocol == "compact") proto = new TCompactProtocol(transport); else if (protocol == "json") proto = new TJSONProtocol(transport); else proto = new TBinaryProtocol(transport); ThriftTest.Client client = new ThriftTest.Client(proto); try { if (!transport.IsOpen) { transport.Open(); } } catch (TTransportException ttx) { Console.WriteLine("Connect failed: " + ttx.Message); return; } long start = DateTime.Now.ToFileTime(); Console.Write("testVoid()"); client.testVoid(); Console.WriteLine(" = void"); Console.Write("testString(\"Test\")"); string s = client.testString("Test"); Console.WriteLine(" = \"" + s + "\""); Console.Write("testByte(1)"); sbyte i8 = client.testByte((sbyte)1); Console.WriteLine(" = " + i8); Console.Write("testI32(-1)"); int i32 = client.testI32(-1); Console.WriteLine(" = " + i32); Console.Write("testI64(-34359738368)"); long i64 = client.testI64(-34359738368); Console.WriteLine(" = " + i64); Console.Write("testDouble(5.325098235)"); double dub = client.testDouble(5.325098235); Console.WriteLine(" = " + dub); byte[] binOut = PrepareTestData(true); Console.Write("testBinary(" + BytesToHex(binOut) + ")"); try { byte[] binIn = client.testBinary(binOut); Console.WriteLine(" = " + BytesToHex(binIn)); if (binIn.Length != binOut.Length) throw new Exception("testBinary: length mismatch"); for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs) if (binIn[ofs] != binOut[ofs]) throw new Exception("testBinary: content mismatch at offset " + ofs.ToString()); } catch (Thrift.TApplicationException e) { Console.Write("testBinary(" + BytesToHex(binOut) + "): "+e.Message); } // binary equals? only with hashcode option enabled ... if( typeof(CrazyNesting).GetMethod("Equals").DeclaringType == typeof(CrazyNesting)) { CrazyNesting one = new CrazyNesting(); CrazyNesting two = new CrazyNesting(); one.String_field = "crazy"; two.String_field = "crazy"; one.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; if (!one.Equals(two)) throw new Exception("CrazyNesting.Equals failed"); } Console.Write("testStruct({\"Zero\", 1, -3, -5})"); Xtruct o = new Xtruct(); o.String_thing = "Zero"; o.Byte_thing = (sbyte)1; o.I32_thing = -3; o.I64_thing = -5; Xtruct i = client.testStruct(o); Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}"); Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})"); Xtruct2 o2 = new Xtruct2(); o2.Byte_thing = (sbyte)1; o2.Struct_thing = o; o2.I32_thing = 5; Xtruct2 i2 = client.testNest(o2); i = i2.Struct_thing; Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}"); Dictionary<int, int> mapout = new Dictionary<int, int>(); for (int j = 0; j < 5; j++) { mapout[j] = j - 10; } Console.Write("testMap({"); bool first = true; foreach (int key in mapout.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapout[key]); } Console.Write("})"); Dictionary<int, int> mapin = client.testMap(mapout); Console.Write(" = {"); first = true; foreach (int key in mapin.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapin[key]); } Console.WriteLine("}"); List<int> listout = new List<int>(); for (int j = -2; j < 3; j++) { listout.Add(j); } Console.Write("testList({"); first = true; foreach (int j in listout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); List<int> listin = client.testList(listout); Console.Write(" = {"); first = true; foreach (int j in listin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); //set THashSet<int> setout = new THashSet<int>(); for (int j = -2; j < 3; j++) { setout.Add(j); } Console.Write("testSet({"); first = true; foreach (int j in setout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); THashSet<int> setin = client.testSet(setout); Console.Write(" = {"); first = true; foreach (int j in setin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); Console.Write("testEnum(ONE)"); Numberz ret = client.testEnum(Numberz.ONE); Console.WriteLine(" = " + ret); Console.Write("testEnum(TWO)"); ret = client.testEnum(Numberz.TWO); Console.WriteLine(" = " + ret); Console.Write("testEnum(THREE)"); ret = client.testEnum(Numberz.THREE); Console.WriteLine(" = " + ret); Console.Write("testEnum(FIVE)"); ret = client.testEnum(Numberz.FIVE); Console.WriteLine(" = " + ret); Console.Write("testEnum(EIGHT)"); ret = client.testEnum(Numberz.EIGHT); Console.WriteLine(" = " + ret); Console.Write("testTypedef(309858235082523)"); long uid = client.testTypedef(309858235082523L); Console.WriteLine(" = " + uid); Console.Write("testMapMap(1)"); Dictionary<int, Dictionary<int, int>> mm = client.testMapMap(1); Console.Write(" = {"); foreach (int key in mm.Keys) { Console.Write(key + " => {"); Dictionary<int, int> m2 = mm[key]; foreach (int k2 in m2.Keys) { Console.Write(k2 + " => " + m2[k2] + ", "); } Console.Write("}, "); } Console.WriteLine("}"); Insanity insane = new Insanity(); insane.UserMap = new Dictionary<Numberz, long>(); insane.UserMap[Numberz.FIVE] = 5000L; Xtruct truck = new Xtruct(); truck.String_thing = "Truck"; truck.Byte_thing = (sbyte)8; truck.I32_thing = 8; truck.I64_thing = 8; insane.Xtructs = new List<Xtruct>(); insane.Xtructs.Add(truck); Console.Write("testInsanity()"); Dictionary<long, Dictionary<Numberz, Insanity>> whoa = client.testInsanity(insane); Console.Write(" = {"); foreach (long key in whoa.Keys) { Dictionary<Numberz, Insanity> val = whoa[key]; Console.Write(key + " => {"); foreach (Numberz k2 in val.Keys) { Insanity v2 = val[k2]; Console.Write(k2 + " => {"); Dictionary<Numberz, long> userMap = v2.UserMap; Console.Write("{"); if (userMap != null) { foreach (Numberz k3 in userMap.Keys) { Console.Write(k3 + " => " + userMap[k3] + ", "); } } else { Console.Write("null"); } Console.Write("}, "); List<Xtruct> xtructs = v2.Xtructs; Console.Write("{"); if (xtructs != null) { foreach (Xtruct x in xtructs) { Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, "); } } else { Console.Write("null"); } Console.Write("}"); Console.Write("}, "); } Console.Write("}, "); } Console.WriteLine("}"); sbyte arg0 = 1; int arg1 = 2; long arg2 = long.MaxValue; Dictionary<short, string> multiDict = new Dictionary<short, string>(); multiDict[1] = "one"; Numberz arg4 = Numberz.FIVE; long arg5 = 5000000; Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")"); Xtruct multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5); Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); Console.WriteLine("Test Oneway(1)"); client.testOneway(1); Console.Write("Test Calltime()"); var startt = DateTime.UtcNow; for ( int k=0; k<1000; ++k ) client.testVoid(); Console.WriteLine(" = " + (DateTime.UtcNow - startt).TotalSeconds.ToString() + " ms a testVoid() call" ); }
public static int ExecuteClientTest(ThriftTest.Client client) { int returnCode = 0; Console.Write("testVoid()"); client.testVoid(); Console.WriteLine(" = void"); Console.Write("testString(\"Test\")"); string s = client.testString("Test"); Console.WriteLine(" = \"" + s + "\""); if ("Test" != s) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testBool(true)"); bool t = client.testBool((bool)true); Console.WriteLine(" = " + t); if (!t) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testBool(false)"); bool f = client.testBool((bool)false); Console.WriteLine(" = " + f); if (f) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testByte(1)"); sbyte i8 = client.testByte((sbyte)1); Console.WriteLine(" = " + i8); if (1 != i8) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testI32(-1)"); int i32 = client.testI32(-1); Console.WriteLine(" = " + i32); if (-1 != i32) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testI64(-34359738368)"); long i64 = client.testI64(-34359738368); Console.WriteLine(" = " + i64); if (-34359738368 != i64) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } // TODO: Validate received message Console.Write("testDouble(5.325098235)"); double dub = client.testDouble(5.325098235); Console.WriteLine(" = " + dub); if (5.325098235 != dub) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("testDouble(-0.000341012439638598279)"); dub = client.testDouble(-0.000341012439638598279); Console.WriteLine(" = " + dub); if (-0.000341012439638598279 != dub) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } byte[] binOut = PrepareTestData(true); Console.Write("testBinary(" + BytesToHex(binOut) + ")"); try { byte[] binIn = client.testBinary(binOut); Console.WriteLine(" = " + BytesToHex(binIn)); if (binIn.Length != binOut.Length) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs) if (binIn[ofs] != binOut[ofs]) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } } catch (Thrift.TApplicationException ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } // binary equals? only with hashcode option enabled ... Console.WriteLine("Test CrazyNesting"); if( typeof(CrazyNesting).GetMethod("Equals").DeclaringType == typeof(CrazyNesting)) { CrazyNesting one = new CrazyNesting(); CrazyNesting two = new CrazyNesting(); one.String_field = "crazy"; two.String_field = "crazy"; one.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; two.Binary_field = new byte[10] { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xFF }; if (!one.Equals(two)) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorContainers; throw new Exception("CrazyNesting.Equals failed"); } } // TODO: Validate received message Console.Write("testStruct({\"Zero\", 1, -3, -5})"); Xtruct o = new Xtruct(); o.String_thing = "Zero"; o.Byte_thing = (sbyte)1; o.I32_thing = -3; o.I64_thing = -5; Xtruct i = client.testStruct(o); Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}"); // TODO: Validate received message Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})"); Xtruct2 o2 = new Xtruct2(); o2.Byte_thing = (sbyte)1; o2.Struct_thing = o; o2.I32_thing = 5; Xtruct2 i2 = client.testNest(o2); i = i2.Struct_thing; Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}"); Dictionary<int, int> mapout = new Dictionary<int, int>(); for (int j = 0; j < 5; j++) { mapout[j] = j - 10; } Console.Write("testMap({"); bool first = true; foreach (int key in mapout.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapout[key]); } Console.Write("})"); Dictionary<int, int> mapin = client.testMap(mapout); Console.Write(" = {"); first = true; foreach (int key in mapin.Keys) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(key + " => " + mapin[key]); } Console.WriteLine("}"); // TODO: Validate received message List<int> listout = new List<int>(); for (int j = -2; j < 3; j++) { listout.Add(j); } Console.Write("testList({"); first = true; foreach (int j in listout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); List<int> listin = client.testList(listout); Console.Write(" = {"); first = true; foreach (int j in listin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); //set // TODO: Validate received message THashSet<int> setout = new THashSet<int>(); for (int j = -2; j < 3; j++) { setout.Add(j); } Console.Write("testSet({"); first = true; foreach (int j in setout) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.Write("})"); THashSet<int> setin = client.testSet(setout); Console.Write(" = {"); first = true; foreach (int j in setin) { if (first) { first = false; } else { Console.Write(", "); } Console.Write(j); } Console.WriteLine("}"); Console.Write("testEnum(ONE)"); Numberz ret = client.testEnum(Numberz.ONE); Console.WriteLine(" = " + ret); if (Numberz.ONE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(TWO)"); ret = client.testEnum(Numberz.TWO); Console.WriteLine(" = " + ret); if (Numberz.TWO != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(THREE)"); ret = client.testEnum(Numberz.THREE); Console.WriteLine(" = " + ret); if (Numberz.THREE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(FIVE)"); ret = client.testEnum(Numberz.FIVE); Console.WriteLine(" = " + ret); if (Numberz.FIVE != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testEnum(EIGHT)"); ret = client.testEnum(Numberz.EIGHT); Console.WriteLine(" = " + ret); if (Numberz.EIGHT != ret) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } Console.Write("testTypedef(309858235082523)"); long uid = client.testTypedef(309858235082523L); Console.WriteLine(" = " + uid); if (309858235082523L != uid) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorStructs; } // TODO: Validate received message Console.Write("testMapMap(1)"); Dictionary<int, Dictionary<int, int>> mm = client.testMapMap(1); Console.Write(" = {"); foreach (int key in mm.Keys) { Console.Write(key + " => {"); Dictionary<int, int> m2 = mm[key]; foreach (int k2 in m2.Keys) { Console.Write(k2 + " => " + m2[k2] + ", "); } Console.Write("}, "); } Console.WriteLine("}"); // TODO: Validate received message Insanity insane = new Insanity(); insane.UserMap = new Dictionary<Numberz, long>(); insane.UserMap[Numberz.FIVE] = 5000L; Xtruct truck = new Xtruct(); truck.String_thing = "Truck"; truck.Byte_thing = (sbyte)8; truck.I32_thing = 8; truck.I64_thing = 8; insane.Xtructs = new List<Xtruct>(); insane.Xtructs.Add(truck); Console.Write("testInsanity()"); Dictionary<long, Dictionary<Numberz, Insanity>> whoa = client.testInsanity(insane); Console.Write(" = {"); foreach (long key in whoa.Keys) { Dictionary<Numberz, Insanity> val = whoa[key]; Console.Write(key + " => {"); foreach (Numberz k2 in val.Keys) { Insanity v2 = val[k2]; Console.Write(k2 + " => {"); Dictionary<Numberz, long> userMap = v2.UserMap; Console.Write("{"); if (userMap != null) { foreach (Numberz k3 in userMap.Keys) { Console.Write(k3 + " => " + userMap[k3] + ", "); } } else { Console.Write("null"); } Console.Write("}, "); List<Xtruct> xtructs = v2.Xtructs; Console.Write("{"); if (xtructs != null) { foreach (Xtruct x in xtructs) { Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, "); } } else { Console.Write("null"); } Console.Write("}"); Console.Write("}, "); } Console.Write("}, "); } Console.WriteLine("}"); sbyte arg0 = 1; int arg1 = 2; long arg2 = long.MaxValue; Dictionary<short, string> multiDict = new Dictionary<short, string>(); multiDict[1] = "one"; Numberz arg4 = Numberz.FIVE; long arg5 = 5000000; Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")"); Xtruct multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5); Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n"); try { Console.WriteLine("testException(\"Xception\")"); client.testException("Xception"); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception ex) { if (ex.ErrorCode != 1001 || ex.Message != "Xception") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testException(\"TException\")"); client.testException("TException"); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Thrift.TException) { // OK } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testException(\"ok\")"); client.testException("ok"); // OK } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"Xception\", ...)"); client.testMultiException("Xception", "ignore"); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception ex) { if (ex.ErrorCode != 1001 || ex.Message != "This is an Xception") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"Xception2\", ...)"); client.testMultiException("Xception2", "ignore"); Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } catch (Xception2 ex) { if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2") { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } try { Console.WriteLine("testMultiException(\"success\", \"OK\")"); if ("OK" != client.testMultiException("success", "OK").String_thing) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; } } catch (Exception ex) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorExceptions; Console.WriteLine(ex.Message + " ST: " + ex.StackTrace); } Stopwatch sw = new Stopwatch(); sw.Start(); Console.WriteLine("Test Oneway(1)"); client.testOneway(1); sw.Stop(); if (sw.ElapsedMilliseconds > 1000) { Console.WriteLine("*** FAILED ***"); returnCode |= ErrorBaseTypes; } Console.Write("Test Calltime()"); var times = 50; sw.Reset(); sw.Start(); for (int k = 0; k < times; ++k) client.testVoid(); sw.Stop(); Console.WriteLine(" = {0} ms a testVoid() call", sw.ElapsedMilliseconds / times); return returnCode; }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { ReqSeq = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Set) { { Phones = new THashSet<string>(); TSet _set190 = iprot.ReadSetBegin(); for( int _i191 = 0; _i191 < _set190.Count; ++_i191) { string _elem192 = null; _elem192 = iprot.ReadString(); Phones.Add(_elem192); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Set) { { Success = new THashSet<Contact>(); TSet _set310 = iprot.ReadSetBegin(); for( int _i311 = 0; _i311 < _set310.Count; ++_i311) { Contact _elem312 = new Contact(); _elem312 = new Contact(); _elem312.Read(iprot); Success.Add(_elem312); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 1: if (field.Type == TType.Struct) { E = new TalkException(); E.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { AccessKey = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Set) { { EntityIds = new THashSet<string>(); TSet _set95 = iprot.ReadSetBegin(); for( int _i96 = 0; _i96 < _set95.Count; ++_i96) { string _elem97 = null; _elem97 = iprot.ReadString(); EntityIds.Add(_elem97); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I64) { StartTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I64) { EndTime = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 2: if (field.Type == TType.String) { SessionId = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Set) { { Ids = new THashSet<string>(); TSet _set105 = iprot.ReadSetBegin(); for( int _i106 = 0; _i106 < _set105.Count; ++_i106) { string _elem107 = null; _elem107 = iprot.ReadString(); Ids.Add(_elem107); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 2: if (field.Type == TType.Set) { { Phones = new THashSet<string>(); TSet _set213 = iprot.ReadSetBegin(); for( int _i214 = 0; _i214 < _set213.Count; ++_i214) { string _elem215 = null; _elem215 = iprot.ReadString(); Phones.Add(_elem215); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void Read (TProtocol iprot) { iprot.IncrementRecursionDepth(); try { bool isset_msgType = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { MsgType = (VariableType)iprot.ReadI32(); isset_msgType = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Bool) { BoolVal = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.Byte) { ByteVal = iprot.ReadByte(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { IntVal = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Double) { DoubleVal = iprot.ReadDouble(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.String) { StrVal = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.String) { ByteArrVal = iprot.ReadBinary(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Map) { { MapVal = new Dictionary<BaseMsg, BaseMsg>(); TMap _map0 = iprot.ReadMapBegin(); for( int _i1 = 0; _i1 < _map0.Count; ++_i1) { BaseMsg _key2; BaseMsg _val3; _key2 = new BaseMsg(); _key2.Read(iprot); _val3 = new BaseMsg(); _val3.Read(iprot); MapVal[_key2] = _val3; } iprot.ReadMapEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.List) { { ListVal = new List<BaseMsg>(); TList _list4 = iprot.ReadListBegin(); for( int _i5 = 0; _i5 < _list4.Count; ++_i5) { BaseMsg _elem6; _elem6 = new BaseMsg(); _elem6.Read(iprot); ListVal.Add(_elem6); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Set) { { SetVal = new THashSet<BaseMsg>(); TSet _set7 = iprot.ReadSetBegin(); for( int _i8 = 0; _i8 < _set7.Count; ++_i8) { BaseMsg _elem9; _elem9 = new BaseMsg(); _elem9.Read(iprot); SetVal.Add(_elem9); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_msgType) throw new TProtocolException(TProtocolException.INVALID_DATA); } finally { iprot.DecrementRecursionDepth(); } }
public void Read (TProtocol iprot) { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Set) { { Success = new THashSet<Dictionary<string, string>>(); TSet _set79 = iprot.ReadSetBegin(); for( int _i80 = 0; _i80 < _set79.Count; ++_i80) { Dictionary<string, string> _elem81 = new Dictionary<string, string>(); { _elem81 = new Dictionary<string, string>(); TMap _map82 = iprot.ReadMapBegin(); for( int _i83 = 0; _i83 < _map82.Count; ++_i83) { string _key84; string _val85; _key84 = iprot.ReadString(); _val85 = iprot.ReadString(); _elem81[_key84] = _val85; } iprot.ReadMapEnd(); } Success.Add(_elem81); } iprot.ReadSetEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }