Example #1
0
 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>();
        }
Example #3
0
 public TThreadedServer(TProcessor processor, TServerTransport serverTransport, TTransportFactory inputTransportFactory, TTransportFactory outputTransportFactory, TProtocolFactory inputProtocolFactory, TProtocolFactory outputProtocolFactory, int maxThreads, TServer.LogDelegate logDel) : base(processor, serverTransport, inputTransportFactory, outputTransportFactory, inputProtocolFactory, outputProtocolFactory, logDel)
 {
     this.maxThreads    = maxThreads;
     this.clientQueue   = new Queue <TTransport>();
     this.clientLock    = new object();
     this.clientThreads = new THashSet <Thread>();
 }
Example #4
0
        private static THashSet <List <Distance> > ModifyValue(THashSet <List <Distance> > value)
        {
            if (value == null)
            {
                value = new THashSet <List <Distance> >();
            }

            if (value.Count == 0)
            {
                value.Add(new List <Distance>());
            }
            else
            {
                value.Add(null);
            }

            foreach (var entry in value)
            {
                if (entry != null)
                {
                    entry.Add(Distance.baz);
                }
            }

            return(value);
        }
Example #5
0
 public TNode(string AoKID, THashSet <string> Labels, string Value, TESystemLevelType SystemLevelType, TEAbstractionLevel AbstractionLevel) : this()
 {
     this.AoKID            = AoKID;
     this.Labels           = Labels;
     this.Value            = Value;
     this.SystemLevelType  = SystemLevelType;
     this.AbstractionLevel = AbstractionLevel;
 }
Example #6
0
        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();
        }
    }
Example #8
0
        private void AddField(string key, string value, Dictionary <string, THashSet <string> > report)
        {
            if (!report.ContainsKey(key))
            {
                report[key] = new THashSet <string>();
            }

            report[key].Add(value);
        }
Example #9
0
 public LastQueryRequest(string path, int dataTypeOrdinal, long queryId, THashSet <string> deviceMeasurements, Node header, Node requestor) : this()
 {
     this.Path               = path;
     this.DataTypeOrdinal    = dataTypeOrdinal;
     this.QueryId            = queryId;
     this.DeviceMeasurements = deviceMeasurements;
     this.Header             = header;
     this.Requestor          = requestor;
 }
Example #10
0
 public SingleSeriesQueryRequest(string path, long queryId, Node requester, Node header, int dataTypeOrdinal, THashSet <string> deviceMeasurements) : this()
 {
     this.Path               = path;
     this.QueryId            = queryId;
     this.Requester          = requester;
     this.Header             = header;
     this.DataTypeOrdinal    = dataTypeOrdinal;
     this.DeviceMeasurements = deviceMeasurements;
 }
Example #11
0
 private static THashSet <long> ModifyValue(THashSet <long> value)
 {
     if (value == null)
     {
         value = new THashSet <long>();
     }
     value.Add(value.Count + 100);
     return(value);
 }
Example #12
0
 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 <Insanity> CreateSetField(int count)
        {
            var retval = new THashSet <Insanity>();

            for (var i = 0; i < count; ++i)
            {
                retval.Add(CreateInsanity(count));
            }
            return(retval);
        }
        private static THashSet <int> CreateIntHashSet(int count)
        {
            var retval = new THashSet <int>();

            for (var i = 0; i < count; ++i)
            {
                retval.Add(i);
            }
            return(retval);
        }
 public GroupByRequest(string path, int dataTypeOrdinal, long queryId, List <int> aggregationTypeOrdinals, Node header, Node requestor, THashSet <string> deviceMeasurements) : this()
 {
     this.Path                    = path;
     this.DataTypeOrdinal         = dataTypeOrdinal;
     this.QueryId                 = queryId;
     this.AggregationTypeOrdinals = aggregationTypeOrdinals;
     this.Header                  = header;
     this.Requestor               = requestor;
     this.DeviceMeasurements      = deviceMeasurements;
 }
Example #16
0
 public GetAggrResultRequest(string path, List <string> aggregations, int dataTypeOrdinal, Node header, long queryId, Node requestor, THashSet <string> deviceMeasurements) : this()
 {
     this.Path               = path;
     this.Aggregations       = aggregations;
     this.DataTypeOrdinal    = dataTypeOrdinal;
     this.Header             = header;
     this.QueryId            = queryId;
     this.Requestor          = requestor;
     this.DeviceMeasurements = deviceMeasurements;
 }
        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);
        }
