예제 #1
0
		[Test()] public void TestIndex()
		{
			var list_proxy = new ListProxy<int>(CreateSequence(), CreateOddSequence());

			for (int i = 0; i < list_proxy.Count; i++)
				Assert.AreEqual(i * 2 + 2, list_proxy[i]);
		}
예제 #2
0
		[Test()] public void TestContains()
		{
			var list_proxy = new ListProxy<int>(CreateSequence(), CreateOddSequence());

			foreach (int num in CreateEvenSequence())
				Assert.IsTrue(list_proxy.Contains(num));

			foreach (int num in CreateOddSequence())
				Assert.IsFalse(list_proxy.Contains(num));
		}
예제 #3
0
        /// <summary>Create a RatingsProxy object</summary>
        /// <param name="ratings">a ratings data structure</param>
        /// <param name="indices">an index list pointing to entries in the ratings</param>
        public RatingsProxy(IRatings ratings, IList<int> indices)
        {
            Users  = new ListProxy<int>(ratings.Users, indices);
            Items  = new ListProxy<int>(ratings.Items, indices);
            Values = new ListProxy<double>(ratings, indices);

            MaxUserID = ratings.MaxUserID;
            MaxItemID = ratings.MaxItemID;
            MaxRating = ratings.MaxRating;
            MinRating = ratings.MinRating;
        }
예제 #4
0
		[Test()] public void TestGetEnumerator()
		{
			IEnumerable<int> list_proxy = new ListProxy<int>(CreateSequence(), CreateOddSequence());
			
			var enumerator = list_proxy.GetEnumerator();
			foreach (int e in CreateEvenSequence())
			{
				enumerator.MoveNext();
				Assert.AreEqual(e, enumerator.Current);
			}
		}
예제 #5
0
        /// <summary>Create a RatingsProxy object</summary>
        /// <param name="ratings">a ratings data structure</param>
        /// <param name="indices">an index list pointing to entries in the ratings</param>
        public RatingsProxy(IRatings ratings, IList<int> indices)
        {
            this.indices = indices;

            Users  = new ListProxy<int>(ratings.Users, indices);
            Items  = new ListProxy<int>(ratings.Items, indices);
            Values = new ListProxy<float>(ratings, indices);

            MaxUserID = Users.Max();
            MaxItemID = Items.Max();
            Scale = ratings.Scale;
        }
예제 #6
0
        public void ClearList()
        {
            var proxy      = new ListProxy(Enumerable.Range(0, 100).ToList());
            var enumerator = proxy.GetEnumerator();

            enumerator.MoveNext();
            enumerator.MoveNext();

            proxy.Clear();

            Assert.AreEqual(100, proxy.Count);
            Assert.That(() => enumerator.MoveNext(), Throws.InvalidOperationException);
        }
예제 #7
0
        public void EnumeratorForEnumerable()
        {
            var proxy = new ListProxy(Enumerable.Range(0, 2));

            var enumerator = proxy.GetEnumerator();

            Assert.That(enumerator.Current, Is.Null);
            Assert.That(enumerator.MoveNext(), Is.True);
            Assert.That(enumerator.Current, Is.EqualTo(0));
            Assert.That(enumerator.MoveNext(), Is.True);
            Assert.That(enumerator.Current, Is.EqualTo(1));
            Assert.That(enumerator.MoveNext(), Is.False);
        }
        public static void Serialize(Stream stream, LuckyDrawUnityView instance)
        {
            int mask = 0;

            using (var bytes = new MemoryStream())
            {
                EnumProxy <BundleCategoryType> .Serialize(bytes, instance.Category);

                if (instance.Description != null)
                {
                    StringProxy.Serialize(bytes, instance.Description);
                }
                else
                {
                    mask |= 1;
                }
                if (instance.IconUrl != null)
                {
                    StringProxy.Serialize(bytes, instance.IconUrl);
                }
                else
                {
                    mask |= 2;
                }

                Int32Proxy.Serialize(bytes, instance.Id);
                BooleanProxy.Serialize(bytes, instance.IsAvailableInShop);
                if (instance.LuckyDrawSets != null)
                {
                    ListProxy <LuckyDrawSetUnityView> .Serialize(bytes, instance.LuckyDrawSets, new ListProxy <LuckyDrawSetUnityView> .Serializer <LuckyDrawSetUnityView>(LuckyDrawSetUnityViewProxy.Serialize));
                }
                else
                {
                    mask |= 4;
                }
                if (instance.Name != null)
                {
                    StringProxy.Serialize(bytes, instance.Name);
                }
                else
                {
                    mask |= 8;
                }

                Int32Proxy.Serialize(bytes, instance.Price);
                EnumProxy <UberStrikeCurrencyType> .Serialize(bytes, instance.UberStrikeCurrencyType);

                Int32Proxy.Serialize(stream, ~mask);
                bytes.WriteTo(stream);
            }
        }
        [Test()] public void TestContains()
        {
            var list_proxy = new ListProxy <int>(CreateSequence(), CreateOddSequence());

            foreach (int num in CreateEvenSequence())
            {
                Assert.IsTrue(list_proxy.Contains(num));
            }

            foreach (int num in CreateOddSequence())
            {
                Assert.IsFalse(list_proxy.Contains(num));
            }
        }
