private static NamedPermissionSet BuildLocalIntranet() { NamedPermissionSet nps = new NamedPermissionSet(ReservedNames.LocalIntranet, PermissionState.None); nps.AddPermission(new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME;USER")); nps.AddPermission(new FileDialogPermission(PermissionState.Unrestricted)); IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); isfp.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; isfp.UserQuota = Int64.MaxValue; nps.AddPermission(isfp); nps.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.ReflectionEmit)); SecurityPermissionFlag spf = SecurityPermissionFlag.Execution | SecurityPermissionFlag.Assertion; nps.AddPermission(new SecurityPermission(spf)); nps.AddPermission(new UIPermission(PermissionState.Unrestricted)); // DnsPermission requires stuff outside corlib (System) nps.AddPermission(PermissionBuilder.Create(DnsPermissionClass, PermissionState.Unrestricted)); // PrintingPermission requires stuff outside corlib (System.Drawing) nps.AddPermission(PermissionBuilder.Create(PrintingPermission("SafePrinting"))); return(nps); }
public void IsSubsetOf_DifferentPermissions() { IsolatedStorageFilePermission a = new IsolatedStorageFilePermission(PermissionState.None); SecurityPermission b = new SecurityPermission(PermissionState.None); a.IsSubsetOf(b); }
public void Intersect_DifferentPermissions() { IsolatedStorageFilePermission a = new IsolatedStorageFilePermission(PermissionState.None); SecurityPermission b = new SecurityPermission(PermissionState.None); a.Intersect(b); }
public void Union() { IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission(PermissionState.None); IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union(null); Assert.IsNotNull(union, "empty U null"); Assert.IsFalse(union.IsUnrestricted(), "IsUnrestricted-1"); Assert.IsFalse(Object.ReferenceEquals(empty, union), "ReferenceEquals-1"); union = (IsolatedStorageFilePermission)empty.Union(empty); Assert.IsNotNull(union, "empty U empty"); Assert.IsFalse(union.IsUnrestricted(), "IsUnrestricted-2"); Assert.IsFalse(Object.ReferenceEquals(empty, union), "ReferenceEquals-2"); IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission(PermissionState.Unrestricted); union = (IsolatedStorageFilePermission)unrestricted.Union(null); Assert.IsNotNull(union, "unrestricted U null"); Assert.IsTrue(union.IsUnrestricted(), "IsUnrestricted-3"); Assert.IsFalse(Object.ReferenceEquals(unrestricted, union), "ReferenceEquals-3"); union = (IsolatedStorageFilePermission)unrestricted.Union(empty); Assert.IsNotNull(union, "unrestricted U empty"); Assert.IsTrue(union.IsUnrestricted(), "IsUnrestricted-4"); Assert.IsFalse(Object.ReferenceEquals(unrestricted, union), "ReferenceEquals-4"); union = (IsolatedStorageFilePermission)unrestricted.Union(unrestricted); Assert.IsNotNull(union, "unrestricted U unrestricted"); Assert.IsTrue(union.IsUnrestricted(), "IsUnrestricted-5"); Assert.IsFalse(Object.ReferenceEquals(unrestricted, union), "ReferenceEquals-5"); }
public static void LocalIntranet () { PermissionSet ps = CreatePermissionSet ("LocalIntranet"); ps.AddPermission (new EnvironmentPermission (EnvironmentPermissionAccess.Read, "USERNAME;USER")); ps.AddPermission (new FileDialogPermission (PermissionState.Unrestricted)); IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None); isfp.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; isfp.UserQuota = Int64.MaxValue; ps.AddPermission (isfp); ps.AddPermission (new ReflectionPermission (ReflectionPermissionFlag.ReflectionEmit)); SecurityPermissionFlag spf = SecurityPermissionFlag.Execution | SecurityPermissionFlag.Assertion; ps.AddPermission (new SecurityPermission (spf)); ps.AddPermission (new UIPermission (PermissionState.Unrestricted)); ps.AddPermission (new DnsPermission (PermissionState.Unrestricted)); ps.AddPermission (new PrintingPermission (PrintingPermissionLevel.DefaultPrinting)); ps.AddPermission (new EventLogPermission (EventLogPermissionAccess.Instrument, ".")); Save ("intranet.xml", ps); }
public void Union_DifferentPermissions() { IsolatedStorageFilePermission a = new IsolatedStorageFilePermission(PermissionState.None); SecurityPermission b = new SecurityPermission(PermissionState.None); a.Union(b); }
//------------------------------------------------------ // // IPERMISSION IMPLEMENTATION // //------------------------------------------------------ /// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Union"]/*' /> public override IPermission Union(IPermission target) { if (target == null) { return(this.Copy()); } else if (!VerifyType(target)) { throw new ArgumentException( String.Format(Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName) ); } IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target; if (this.IsUnrestricted() || operand.IsUnrestricted()) { return(new IsolatedStorageFilePermission(PermissionState.Unrestricted)); } else { IsolatedStorageFilePermission union; union = new IsolatedStorageFilePermission(PermissionState.None); union.m_userQuota = max(m_userQuota, operand.m_userQuota); union.m_machineQuota = max(m_machineQuota, operand.m_machineQuota); union.m_expirationDays = max(m_expirationDays, operand.m_expirationDays); union.m_permanentData = m_permanentData || operand.m_permanentData; union.m_allowed = (IsolatedStorageContainment)max((long)m_allowed, (long)operand.m_allowed); return(union); } }
public static void LocalIntranet() { PermissionSet ps = CreatePermissionSet("LocalIntranet"); ps.AddPermission(new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME;USER")); ps.AddPermission(new FileDialogPermission(PermissionState.Unrestricted)); IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); isfp.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; isfp.UserQuota = Int64.MaxValue; ps.AddPermission(isfp); ps.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.ReflectionEmit)); SecurityPermissionFlag spf = SecurityPermissionFlag.Execution | SecurityPermissionFlag.Assertion; ps.AddPermission(new SecurityPermission(spf)); ps.AddPermission(new UIPermission(PermissionState.Unrestricted)); ps.AddPermission(new DnsPermission(PermissionState.Unrestricted)); ps.AddPermission(new PrintingPermission(PrintingPermissionLevel.DefaultPrinting)); ps.AddPermission(new EventLogPermission(EventLogPermissionAccess.Instrument, ".")); Save("intranet.xml", ps); }
//------------------------------------------------------ // // IPERMISSION IMPLEMENTATION // //------------------------------------------------------ /// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Union"]/*' /> public override IPermission Union(IPermission target) { if (target == null) { return this.Copy(); } else if (!VerifyType(target)) { throw new ArgumentException( String.Format(Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName) ); } IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target; if (this.IsUnrestricted() || operand.IsUnrestricted()) { return new IsolatedStorageFilePermission( PermissionState.Unrestricted ); } else { IsolatedStorageFilePermission union; union = new IsolatedStorageFilePermission( PermissionState.None ); union.m_userQuota = max(m_userQuota,operand.m_userQuota); union.m_machineQuota = max(m_machineQuota,operand.m_machineQuota); union.m_expirationDays = max(m_expirationDays,operand.m_expirationDays); union.m_permanentData = m_permanentData || operand.m_permanentData; union.m_allowed = (IsolatedStorageContainment)max((long)m_allowed,(long)operand.m_allowed); return union; } }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.IsSubsetOf"]/*' /> public override bool IsSubsetOf(IPermission target) { if (target == null) { return((m_userQuota == 0) && (m_machineQuota == 0) && (m_expirationDays == 0) && (m_permanentData == false) && (m_allowed == IsolatedStorageContainment.None)); } try { IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target; if (operand.IsUnrestricted()) { return(true); } return((operand.m_userQuota >= m_userQuota) && (operand.m_machineQuota >= m_machineQuota) && (operand.m_expirationDays >= m_expirationDays) && (operand.m_permanentData || !m_permanentData) && (operand.m_allowed >= m_allowed)); } catch (InvalidCastException) { throw new ArgumentException( String.Format(Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName) ); } }
public void FromXml_WrongTag() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); se.Tag = "IMono"; isfp.FromXml(se); }
public void FromXml_WrongTagCase() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); se.Tag = "IPERMISSION"; // instead of IPermission isfp.FromXml(se); }
protected override IStackWalk CreateStackWalk() { IsolatedStorageFilePermission permission = new IsolatedStorageFilePermission(PermissionState.Unrestricted); permission.UsageAllowed = attribute.UsageAllowed; permission.UserQuota = attribute.UsageQuota; return(permission); }
protected void LoadSaveSettings(bool bLoad) { IsolatedStorageFilePermission perm = new IsolatedStorageFilePermission(PermissionState.Unrestricted); perm.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; if (!SecurityManager.IsGranted(perm)) { MessageBox.Show("User settings won't be saved.", strProgName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } IsolatedStorageFileStream stream = null; try { IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly(); if (bLoad) { string[] astr = storage.GetFileNames(strConfig); if (astr.Length > 0) { stream = new IsolatedStorageFileStream(strConfig, FileMode.Open, FileAccess.Read, FileShare.Read, storage); PropertyBag props = new PropertyBag(stream); LoadSettings(props); } else { // default settings mediaControl.AutoPlay = true; mediaControl.ShowLogo = true; mediaControl.PreferredVideoRenderer = MediaEngineServiceProvider.RecommendedRenderer; } } else { PropertyBag props = new PropertyBag(); SaveSettings(props); stream = new IsolatedStorageFileStream(strConfig, FileMode.Create, FileAccess.Write, storage); props.Save(stream); } } catch { } finally { if (stream != null) { stream.Close(); } } }
public void IndividualMethod() { ReflectionPermission rp = new ReflectionPermission(ReflectionPermissionFlag.AllFlags); rp.Demand(); IsolatedStorageFilePermission isp = new IsolatedStorageFilePermission(PermissionState.Unrestricted); isp.Demand(); }
private static void Demand(IsolatedStorageScope scope) { if (SecurityManager.SecurityEnabled) { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); isfp.UsageAllowed = ScopeToContainment(scope); isfp.Demand(); } }
private void EnsureQuota(long size) { IsolatedStoragePermission storagePerm = new IsolatedStorageFilePermission(PermissionState.None); storagePerm.UserQuota = size; storagePerm.UsageAllowed = _isRoaming? IsolatedStorageContainment.DomainIsolationByRoamingUser : IsolatedStorageContainment.DomainIsolationByUser; storagePerm.Demand(); }
public void FromXml_WrongVersion() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); se.Attributes.Remove("version"); se.Attributes.Add("version", "2"); isfp.FromXml(se); }
}// ValidateData //------------------------------------------------- // GetCurrentPermission // // This builds a permission based on the values of // the controls //------------------------------------------------- internal override IPermission GetCurrentPermission() { IsolatedStoragePermission perm; if (m_radUnrestricted.Checked == true) { perm = new IsolatedStorageFilePermission(PermissionState.Unrestricted); } else { IsolatedStorageContainment isc; switch (m_cbUsage.SelectedIndex) { case ADMINBYUSER: isc = IsolatedStorageContainment.AdministerIsolatedStorageByUser; break; case ASSEMBLYISO: isc = IsolatedStorageContainment.AssemblyIsolationByUser; break; case ASSEMBLYISOROAM: isc = IsolatedStorageContainment.AssemblyIsolationByRoamingUser; break; case DOMAINISO: isc = IsolatedStorageContainment.DomainIsolationByUser; break; case DOMAINISOROAM: isc = IsolatedStorageContainment.DomainIsolationByRoamingUser; break; default: isc = IsolatedStorageContainment.None; break; } perm = new IsolatedStorageFilePermission(PermissionState.None); perm.UsageAllowed = isc; try { perm.UserQuota = Int64.Parse(m_txtDiskQuota.Text); } catch (Exception) { MessageBox(CResourceStore.GetString("IsolatedStoragePerm:InvalidQuota"), CResourceStore.GetString("IsolatedStoragePerm:InvalidQuotaTitle"), MB.ICONEXCLAMATION); return(null); } } return(perm); }// GetCurrentPermission
public void FromXml_NoVersion() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); SecurityElement w = new SecurityElement(se.Tag); w.AddAttribute("class", se.Attribute("class")); isfp.FromXml(w); }
public void SetMethod() { ReflectionPermission rp = new ReflectionPermission(ReflectionPermissionFlag.AllFlags); IsolatedStorageFilePermission isp = new IsolatedStorageFilePermission(PermissionState.Unrestricted); System.Security.PermissionSet ps = new System.Security.PermissionSet(PermissionState.None); ps.AddPermission(rp); ps.AddPermission(isp); ps.Demand(); }
//------------------------------------------------- // CIsoStoragePermControls - Constructor // //------------------------------------------------- internal CIsoStoragePermControls(IPermission perm, Object oParent) : base(perm, oParent) { // If they don't have a permission for this permission set, we will // feed our property page a 'none' permission state. if (perm == null) { m_perm = new IsolatedStorageFilePermission(PermissionState.None); } }// CIsoStoragePermControls
public void FromXml_NoClass() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); SecurityElement w = new SecurityElement(se.Tag); w.AddAttribute("version", se.Attribute("version")); isfp.FromXml(w); // doesn't even care of the class attribute presence }
private void SetUpTrace() { TraceSink.Listeners.Clear(); System.Diagnostics.TraceSwitch traceSwitch = new System.Diagnostics.TraceSwitch(traceSwitchName, traceSwitchName); TraceSink.GetTraceSink().TraceSwitch = traceSwitch; IsolatedStorageFilePermission perm = new IsolatedStorageFilePermission(PermissionState.Unrestricted); perm.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; if (!SecurityManager.IsGranted(perm)) { return; } IsolatedStorageFileStream stream = null; try { IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly(); string[] astr = storage.GetDirectoryNames(logDirName); if (astr.Length == 0) { storage.CreateDirectory(logDirName); } string logFile = Path.Combine(logDirName, logFileName); stream = new IsolatedStorageFileStream(logFile, FileMode.Append, FileAccess.Write, FileShare.Read, storage); if (stream.Length > 1024 * 1024 * 10) { stream.Close(); stream = null; storage.DeleteFile(logFile); stream = new IsolatedStorageFileStream(logFile, FileMode.Append, FileAccess.Write, FileShare.Read, storage); } TraceSink.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(stream)); stream = null; } catch { } finally { if (stream != null) { stream.Close(); } } }
public void Unrestricted() { IsolatedStorageFilePermissionAttribute a = new IsolatedStorageFilePermissionAttribute(SecurityAction.Assert); a.Unrestricted = true; IsolatedStorageFilePermission perm = (IsolatedStorageFilePermission)a.CreatePermission(); Assert.IsTrue(perm.IsUnrestricted(), "CreatePermission.IsUnrestricted"); Assert.AreEqual(IsolatedStorageContainment.UnrestrictedIsolatedStorage, perm.UsageAllowed, "CreatePermission.UsageAllowed"); Assert.AreEqual(Int64.MaxValue, perm.UserQuota, "CreatePermission.UserQuota"); }
public void IsSubsetOf() { IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission(PermissionState.None); Assert.IsTrue(empty.IsSubsetOf(null), "empty.IsSubsetOf (null)"); IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission(PermissionState.Unrestricted); Assert.IsFalse(unrestricted.IsSubsetOf(null), "unrestricted.IsSubsetOf (null)"); Assert.IsFalse(unrestricted.IsSubsetOf(empty), "unrestricted.IsSubsetOf (empty)"); Assert.IsTrue(empty.IsSubsetOf(unrestricted), "empty.IsSubsetOf (unrestricted)"); }
private static void DemandAdminPermission() { // Ok if more than one instance is created, no need to sync. if (s_PermAdminUser == null) { s_PermAdminUser = new IsolatedStorageFilePermission( IsolatedStorageContainment.AdministerIsolatedStorageByUser, 0, false); } s_PermAdminUser.Demand(); }
public void FromXml_WrongClass() { IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission(PermissionState.None); SecurityElement se = isfp.ToXml(); SecurityElement w = new SecurityElement(se.Tag); w.AddAttribute("class", "Wrong" + se.Attribute("class")); w.AddAttribute("version", se.Attribute("version")); isfp.FromXml(w); // doesn't care of the class name at that stage // anyway the class has already be created so... }
public void Default() { IsolatedStorageFilePermissionAttribute a = new IsolatedStorageFilePermissionAttribute(SecurityAction.Assert); Assert.AreEqual(IsolatedStorageContainment.None, a.UsageAllowed, "UsageAllowed"); Assert.AreEqual(0, a.UserQuota, "UserQuota"); Assert.AreEqual(a.ToString(), a.TypeId.ToString(), "TypeId"); Assert.IsFalse(a.Unrestricted, "Unrestricted"); IsolatedStorageFilePermission perm = (IsolatedStorageFilePermission)a.CreatePermission(); Assert.AreEqual(IsolatedStorageContainment.None, perm.UsageAllowed, "CreatePermission-UsageAllowed"); Assert.AreEqual(0, perm.UserQuota, "CreatePermission-UserQuota"); }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Copy"]/*' /> public override IPermission Copy() { IsolatedStorageFilePermission copy; copy = new IsolatedStorageFilePermission(PermissionState.Unrestricted); if (!IsUnrestricted()) { copy.m_userQuota = m_userQuota; copy.m_machineQuota = m_machineQuota; copy.m_expirationDays = m_expirationDays; copy.m_permanentData = m_permanentData; copy.m_allowed = m_allowed; } return(copy); }
private void LoadSaveSettings(bool bLoad) { IsolatedStorageFilePermission perm = new IsolatedStorageFilePermission(PermissionState.Unrestricted); perm.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser; if (!SecurityManager.IsGranted(perm)) { return; } IsolatedStorageFileStream stream = null; try { IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly(); if (bLoad) { string[] astr = storage.GetFileNames(ConfigFile); if (astr.Length > 0) { stream = new IsolatedStorageFileStream(ConfigFile, FileMode.Open, FileAccess.Read, FileShare.Read, storage); _props = new PropertyBag(stream); } } else { stream = new IsolatedStorageFileStream(ConfigFile, FileMode.Create, FileAccess.Write, storage); _props.Save(stream); } } catch { } finally { if (stream != null) { stream.Close(); } } }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Intersect"]/*' /> public override IPermission Intersect(IPermission target) { if (target == null) { return(null); } else if (!VerifyType(target)) { throw new ArgumentException( String.Format(Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName) ); } IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target; if (operand.IsUnrestricted()) { return(Copy()); } else if (IsUnrestricted()) { return(target.Copy()); } IsolatedStorageFilePermission intersection; intersection = new IsolatedStorageFilePermission(PermissionState.None); intersection.m_userQuota = min(m_userQuota, operand.m_userQuota); intersection.m_machineQuota = min(m_machineQuota, operand.m_machineQuota); intersection.m_expirationDays = min(m_expirationDays, operand.m_expirationDays); intersection.m_permanentData = m_permanentData && operand.m_permanentData; intersection.m_allowed = (IsolatedStorageContainment)min((long)m_allowed, (long)operand.m_allowed); if ((intersection.m_userQuota == 0) && (intersection.m_machineQuota == 0) && (intersection.m_expirationDays == 0) && (intersection.m_permanentData == false) && (intersection.m_allowed == IsolatedStorageContainment.None)) { return(null); } return(intersection); }
public static void Internet () { PermissionSet ps = CreatePermissionSet ("Internet"); ps.AddPermission (new FileDialogPermission (FileDialogPermissionAccess.Open)); IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None); isfp.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser; isfp.UserQuota = 10240; ps.AddPermission (isfp); ps.AddPermission (new SecurityPermission (SecurityPermissionFlag.Execution)); ps.AddPermission (new UIPermission (UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard)); ps.AddPermission (new PrintingPermission (PrintingPermissionLevel.SafePrinting)); Save ("internet.xml", ps); }
static void Main (string[] args) { long quota = 0; if (args.Length > 0) quota = Convert.ToInt64 (args [0]); IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None); isfp.UserQuota = quota; try { isfp.Demand (); Console.WriteLine ("Quota accepted for {0}.", quota); } catch (SecurityException se) { Console.WriteLine ("Quota refused for {0}\n{1}", quota, se); } catch (Exception e) { Console.WriteLine ("Error checking quota for {0}\n{1}", quota, e); } }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Intersect"]/*' /> public override IPermission Intersect(IPermission target) { if (target == null) return null; else if (!VerifyType(target)) { throw new ArgumentException( String.Format(Environment.GetResourceString("Argument_WrongType"), this.GetType().FullName) ); } IsolatedStorageFilePermission operand = (IsolatedStorageFilePermission)target; if(operand.IsUnrestricted()) return Copy(); else if(IsUnrestricted()) return target.Copy(); IsolatedStorageFilePermission intersection; intersection = new IsolatedStorageFilePermission( PermissionState.None ); intersection.m_userQuota = min(m_userQuota,operand.m_userQuota); intersection.m_machineQuota = min(m_machineQuota,operand.m_machineQuota); intersection.m_expirationDays = min(m_expirationDays,operand.m_expirationDays); intersection.m_permanentData = m_permanentData && operand.m_permanentData; intersection.m_allowed = (IsolatedStorageContainment)min((long)m_allowed,(long)operand.m_allowed); if ((intersection.m_userQuota == 0) && (intersection.m_machineQuota == 0) && (intersection.m_expirationDays == 0) && (intersection.m_permanentData == false) && (intersection.m_allowed == IsolatedStorageContainment.None)) return null; return intersection; }
/// <include file='doc\IsolatedStorageFilePermission.uex' path='docs/doc[@for="IsolatedStorageFilePermission.Copy"]/*' /> public override IPermission Copy() { IsolatedStorageFilePermission copy ; copy = new IsolatedStorageFilePermission(PermissionState.Unrestricted); if(!IsUnrestricted()){ copy.m_userQuota = m_userQuota; copy.m_machineQuota = m_machineQuota; copy.m_expirationDays = m_expirationDays; copy.m_permanentData = m_permanentData; copy.m_allowed = m_allowed; } return copy; }