Example #18
0
        public void subscribeEventTypes(ISet <PendantEventType> types)
        {
            var ts = new THashSet <PendantEventType>();

            foreach (var t in types)
            {
                ts.Add(t);
            }

            client.subscribeEventTypes(id, ts);
        }
 public PreviousFillRequest(string path, long queryTime, long beforeRange, long queryId, Node requester, Node header, int dataTypeOrdinal, THashSet <string> deviceMeasurements) : this()
 {
     this.Path               = path;
     this.QueryTime          = queryTime;
     this.BeforeRange        = beforeRange;
     this.QueryId            = queryId;
     this.Requester          = requester;
     this.Header             = header;
     this.DataTypeOrdinal    = dataTypeOrdinal;
     this.DeviceMeasurements = deviceMeasurements;
 }
        public void unsubscribeEventTypes(ISet <ControllerEventType> types)
        {
            var ts = new THashSet <ControllerEventType>();

            foreach (var t in types)
            {
                ts.Add(t);
            }

            client.unsubscribeEventTypes(id, ts);
        }
Example #21
0
        public void TCollection_Set_Equals_Primitive_Test()
        {
            var collection1 = new THashSet <int> {
                1, 2, 3
            };
            var collection2 = new THashSet <int> {
                1, 2, 3
            };

            Assert.IsTrue(TCollections.Equals(collection1, collection2));
            Assert.IsTrue(collection1.SequenceEqual(collection2));
        }
 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();
   }
 }
Example #23
0
 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 static bool Equals(this THashSet <global::OptReqDefTest.Distance> instance, object that)
        {
            if (!(that is THashSet <global::OptReqDefTest.Distance> other))
            {
                return(false);
            }
            if (ReferenceEquals(instance, other))
            {
                return(true);
            }

            return(TCollections.Equals(instance, other));
        }
Example #25
0
        public static bool Equals(this THashSet <global::ThriftTest.Insanity> instance, object that)
        {
            if (!(that is THashSet <global::ThriftTest.Insanity> other))
            {
                return(false);
            }
            if (ReferenceEquals(instance, other))
            {
                return(true);
            }

            return(TCollections.Equals(instance, other));
        }
        public static bool Equals(this THashSet <long> instance, object that)
        {
            if (!(that is THashSet <long> other))
            {
                return(false);
            }
            if (ReferenceEquals(instance, other))
            {
                return(true);
            }

            return(TCollections.Equals(instance, other));
        }
Example #27
0
        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();
            }
        }
Example #28
0
        public void TCollection_Set_Equals_OneAndTheSameObject_Test()
        {
            var collection1 = new THashSet <ExampleClass> {
                new ExampleClass {
                    X = 1
                }, new ExampleClass {
                    X = 2
                }
            };
            var collection2 = collection1;      // references to one and the same collection

            Assert.IsTrue(TCollections.Equals(collection1, collection2));
            Assert.IsTrue(collection1.SequenceEqual(collection2));
        }
    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();
        }
    }
Example #30
0
        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);
        }
Example #31
0
        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 <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 TThreadedServer(TProcessor processor,
								 TServerTransport serverTransport,
								 TTransportFactory inputTransportFactory,
								 TTransportFactory outputTransportFactory,
								 TProtocolFactory inputProtocolFactory,
								 TProtocolFactory outputProtocolFactory,
								 int maxThreads, LogDelegate logDel)
			: base(processor, serverTransport, inputTransportFactory, outputTransportFactory,
				  inputProtocolFactory, outputProtocolFactory, logDel)
		{
			this.maxThreads = maxThreads;
			clientQueue = new Queue<TTransport>();
			clientLock = new object();
			clientThreads = new THashSet<Thread>();
		}
        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);
        }
Example #35
0
        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);
        }
Example #36
0
 public void send_acceptProximityMatches(string sessionId, THashSet<string> ids)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("acceptProximityMatches", TMessageType.Call, seqid_));
   acceptProximityMatches_args args = new acceptProximityMatches_args();
   args.SessionId = sessionId;
   args.Ids = ids;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Example #37
0
 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();
 }
Example #38
0
        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;
        }
Example #39
0
 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();
 }
Example #40
0
 public IAsyncResult Begin_findContactsByEmail(AsyncCallback callback, object state, THashSet<string> emails)
 {
   return send_findContactsByEmail(callback, state, emails);
 }
Example #41
0
      public void acceptProximityMatches(string sessionId, THashSet<string> ids)
      {
        #if !SILVERLIGHT
        send_acceptProximityMatches(sessionId, ids);
        recv_acceptProximityMatches();

        #else
        var asyncResult = Begin_acceptProximityMatches(null, null, sessionId, ids);
        End_acceptProximityMatches(asyncResult);

        #endif
      }