예제 #10
0
        public void IEnumerableAddDoesNotReport0()
        {
            var custom = new CustomINCC();

            custom.Add("test");
            custom.Add("test2");

            var proxy = new ListProxy(custom);

            Assert.That(proxy.Count, Is.EqualTo(2));

            custom.Add("testing");
            Assert.That(proxy.Count, Is.EqualTo(3));
        }
        /// <summary>Create a TimedRatingsProxy object</summary>
        /// <param name="ratings">a ratings data structure</param>
        /// <param name="indices">an index list pointing to entries in the ratings</param>
        public TimedRatingsProxy(ITimedRatings ratings, IList <int> indices)
        {
            Users  = new ListProxy <int>(ratings.Users, indices);
            Items  = new ListProxy <int>(ratings.Items, indices);
            Values = new ListProxy <float>(ratings, indices);
            Times  = new ListProxy <DateTime>(ratings.Times, indices);

            MaxUserID = ratings.MaxUserID;
            MaxItemID = ratings.MaxItemID;
            Scale     = ratings.Scale;

            EarliestTime = Count > 0 ? Times.Min() : DateTime.MaxValue;
            LatestTime   = Count > 0 ? Times.Max() : DateTime.MinValue;
        }
예제 #12
0
		/// <summary>Create a TimedRatingsProxy object</summary>
		/// <param name="ratings">a ratings data structure</param>
		/// <param name="indices">an index list pointing to entries in the ratings</param>
		public TimedRatingsProxy(ITimedRatings ratings, IList<int> indices)
		{
			Users  = new ListProxy<int>(ratings.Users, indices);
			Items  = new ListProxy<int>(ratings.Items, indices);
			Values = new ListProxy<float>(ratings, indices);
			Times  = new ListProxy<DateTime>(ratings.Times, indices);

			MaxUserID = ratings.MaxUserID;
			MaxItemID = ratings.MaxItemID;
			Scale = ratings.Scale;

			EarliestTime = Count > 0 ? Times.Min() : DateTime.MaxValue;
			LatestTime   = Count > 0 ? Times.Max() : DateTime.MinValue;
		}
예제 #13
0
        public void SynchronizedCollectionAdd()
        {
            bool invoked = false;

            Device.PlatformServices = new MockPlatformServices(isInvokeRequired: true, invokeOnMainThread: action =>
            {
                invoked = true;
                action();
            });

            var collection = new ObservableCollection <string> {
                "foo"
            };
            var context = new object();

            var list = new ListProxy(collection);

            Assert.IsFalse(invoked, "An invoke shouldn't be executed just setting up ListProxy");

            bool executed = false;

            BindingBase.EnableCollectionSynchronization(collection, context, (enumerable, o, method, access) =>
            {
                executed = true;
                Assert.AreSame(collection, enumerable);
                Assert.AreSame(context, o);
                Assert.IsNotNull(method);
                Assert.IsFalse(access);

                lock (enumerable)
                    method();
            });

            var mre = new ManualResetEvent(false);

            Task.Factory.StartNew(() =>
            {
                lock (collection)
                    collection.Add("foo");

                mre.Set();
            }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default);

            mre.WaitOne(5000);

            Assert.IsTrue(executed, "Callback was not executed");
            Assert.IsTrue(invoked, "Callback was not executed on the UI thread");
        }
