示例#1
0
        protected override EasDeviceBudget CreateBudget(BudgetKey key, IThrottlingPolicy policy)
        {
            EasDeviceBudgetKey easDeviceBudgetKey = key as EasDeviceBudgetKey;

            if (easDeviceBudgetKey == null)
            {
                throw new ArgumentException("key must be an EasDeviceBudgetKey", "key");
            }
            return(new EasDeviceBudget(easDeviceBudgetKey, policy));
        }
示例#2
0
        // Token: 0x060017DE RID: 6110 RVA: 0x0008CF34 File Offset: 0x0008B134
        internal void Remove(EasDeviceBudget budget)
        {
            bool flag = false;

            lock (this.instanceLock)
            {
                EasDeviceBudget    objB = null;
                EasDeviceBudgetKey key  = budget.Owner as EasDeviceBudgetKey;
                if (this.activeBudgets.TryGetValue(key, out objB) && object.ReferenceEquals(budget, objB))
                {
                    this.activeBudgets.Remove(key);
                    this.UpdateIfNecessary(true);
                    flag = true;
                }
                if (flag && this.activeBudgets.Count == 0)
                {
                    EasDeviceBudgetAllocator easDeviceBudgetAllocator;
                    EasDeviceBudgetAllocator.allocators.TryRemove(this.UserSid, out easDeviceBudgetAllocator);
                }
            }
        }
示例#3
0
        // Token: 0x060017DC RID: 6108 RVA: 0x0008CD78 File Offset: 0x0008AF78
        public void Add(EasDeviceBudget budget)
        {
            EasDeviceBudgetKey easDeviceBudgetKey = budget.Owner as EasDeviceBudgetKey;
            SecurityIdentifier sid = easDeviceBudgetKey.Sid;

            if (!sid.Equals(this.UserSid))
            {
                throw new InvalidOperationException(string.Format("[EasDeviceBudgetAllocator.Add] Attempted to add a budget for user {0} to allocator for user {1}. That is very naughty.", sid, this.UserSid));
            }
            bool flag = false;

            lock (this.instanceLock)
            {
                if (!this.activeBudgets.ContainsKey(easDeviceBudgetKey))
                {
                    this.activeBudgets[easDeviceBudgetKey] = budget;
                    flag = true;
                }
            }
            if (flag)
            {
                this.UpdateIfNecessary(true);
            }
        }
示例#4
0
        // Token: 0x060017EA RID: 6122 RVA: 0x0008D254 File Offset: 0x0008B454
        public override bool Equals(object obj)
        {
            EasDeviceBudgetKey easDeviceBudgetKey = obj as EasDeviceBudgetKey;

            return(!(easDeviceBudgetKey == null) && (object.ReferenceEquals(obj, this) || (easDeviceBudgetKey.Sid.Equals(base.Sid) && easDeviceBudgetKey.DeviceId == this.DeviceId && easDeviceBudgetKey.DeviceType == this.DeviceType)));
        }
        // Token: 0x060017C7 RID: 6087 RVA: 0x0008C9C4 File Offset: 0x0008ABC4
        public static IStandardBudget Acquire(SecurityIdentifier sid, string deviceId, string deviceType, ADSessionSettings sessionSettings)
        {
            EasDeviceBudgetKey budgetKey = new EasDeviceBudgetKey(sid, deviceId, deviceType, sessionSettings);

            return(EasDeviceBudget.Acquire(budgetKey));
        }
        // Token: 0x060017C6 RID: 6086 RVA: 0x0008C9A4 File Offset: 0x0008ABA4
        public static IStandardBudget Acquire(EasDeviceBudgetKey budgetKey)
        {
            EasDeviceBudget innerBudget = EasDeviceBudgetCache.Singleton.Get(budgetKey);

            return(new EasDeviceBudgetWrapper(innerBudget));
        }
        // Token: 0x060017D2 RID: 6098 RVA: 0x0008CB10 File Offset: 0x0008AD10
        protected override SingleComponentThrottlingPolicy GetSingleComponentPolicy(IThrottlingPolicy policy)
        {
            EasDeviceBudgetKey easDeviceBudgetKey = base.Owner as EasDeviceBudgetKey;

            return(new EasDeviceThrottlingPolicy(policy, easDeviceBudgetKey.DeviceId, easDeviceBudgetKey.DeviceType, this.Percentage));
        }