Example #42
0
 public NodeInfo(string node, THashSet<long> port) : this() {
   this.Node = node;
   this.Port = port;
 }
Example #43
0
 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();
 }
Example #44
0
 public Task<THashSet<int>> testSetAsync(THashSet<int> thing, CancellationToken cancellationToken)
 {
     sb.Clear();
     sb.Append("testSet({{");
     var first = true;
     foreach (int elem in thing)
     {
         if (first)
         {
             first = false;
         }
         else
         {
             sb.Append(", ");
         }
         sb.AppendFormat("{0}", elem);
     }
     sb.Append("}})");
     logger.Invoke(sb.ToString());
     return Task.FromResult(thing);
 }
Example #45
0
 public IAsyncResult Begin_findContactsByPhone(AsyncCallback callback, object state, THashSet<string> phones)
 {
   return send_findContactsByPhone(callback, state, phones);
 }
Example #46
0
 public IAsyncResult send_findContactsByEmail(AsyncCallback callback, object state, THashSet<string> emails)
Example #47
0
      public Dictionary<string, Contact> findContactsByEmail(THashSet<string> emails)
      {
        #if !SILVERLIGHT
        send_findContactsByEmail(emails);
        return recv_findContactsByEmail();

        #else
        var asyncResult = Begin_findContactsByEmail(null, null, emails);
        return End_findContactsByEmail(asyncResult);

        #endif
      }
Example #48
0
 public IAsyncResult send_acceptProximityMatches(AsyncCallback callback, object state, string sessionId, THashSet<string> ids)
Example #49
0
 public IAsyncResult Begin_acceptProximityMatches(AsyncCallback callback, object state, string sessionId, THashSet<string> ids)
 {
   return send_acceptProximityMatches(callback, state, sessionId, ids);
 }
Example #50
0
 public void send_getFailProductInspectNums(string accessKey, THashSet<string> entityIds, long startTime, long endTime)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("getFailProductInspectNums", TMessageType.Call, seqid_));
   getFailProductInspectNums_args args = new getFailProductInspectNums_args();
   args.AccessKey = accessKey;
   args.EntityIds = entityIds;
   args.StartTime = startTime;
   args.EndTime = endTime;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Example #51
0
      public Dictionary<string, Contact> findContactsByPhone(THashSet<string> phones)
      {
        #if !SILVERLIGHT
        send_findContactsByPhone(phones);
        return recv_findContactsByPhone();

        #else
        var asyncResult = Begin_findContactsByPhone(null, null, phones);
        return End_findContactsByPhone(asyncResult);

        #endif
      }
Example #52
0
 public void send_findAndAddContactsByEmail(int reqSeq, THashSet<string> emails)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("findAndAddContactsByEmail", TMessageType.Call, seqid_));
   findAndAddContactsByEmail_args args = new findAndAddContactsByEmail_args();
   args.ReqSeq = reqSeq;
   args.Emails = emails;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Example #53
0
 public THashSet<int> testSet(THashSet<int> thing)
 {
     Console.WriteLine("testSet({");
     bool first = true;
     foreach (int elem in thing)
     {
         if (first)
         {
             first = false;
         }
         else
         {
             Console.WriteLine(", ");
         }
         Console.WriteLine(elem);
     }
     Console.WriteLine("})");
     return thing;
 }
Example #54
0
 public IAsyncResult send_findContactsByPhone(AsyncCallback callback, object state, THashSet<string> phones)
 public THashSet<int> testSet(THashSet<int> thing)
 {
     reusableStringBuilder.Clear();
     reusableStringBuilder.Append("testSet({{");
     bool first = true;
     foreach (int elem in thing)
     {
         if (first)
         {
             first = false;
         }
         else
         {
             reusableStringBuilder.Append(", ");
         }
         reusableStringBuilder.AppendFormat("{0}", elem);
     }
     reusableStringBuilder.Append("}})");
     testLogDelegate.Invoke(reusableStringBuilder.ToString());
     return thing;
 }
Example #56
0
 public void send_findContactsByPhone(THashSet<string> phones)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("findContactsByPhone", TMessageType.Call, seqid_));
   findContactsByPhone_args args = new findContactsByPhone_args();
   args.Phones = phones;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
Example #57
0
 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();
 }
Example #58
0
 public IAsyncResult send_getFailProductInspectNums(AsyncCallback callback, object state, string accessKey, THashSet<string> entityIds, long startTime, long endTime)
Example #59
0
 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();
 }
Example #60
0
 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();
   }
 }