예제 #1
0
        internal virtual void SetQuota(PermissionSet psAllowed, PermissionSet psDenied)
        {
            IsolatedStoragePermission permission1 = this.GetPermission(psAllowed);

            this.m_Quota = 0UL;
            if (permission1 != null)
            {
                this.m_Quota = !permission1.IsUnrestricted() ? (ulong)permission1.UserQuota : 9223372036854775807UL;
            }
            if (psDenied != null)
            {
                IsolatedStoragePermission permission2 = this.GetPermission(psDenied);
                if (permission2 != null)
                {
                    if (permission2.IsUnrestricted())
                    {
                        this.m_Quota = 0UL;
                    }
                    else
                    {
                        ulong num = (ulong)permission2.UserQuota;
                        this.m_Quota = num <= this.m_Quota ? this.m_Quota - num : 0UL;
                    }
                }
            }
            this.m_ValidQuota = true;
        }
        }// onUsageChange

        //-------------------------------------------------
        // PutValuesinPage
        //
        // Initializes the controls with the provided permission
        //-------------------------------------------------
        protected override void PutValuesinPage()
        {
            // Put stuff in the combo box
            m_cbUsage.Items.Clear();
            // Make sure these get added in this order
            m_cbUsage.Items.Add(CResourceStore.GetString("IsolatedStorageFilePermission:AdministerIsolatedStorageByUser"));
            m_cbUsage.Items.Add(CResourceStore.GetString("IsolatedStorageFilePermission:AssemblyIsolatationByUser"));
            m_cbUsage.Items.Add(CResourceStore.GetString("IsolatedStorageFilePermission:AssemblyIsolatationByUserRoam"));
            m_cbUsage.Items.Add(CResourceStore.GetString("IsolatedStorageFilePermission:DomainIsolatationByUser"));
            m_cbUsage.Items.Add(CResourceStore.GetString("IsolatedStorageFilePermission:DomainIsolatationByUserRoam"));
            m_cbUsage.Items.Add(CResourceStore.GetString("None"));

            IsolatedStoragePermission perm = (IsolatedStoragePermission)m_perm;

            if (perm.IsUnrestricted())
            {
                m_radUnrestricted.Checked = true;
                m_ucOptions.Enabled       = false;
                m_cbUsage.SelectedIndex   = 0;
            }
            else
            {
                m_radGrantFollowingPermission.Checked = true;

                if (perm.UsageAllowed == IsolatedStorageContainment.AdministerIsolatedStorageByUser)
                {
                    m_cbUsage.SelectedIndex = ADMINBYUSER;
                }
                else if (perm.UsageAllowed == IsolatedStorageContainment.AssemblyIsolationByUser)
                {
                    m_cbUsage.SelectedIndex = ASSEMBLYISO;
                }
                else if (perm.UsageAllowed == IsolatedStorageContainment.AssemblyIsolationByRoamingUser)
                {
                    m_cbUsage.SelectedIndex = ASSEMBLYISOROAM;
                }
                else if (perm.UsageAllowed == IsolatedStorageContainment.DomainIsolationByUser)
                {
                    m_cbUsage.SelectedIndex = DOMAINISO;
                }
                else if (perm.UsageAllowed == IsolatedStorageContainment.DomainIsolationByRoamingUser)
                {
                    m_cbUsage.SelectedIndex = DOMAINISOROAM;
                }
                else if (perm.UsageAllowed == IsolatedStorageContainment.None)
                {
                    m_cbUsage.SelectedIndex = NONE;
                }


                m_txtDiskQuota.Text = perm.UserQuota.ToString();
            }
            onUsageChange(null, null);
        }// PutValuesinPage
        internal virtual void SetQuota(PermissionSet psAllowed, PermissionSet psDenied)
        {
            IsolatedStoragePermission permission = this.GetPermission(psAllowed);

            this.m_Quota = 0L;
            if (permission != null)
            {
                if (permission.IsUnrestricted())
                {
                    this.m_Quota = 0x7fffffffffffffffL;
                }
                else
                {
                    this.m_Quota = (ulong)permission.UserQuota;
                }
            }
            if (psDenied != null)
            {
                IsolatedStoragePermission permission2 = this.GetPermission(psDenied);
                if (permission2 != null)
                {
                    if (permission2.IsUnrestricted())
                    {
                        this.m_Quota = 0L;
                    }
                    else
                    {
                        ulong userQuota = (ulong)permission2.UserQuota;
                        if (userQuota > this.m_Quota)
                        {
                            this.m_Quota = 0L;
                        }
                        else
                        {
                            this.m_Quota -= userQuota;
                        }
                    }
                }
            }
            this.m_ValidQuota = true;
        }
 //-------------------------------------------------
 // CIsoStoragePermDialog - Constructor
 //
 // The constructor takes in a permission that the dialog
 // will use to display default values
 //-------------------------------------------------
 internal CIsoStoragePermDialog(IsolatedStoragePermission perm)
 {
     this.Text      = CResourceStore.GetString("Isolatedstorageperm:PermName");
     m_PermControls = new CIsoStoragePermControls(perm, this);
     Init();
 } // CIsoStoragePermDialog