예제 #14
0
        // Token: 0x060011C9 RID: 4553 RVA: 0x0001D8E0 File Offset: 0x0001BAE0
        public static Coroutine GetAllLuckyDraws(Action <List <LuckyDrawUnityView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IShopWebServiceContract", "ShopWebService", "GetAllLuckyDraws_1", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <LuckyDrawUnityView> .Deserialize(new MemoryStream(data), new ListProxy <LuckyDrawUnityView> .Deserializer <LuckyDrawUnityView>(LuckyDrawUnityViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #15
0
        public void CollectionChangedWhileEnumerating()
        {
            var c = new ObservableCollection <string> {
                "foo", "bar"
            };
            var p = new ListProxy(c);

            IEnumerator <object> e = p.GetEnumerator();

            Assert.IsTrue(e.MoveNext(), "Initial MoveNext() failed, test can't continue");

            c.Add("baz");

            Assert.That(() => e.MoveNext(), Throws.InvalidOperationException,
                        "MoveNext did not throw an exception when the underlying collection had changed");
        }
예제 #16
0
        public static UberStrikeItemGearView Deserialize(Stream bytes)
        {
            var mask = Int32Proxy.Deserialize(bytes);
            var view = new UberStrikeItemGearView();

            view.ArmorPoints = Int32Proxy.Deserialize(bytes);
            view.ArmorWeight = Int32Proxy.Deserialize(bytes);

            if ((mask & 1) != 0)
            {
                view.CustomProperties = DictionaryProxy <string, string> .Deserialize(bytes, StringProxy.Deserialize, StringProxy.Deserialize);
            }
            if ((mask & 2) != 0)
            {
                view.Description = StringProxy.Deserialize(bytes);
            }

            view.ID           = Int32Proxy.Deserialize(bytes);
            view.IsConsumable = BooleanProxy.Deserialize(bytes);
            view.ItemClass    = EnumProxy <UberStrikeItemClass> .Deserialize(bytes);

            if ((mask & 4) != 0)
            {
                view.ItemProperties = DictionaryProxy <ItemPropertyType, int> .Deserialize(bytes, EnumProxy <ItemPropertyType> .Deserialize, Int32Proxy.Deserialize);
            }

            view.LevelLock       = Int32Proxy.Deserialize(bytes);
            view.MaxDurationDays = Int32Proxy.Deserialize(bytes);

            if ((mask & 8) != 0)
            {
                view.Name = StringProxy.Deserialize(bytes);
            }
            if ((mask & 16) != 0)
            {
                view.PrefabName = StringProxy.Deserialize(bytes);
            }
            if ((mask & 32) != 0)
            {
                view.Prices = ListProxy <ItemPriceView> .Deserialize(bytes, ItemPriceViewProxy.Deserialize);
            }

            view.ShopHighlightType = EnumProxy <ItemShopHighlightType> .Deserialize(bytes);

            return(view);
        }
예제 #17
0
        // Token: 0x060011F1 RID: 4593 RVA: 0x0001DC10 File Offset: 0x0001BE10
        public static Coroutine GenerateNonDuplicatedMemberNames(string username, Action <List <string> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, username);
                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IUserWebServiceContract", "UserWebService", "GenerateNonDuplicatedMemberNames", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <string> .Deserialize(new MemoryStream(data), new ListProxy <string> .Deserializer <string>(StringProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #18
0
        // Token: 0x06001163 RID: 4451 RVA: 0x0001C570 File Offset: 0x0001A770
        public static Coroutine GetAllGroupInvitations(string authToken, Action <List <GroupInvitationView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, authToken);
                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IClanWebServiceContract", "ClanWebService", "GetAllGroupInvitations", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <GroupInvitationView> .Deserialize(new MemoryStream(data), new ListProxy <GroupInvitationView> .Deserializer <GroupInvitationView>(GroupInvitationViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #19
0
        public static AccountCompletionResultView Deserialize(Stream bytes)
        {
            int mask = Int32Proxy.Deserialize(bytes);
            var view = new AccountCompletionResultView();

            if ((mask & 1) != 0)
            {
                view.ItemsAttributed = DictionaryProxy <int, int> .Deserialize(bytes, Int32Proxy.Deserialize, Int32Proxy.Deserialize);
            }
            if ((mask & 2) != 0)
            {
                view.NonDuplicateNames = ListProxy <string> .Deserialize(bytes, StringProxy.Deserialize);
            }

            view.Result = Int32Proxy.Deserialize(bytes);
            return(view);
        }
예제 #20
0
        public static void Serialize(Stream stream, AuthenticateApplicationView instance)
        {
            int mask = 0;

            using (var bytes = new MemoryStream())
            {
                if (instance.CommServer != null)
                {
                    PhotonViewProxy.Serialize(bytes, instance.CommServer);
                }
                else
                {
                    mask |= 1;
                }
                if (instance.EncryptionInitVector != null)
                {
                    StringProxy.Serialize(bytes, instance.EncryptionInitVector);
                }
                else
                {
                    mask |= 2;
                }
                if (instance.EncryptionPassPhrase != null)
                {
                    StringProxy.Serialize(bytes, instance.EncryptionPassPhrase);
                }
                else
                {
                    mask |= 4;
                }
                if (instance.GameServers != null)
                {
                    ListProxy <PhotonView> .Serialize(bytes, instance.GameServers, PhotonViewProxy.Serialize);
                }
                else
                {
                    mask |= 8;
                }

                BooleanProxy.Serialize(bytes, instance.IsEnabled);
                BooleanProxy.Serialize(bytes, instance.WarnPlayer);
                Int32Proxy.Serialize(stream, ~mask);
                bytes.WriteTo(stream);
            }
        }
예제 #21
0
        // Token: 0x0600118C RID: 4492 RVA: 0x0001CA28 File Offset: 0x0001AC28
        public static Coroutine GetFacebookFriendsList(List <string> facebookIds, Action <List <PublicProfileView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <string> .Serialize(memoryStream, facebookIds, new ListProxy <string> .Serializer <string>(StringProxy.Serialize));

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IFacebookWebServiceContract", "FacebookWebService", "GetFacebookFriendsList", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <PublicProfileView> .Deserialize(new MemoryStream(data), new ListProxy <PublicProfileView> .Deserializer <PublicProfileView>(PublicProfileViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #22
0
        // Token: 0x060011FB RID: 4603 RVA: 0x0001E160 File Offset: 0x0001C360
        public static Coroutine GetMemberListSessionData(List <string> authTokens, Action <List <MemberSessionDataView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <string> .Serialize(memoryStream, authTokens, new ListProxy <string> .Serializer <string>(StringProxy.Serialize));

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IUserWebServiceContract", "UserWebService", "GetMemberListSessionData", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MemberSessionDataView> .Deserialize(new MemoryStream(data), new ListProxy <MemberSessionDataView> .Deserializer <MemberSessionDataView>(MemberSessionDataViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
        // Token: 0x060011AF RID: 4527 RVA: 0x0001D12C File Offset: 0x0001B32C
        public static Coroutine GetContactsByGroups(string authToken, bool populateFacebookIds, Action <List <ContactGroupView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, authToken);
                BooleanProxy.Serialize(memoryStream, populateFacebookIds);
                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IRelationshipWebServiceContract", "RelationshipWebService", "GetContactsByGroups", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <ContactGroupView> .Deserialize(new MemoryStream(data), new ListProxy <ContactGroupView> .Deserializer <ContactGroupView>(ContactGroupViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #24
0
        // Token: 0x060011C6 RID: 4550 RVA: 0x0001D748 File Offset: 0x0001B948
        public static Coroutine GetAllMysteryBoxs(BundleCategoryType bundleCategoryType, Action <List <MysteryBoxUnityView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                EnumProxy <BundleCategoryType> .Serialize(memoryStream, bundleCategoryType);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IShopWebServiceContract", "ShopWebService", "GetAllMysteryBoxs_2", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MysteryBoxUnityView> .Deserialize(new MemoryStream(data), new ListProxy <MysteryBoxUnityView> .Deserializer <MysteryBoxUnityView>(MysteryBoxUnityViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #25
0
        // Token: 0x06001198 RID: 4504 RVA: 0x0001CB40 File Offset: 0x0001AD40
        public static Coroutine GetAllMessageThreadsForUser(string authToken, int pageNumber, Action <List <MessageThreadView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, authToken);
                Int32Proxy.Serialize(memoryStream, pageNumber);
                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IPrivateMessageWebServiceContract", "PrivateMessageWebService", "GetAllMessageThreadsForUser", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MessageThreadView> .Deserialize(new MemoryStream(data), new ListProxy <MessageThreadView> .Deserializer <MessageThreadView>(MessageThreadViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #26
0
        // Token: 0x060011BF RID: 4543 RVA: 0x0001D390 File Offset: 0x0001B590
        public static Coroutine GetBundles(ChannelType channel, Action <List <BundleView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                EnumProxy <ChannelType> .Serialize(memoryStream, channel);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IShopWebServiceContract", "ShopWebService", "GetBundles", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <BundleView> .Deserialize(new MemoryStream(data), new ListProxy <BundleView> .Deserializer <BundleView>(BundleViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #27
0
        public void EnumerableCount()
        {
            var enumerable = Enumerable.Range(0, 100);
            var proxy      = new ListProxy(enumerable, 10);

            int changed = 0;

            proxy.CountChanged += (o, e) => changed++;

            var enumerator = proxy.GetEnumerator();

            enumerator.MoveNext();

            Assert.AreEqual(10, proxy.Count);
            Assert.AreEqual(1, changed);

            enumerator.MoveNext();

            Assert.AreEqual(10, proxy.Count);
            Assert.AreEqual(1, changed);

            while (enumerator.MoveNext())
            {
            }

            enumerator.Dispose();

            Assert.AreEqual(100, proxy.Count);
            Assert.AreEqual(19, changed);

            using (enumerator = proxy.GetEnumerator())
            {
                Assert.AreEqual(100, proxy.Count);

                while (enumerator.MoveNext())
                {
                    Assert.AreEqual(100, proxy.Count);
                }

                Assert.AreEqual(100, proxy.Count);
            }

            Assert.AreEqual(19, changed);
        }
예제 #28
0
        // Token: 0x06001139 RID: 4409 RVA: 0x0001BA54 File Offset: 0x00019C54
        public static Coroutine GetMaps(string clientVersion, DefinitionType clientType, Action <List <MapView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, clientVersion);
                EnumProxy <DefinitionType> .Serialize(memoryStream, clientType);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IApplicationWebServiceContract", "ApplicationWebService", "GetMaps", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MapView> .Deserialize(new MemoryStream(data), new ListProxy <MapView> .Deserializer <MapView>(MapViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
        // Token: 0x06001275 RID: 4725 RVA: 0x0001F1AC File Offset: 0x0001D3AC
        public void SendSetContactList(List <int> cmids)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <int> .Serialize(memoryStream, cmids, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));

                Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
                {
                    {
                        this.__id,
                        memoryStream.ToArray()
                    }
                };
                if (this.sendOperation != null)
                {
                    this.sendOperation(24, customOpParameters, true, 0, false);
                }
            }
        }
        public static void Serialize(Stream stream, UberStrikeItemShopClientView instance)
        {
            int mask = 0;

            using (var bytes = new MemoryStream())
            {
                if (instance.FunctionalItems != null)
                {
                    ListProxy <UberStrikeItemFunctionalView> .Serialize(bytes, instance.FunctionalItems, UberStrikeItemFunctionalViewProxy.Serialize);
                }
                else
                {
                    mask |= 1;
                }
                if (instance.GearItems != null)
                {
                    ListProxy <UberStrikeItemGearView> .Serialize(bytes, instance.GearItems, UberStrikeItemGearViewProxy.Serialize);
                }
                else
                {
                    mask |= 2;
                }
                if (instance.QuickItems != null)
                {
                    ListProxy <UberStrikeItemQuickView> .Serialize(bytes, instance.QuickItems, UberStrikeItemQuickViewProxy.Serialize);
                }
                else
                {
                    mask |= 4;
                }
                if (instance.WeaponItems != null)
                {
                    ListProxy <UberStrikeItemWeaponView> .Serialize(bytes, instance.WeaponItems, UberStrikeItemWeaponViewProxy.Serialize);
                }
                else
                {
                    mask |= 8;
                }

                Int32Proxy.Serialize(stream, ~mask);
                bytes.WriteTo(stream);
            }
        }
        // Token: 0x06001271 RID: 4721 RVA: 0x0001EFB4 File Offset: 0x0001D1B4
        public void SendSpeedhackDetectionNew(List <float> timeDifferences)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <float> .Serialize(memoryStream, timeDifferences, new ListProxy <float> .Serializer <float>(SingleProxy.Serialize));

                Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
                {
                    {
                        this.__id,
                        memoryStream.ToArray()
                    }
                };
                if (this.sendOperation != null)
                {
                    this.sendOperation(20, customOpParameters, true, 0, false);
                }
            }
        }
