/// <summary>确定指定的 <see cref="T:System.Security.AccessControl.GenericAce" /> 对象是否等同于当前的 <see cref="T:System.Security.AccessControl.GenericAce" />。</summary> /// <returns>如果指定的 <see cref="T:System.Security.AccessControl.GenericAce" /> 对象等于当前的 <see cref="T:System.Security.AccessControl.GenericAce" /> 对象,则为 true;否则为 false。</returns> /// <param name="o">要与当前 <see cref="T:System.Security.AccessControl.GenericAce" /> 对象进行比较的 <see cref="T:System.Security.AccessControl.GenericAce" /> 对象。</param> public override sealed bool Equals(object o) { if (o == null) { return(false); } GenericAce genericAce = o as GenericAce; if (genericAce == (GenericAce)null || this.AceType != genericAce.AceType || this.AceFlags != genericAce.AceFlags) { return(false); } int binaryLength1 = this.BinaryLength; int binaryLength2 = genericAce.BinaryLength; if (binaryLength1 != binaryLength2) { return(false); } byte[] binaryForm1 = new byte[binaryLength1]; byte[] binaryForm2 = new byte[binaryLength2]; this.GetBinaryForm(binaryForm1, 0); genericAce.GetBinaryForm(binaryForm2, 0); for (int index = 0; index < binaryForm1.Length; ++index) { if ((int)binaryForm1[index] != (int)binaryForm2[index]) { return(false); } } return(true); }
public override void GetBinaryForm(byte[] binaryForm, int offset) { this.MarshalHeader(binaryForm, offset); offset += 8; for (int i = 0; i < this.Count; i++) { GenericAce ace = this._aces[i] as GenericAce; ace.GetBinaryForm(binaryForm, offset); int binaryLength = ace.BinaryLength; if ((binaryLength % 4) != 0) { throw new SystemException(); } offset += binaryLength; } }
/// <summary>将 <see cref="T:System.Security.AccessControl.RawAcl" /> 对象的内容封送到指定字节数组中,其位置从指定的偏移量开始。</summary> /// <param name="binaryForm">将 <see cref="T:System.Security.AccessControl.RawAcl" /> 的内容封送到的字节数组。</param> /// <param name="offset">开始封送的偏移量。</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="offset" /> 如果为负数或过高,则会将整个 <see cref="T:System.Security.AccessControl.RawAcl" /> 复制到 <paramref name="array" />。</exception> public override void GetBinaryForm(byte[] binaryForm, int offset) { this.MarshalHeader(binaryForm, offset); offset += 8; for (int index = 0; index < this.Count; ++index) { GenericAce genericAce = this._aces[index] as GenericAce; byte[] binaryForm1 = binaryForm; int offset1 = offset; genericAce.GetBinaryForm(binaryForm1, offset1); int binaryLength = genericAce.BinaryLength; if (binaryLength % 4 != 0) { throw new SystemException(); } offset += binaryLength; } }
/// <summary>Determines whether the specified <see cref="T:System.Security.AccessControl.GenericAce" /> object is equal to the current <see cref="T:System.Security.AccessControl.GenericAce" /> object.</summary> /// <param name="o">The <see cref="T:System.Security.AccessControl.GenericAce" /> object to compare to the current <see cref="T:System.Security.AccessControl.GenericAce" /> object.</param> /// <returns> /// <see langword="true" /> if the specified <see cref="T:System.Security.AccessControl.GenericAce" /> object is equal to the current <see cref="T:System.Security.AccessControl.GenericAce" /> object; otherwise, <see langword="false" />.</returns> // Token: 0x06001E51 RID: 7761 RVA: 0x00069F24 File Offset: 0x00068124 public sealed override bool Equals(object o) { if (o == null) { return(false); } GenericAce genericAce = o as GenericAce; if (genericAce == null) { return(false); } if (this.AceType != genericAce.AceType || this.AceFlags != genericAce.AceFlags) { return(false); } int binaryLength = this.BinaryLength; int binaryLength2 = genericAce.BinaryLength; if (binaryLength != binaryLength2) { return(false); } byte[] array = new byte[binaryLength]; byte[] array2 = new byte[binaryLength2]; this.GetBinaryForm(array, 0); genericAce.GetBinaryForm(array2, 0); for (int i = 0; i < array.Length; i++) { if (array[i] != array2[i]) { return(false); } } return(true); }
public sealed override bool Equals(object o) { if (o == null) { return(false); } GenericAce ace = o as GenericAce; if (ace == null) { return(false); } if ((this.AceType != ace.AceType) || (this.AceFlags != ace.AceFlags)) { return(false); } int binaryLength = this.BinaryLength; int num2 = ace.BinaryLength; if (binaryLength != num2) { return(false); } byte[] binaryForm = new byte[binaryLength]; byte[] buffer2 = new byte[num2]; this.GetBinaryForm(binaryForm, 0); ace.GetBinaryForm(buffer2, 0); for (int i = 0; i < binaryForm.Length; i++) { if (binaryForm[i] != buffer2[i]) { return(false); } } return(true); }
static GenericAce CopyAce(GenericAce ace) { byte[] binaryForm = new byte[ace.BinaryLength]; ace.GetBinaryForm(binaryForm, 0); return(GenericAce.CreateFromBinaryForm(binaryForm, 0)); }