예제 #1
0
        public void GetStorageExpression()
        {
            var declaringType  = ObjectMother.GetDeclaringType();
            var field          = ObjectMother.GetFieldInfo(declaringType: declaringType);
            var thisExpression = ObjectMother.GetThisExpression(declaringType);
            var storage        = new InstanceStorage(field);

            var result = storage.CreateStorageExpression(thisExpression);

            Assert.That(result, Is.InstanceOf <MemberExpression>());
            var memberExpression = (MemberExpression)result;

            Assert.That(memberExpression.Member, Is.SameAs(field));
            Assert.That(memberExpression.Expression, Is.SameAs(thisExpression));
        }
예제 #2
0
파일: Habbo.cs 프로젝트: habb0/IHI-1
        private void Init()
        {
            _loginId     = new ResettableLazyDirty <int>(() => HabboActions.GetLoginIdFromHabboId(Id));
            _username    = new ResettableLazyDirty <string>(() => HabboActions.GetHabboUsernameFromHabboId(Id));
            _dateCreated = new ResettableLazyDirty <DateTime>(() => HabboActions.GetCreationDateFromHabboId(Id));
            _lastAccess  = new ResettableLazyDirty <DateTime>(() => HabboActions.GetLastAccessDateFromHabboId(Id));
            _credits     = new ResettableLazyDirty <int>(() => HabboActions.GetCreditsFromHabboId(Id));

            _instanceStorage   = new InstanceStorage();
            _persistentStorage = new PersistentStorage(this);

            _permissions = new ResettableLazyDirty <IDictionary <string, PermissionState> >(() => CoreManager.ServerCore.PermissionDistributor.GetHabboPermissions(this));

            _figure = new ResettableLazyDirty <HabboFigure>(() => LoadFigure());
            _motto  = new ResettableLazyDirty <string>(() => HabboActions.GetMottoFromHabboId(Id));

            MessengerCategories = new HashSet <MessengerCategory>();
        }
        private SimpleDependencyContainer(string scopeName, SimpleDependencyContainer parentContainer)
        {
            Ensure.NotNullOrEmpty(scopeName, "scopeName");
            this.scopeName       = scopeName;
            this.parentContainer = parentContainer;

            InstanceStorage instances = new InstanceStorage();

            if (parentContainer == null)
            {
                this.definitions = new DependencyDefinitionCollection(scopeName, instances);
            }
            else
            {
                this.definitions = new DependencyDefinitionCollection(scopeName, instances, parentContainer.definitions);
            }

            this.resolver = new InstanceResolver(definitions, instances);

            definitions.Add(typeof(IDependencyContainer), DependencyLifetime.NameScope(scopeName), this);
            definitions.Add(typeof(IDependencyProvider), DependencyLifetime.NameScope(scopeName), this);
        }
예제 #4
0
파일: Habbo.cs 프로젝트: habb0/IHI-1
        private void Init()
        {
            _loginId = new ResettableLazyDirty<int>(() => HabboActions.GetLoginIdFromHabboId(Id));
            _username = new ResettableLazyDirty<string>(() => HabboActions.GetHabboUsernameFromHabboId(Id));
            _dateCreated = new ResettableLazyDirty<DateTime>(() => HabboActions.GetCreationDateFromHabboId(Id));
            _lastAccess = new ResettableLazyDirty<DateTime>(() => HabboActions.GetLastAccessDateFromHabboId(Id));
            _credits = new ResettableLazyDirty<int>(() => HabboActions.GetCreditsFromHabboId(Id));

            _instanceStorage = new InstanceStorage();
            _persistentStorage = new PersistentStorage(this);

            _permissions = new ResettableLazyDirty<IDictionary<string, PermissionState>>(() => CoreManager.ServerCore.PermissionDistributor.GetHabboPermissions(this));

            _figure = new ResettableLazyDirty<HabboFigure>(() => LoadFigure());
            _motto = new ResettableLazyDirty<string>(() => HabboActions.GetMottoFromHabboId(Id));

            MessengerCategories = new HashSet<MessengerCategory>();
        }