[Mono-list] Here is my patch for corlib\System.Security.Policy\Evidence.cs

Jackson Harper JRHwork@hotmail.com
Sun, 20 Oct 2002 20:48:53 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_008C_01C2787A.1996C650
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_008D_01C2787A.1996C650"


------=_NextPart_001_008D_01C2787A.1996C650
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Found the attach button this time. :-)~

Here is my patch for corlib\System.Security.Policy\Evidence.cs

Changelog Entry:
Implemented most methods.


------=_NextPart_001_008D_01C2787A.1996C650
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Found the attach button this time.=20
:-)~</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>Here is my=20
patch for corlib\System.Security.Policy\Evidence.cs<BR><BR>Changelog=20
Entry:<BR>Implemented most=20
methods.</FONT><BR></DIV></FONT></FONT></DIV></BODY></HTML>

------=_NextPart_001_008D_01C2787A.1996C650--

------=_NextPart_000_008C_01C2787A.1996C650
Content-Type: application/octet-stream;
	name="Evidence.cs.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Evidence.cs.patch"

Index: Evidence.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mcs/class/corlib/System.Security.Policy/Evidence.cs,v=0A=
retrieving revision 1.4=0A=
diff -u -r1.4 Evidence.cs=0A=
--- Evidence.cs	1 Apr 2002 20:22:40 -0000	1.4=0A=
+++ Evidence.cs	21 Oct 2002 03:15:49 -0000=0A=
@@ -1,27 +1,169 @@=0A=
-// System.Security.Policy.Evidence=0A=
-//=0A=
-// Authors:=0A=
-//  Sean MacIsaac (macisaac@ximian.com)=0A=
-//  Nick Drochak (ndrochak@gol.com)=0A=
-//=0A=
-// (C) 2001 Ximian, Inc.=0A=
-=0A=
-using System.Collections;=0A=
-=0A=
-namespace System.Security.Policy=0A=
-{=0A=
-	[MonoTODO]=0A=
-	[Serializable]=0A=
-	public sealed class Evidence=0A=
-	{=0A=
-		=0A=
-		[MonoTODO]=0A=
-		public Evidence () {=0A=
-		}=0A=
-=0A=
-		[MonoTODO]=0A=
-		public IEnumerator GetHostEnumerator() {=0A=
-			throw new NotImplementedException();=0A=
-		}=0A=
-	}=0A=
-}=0A=
+// System.Security.Policy.Evidence
+//
+// Authors:
+//  Sean MacIsaac (macisaac@ximian.com)
+//  Nick Drochak (ndrochak@gol.com)
+//  Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System;
+using System.Collections;
+
+namespace System.Security.Policy {
+
+	[MonoTODO]
+	public sealed class Evidence : ICollection, IEnumerable {
+
+	=09
+		private ArrayList  mHostEvidenceList      =3D  new ArrayList();=09
+		private ArrayList  mAssemblyEvidenceList  =3D  new ArrayList();
+	=09
+		public Evidence ()=20
+		{
+		}
+
+		public Evidence( Evidence evidence )=20
+		{
+			Merge( evidence );=09
+		}
+
+		public Evidence( object[] hostEvidence, object[] assemblyEvidence )=20
+		{
+			if ( null !=3D hostEvidence )
+				mHostEvidenceList.AddRange( hostEvidence );
+			if ( null !=3D assemblyEvidence )
+				mAssemblyEvidenceList.AddRange( assemblyEvidence );
+		}
+	=09
+		//
+		// Public Properties
+		//
+=09
+		public int Count {
+			get {
+				return ( mHostEvidenceList.Count + mAssemblyEvidenceList.Count );
+			}
+		}
+
+		public bool IsReadOnly {
+			get{
+				return false;
+			}
+		}
+	=09
+		public bool IsSynchronized {
+			get {
+				return false;
+			}
+		}
+
+		[MonoTODO]
+		public bool Locked {
+			get {
+				throw new NotImplementedException();
+			}
+			set {
+				throw new NotImplementedException();
+			}
+		}=09
+
+		public object SyncRoot {
+			get {
+				return this;
+			}
+		}
+
+		//
+		// Public Methods
+		//
+
+		public void AddAssembly( object id )=20
+		{
+			mAssemblyEvidenceList.Add( id );
+		}
+
+		[MonoTODO("If Locked is true and the code that calls this method does =
not have SecurityPermissionFlag.ControlEvidence a SecurityException =
should be thrown")]
+		public void AddHost( object id )=20
+		{
+			mHostEvidenceList.Add( id );
+		}
+
+		public void CopyTo( Array array, int index )=20
+		{
+			if ( mHostEvidenceList.Count > 0 )=20
+				mHostEvidenceList.CopyTo( array, index );
+			if ( mAssemblyEvidenceList.Count > 0 )=20
+				mAssemblyEvidenceList.CopyTo( array, index + =
mHostEvidenceList.Count );
+		}
+
+		public IEnumerator GetEnumerator()=20
+		{
+			return new EvidenceEnumerator( mHostEvidenceList.GetEnumerator(),=20
+						       mAssemblyEvidenceList.GetEnumerator() );
+		}
+
+		public IEnumerator GetAssemblyEnumerator()=20
+		{
+			return mAssemblyEvidenceList.GetEnumerator();
+		}
+
+		public IEnumerator GetHostEnumerator()=20
+		{
+			return mHostEvidenceList.GetEnumerator();
+		}
+
+		public void Merge( Evidence evidence )=20
+		{
+			IEnumerator	hostenum , assemblyenum;
+		=09
+			hostenum =3D evidence.GetHostEnumerator();
+			while( hostenum.MoveNext() ) {
+				AddHost( hostenum.Current );
+			}
+
+			assemblyenum =3D evidence.GetAssemblyEnumerator();
+			while( assemblyenum.MoveNext() ) {
+				AddAssembly( assemblyenum.Current );
+			}
+		}
+=09
+		private class EvidenceEnumerator : IEnumerator {
+		=09
+			private IEnumerator	mCurrentEnum, mHostEnum, mAssemblyEnum;	=09
+=09
+			public EvidenceEnumerator( IEnumerator hostenum, IEnumerator =
assemblyenum )=20
+			{
+				mHostEnum =3D hostenum;
+				mAssemblyEnum =3D assemblyenum;
+				mCurrentEnum =3D mHostEnum;		=09
+			}
+
+			public bool MoveNext()=20
+			{
+				bool 	ret =3D mCurrentEnum.MoveNext();
+			=09
+				if ( !ret && mHostEnum =3D=3D mCurrentEnum ) {
+					mCurrentEnum =3D mAssemblyEnum;
+					ret =3D mAssemblyEnum.MoveNext();
+				}
+
+				return ret;
+			}
+
+			public void Reset()=20
+			{
+				mHostEnum.Reset();
+				mAssemblyEnum.Reset();
+				mCurrentEnum =3D mHostEnum;
+			}
+
+			public object Current {
+				get {
+					return mCurrentEnum.Current;
+				}
+			}
+		}
+
+	}
+}

------=_NextPart_000_008C_01C2787A.1996C650--