예제 #32
0
        internal LayeredApplicationModelImmutable(
            LayeredArchitecture architecture,
            Type genericCompositePropertyMixin,
            Type genericCompositeEventMixin,
            Type genericFragmentBaseType,
            DictionaryQuery <CompositeModelType, CompositeModelTypeAssemblyScopeSupport> modelTypeAssemblyScopeSupport,
            out DictionaryQuery <CompositeModelType, CompositeModelTypeModelScopeSupport> compositeModelTypeSupport,
            out DictionaryProxy <Int32, CompositeModel> models,
            out ListProxy <LayerModelMutable> topLevelLayers,
            out ListProxy <LayerModelMutable> allLayers
            )
            : base(architecture, genericCompositePropertyMixin, genericCompositeEventMixin, genericFragmentBaseType, modelTypeAssemblyScopeSupport, out compositeModelTypeSupport, out models)
        {
            this._topLevelLayers = this.CollectionsFactory.NewListProxy <LayerModelMutable>();
            this._allLayers      = this.CollectionsFactory.NewListProxy <LayerModelMutable>();

            topLevelLayers = this._topLevelLayers;
            allLayers      = this._allLayers;
        }
예제 #33
0
        // Token: 0x060012C6 RID: 4806 RVA: 0x0002032C File Offset: 0x0001E52C
        public void SendPowerUpRespawnTimes(List <ushort> respawnTimes)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <ushort> .Serialize(memoryStream, respawnTimes, new ListProxy <ushort> .Serializer <ushort>(UInt16Proxy.Serialize));

                Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
                {
                    {
                        this.__id,
                        memoryStream.ToArray()
                    }
                };
                if (this.sendOperation != null)
                {
                    this.sendOperation(3, customOpParameters, true, 0, false);
                }
            }
        }
예제 #34
0
        public void WeakToWeak()
        {
            WeakCollectionChangedList list = new WeakCollectionChangedList();

            _proxyForWeakToWeakTest = new ListProxy(list);

            Assert.True(list.AddObject(), "GC hasn't run");

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.IsTrue(list.AddObject(), "GC run, but proxy should still hold a reference");

            _proxyForWeakToWeakTest = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.IsFalse(list.AddObject(), "Proxy is gone and GC has run");
        }
        // Token: 0x06001269 RID: 4713 RVA: 0x0001EBF0 File Offset: 0x0001CDF0
        public void SendChatMessageToClan(List <int> clanMembers, string message)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                ListProxy <int> .Serialize(memoryStream, clanMembers, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));

                StringProxy.Serialize(memoryStream, message);
                Dictionary <byte, object> customOpParameters = new Dictionary <byte, object>
                {
                    {
                        this.__id,
                        memoryStream.ToArray()
                    }
                };
                if (this.sendOperation != null)
                {
                    this.sendOperation(12, customOpParameters, true, 0, false);
                }
            }
        }
예제 #36
0
        // Token: 0x060011C8 RID: 4552 RVA: 0x0001D850 File Offset: 0x0001BA50
        public static Coroutine RollMysteryBox(string authToken, int mysteryBoxId, ChannelType channel, Action <List <MysteryBoxWonItemUnityView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, authToken);
                Int32Proxy.Serialize(memoryStream, mysteryBoxId);
                EnumProxy <ChannelType> .Serialize(memoryStream, channel);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IShopWebServiceContract", "ShopWebService", "RollMysteryBox", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MysteryBoxWonItemUnityView> .Deserialize(new MemoryStream(data), new ListProxy <MysteryBoxWonItemUnityView> .Deserializer <MysteryBoxWonItemUnityView>(MysteryBoxWonItemUnityViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
예제 #37
0
        /// <summary>Create a RatingsProxy object</summary>
        /// <param name="ratings">a ratings data structure</param>
        /// <param name="indices">an index list pointing to entries in the ratings</param>
        public RatingsProxy(IRatings ratings, IList<int> indices)
        {
            this.indices = indices;

            Users  = new ListProxy<int>(ratings.Users, indices);
            Items  = new ListProxy<int>(ratings.Items, indices);
            Values = new ListProxy<float>(ratings, indices);

            MaxUserID = -1;
            MaxItemID = -1;
            MaxRating = ratings.MaxRating;
            MinRating = ratings.MinRating;

            foreach (int index in indices)
            {
                if (ratings.Users[index] > MaxUserID)
                    MaxUserID = ratings.Users[index];
                if (ratings.Items[index] > MaxItemID)
                    MaxItemID = ratings.Items[index];
            }
        }
예제 #38
0
		[Test()] public void TestCount()
		{
			var list_proxy = new ListProxy<int>(CreateSequence(), CreateOddSequence());

			Assert.AreEqual(CreateOddSequence().Count, list_proxy.Count);
		}
예제 #39
0
		[Test()] public void TestIsReadOnly()
		{
			var list_proxy = new ListProxy<int>(CreateSequence(), CreateOddSequence());

			Assert.IsTrue(list_proxy.IsReadOnly);
		}