Kaynağa Gözat

Added a few more objects.

svn path=/trunk/mcs/; revision=422
Miguel de Icaza 24 yıl önce
ebeveyn
işleme
825f207690

+ 65 - 0
mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs

@@ -0,0 +1,65 @@
+//
+// System.Runtime.Remoting.ObjRef.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+//
+// FIXME: This is just a skeleton for practical purposes.
+//
+
+using System;
+
+namespace System.Runtime.Remoting {
+
+	public class ObjRef : IObjectReference, ISerializable {
+		MarshalByRefObject mbr;
+		SerializationInfo si;
+		Type type;
+		
+		public ObjRef ()
+		{
+		}
+		
+		public ObjRef (MarshalByRefObject mbr, Type type)
+		{
+			this.mbr = mbr;
+			this.type = type;
+		}
+
+		public ObjRef (SerializationInfo si, StreamingContext sc)
+		{
+			// FIXME: Implement.
+			//
+			// This encarnates the object from serialized data.
+		}
+
+		public virtual void GetObjectData (SerializationInfo si, StreamingContext sc)
+		{
+			// FIXME:
+		}
+
+		public virtual object GetRealObject (StreamingContext sc)
+		{
+			// FIXME:
+			
+			return null;
+		}
+
+		public bool IsFromThisAppDomain ()
+		{
+			// FIXME:
+			
+			return true;
+		}
+
+		public bool IsFromThisProcess ()
+		{
+			// FIXME:
+			
+			return true;
+		}
+	}
+}

+ 16 - 0
mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs

@@ -0,0 +1,16 @@
+//
+// System.Runtime.Serialization.IObjectReference.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+	public interface IObjectReference {
+		object GetRealObject (StreamingContext context);
+	}
+}
+

+ 59 - 0
mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs

@@ -0,0 +1,59 @@
+//
+// System.Runtime.Serialization.StreamingContext.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+	public struct StreamingContext {
+		StreamingContextStates state;
+		object additional;
+		
+		public StreamingContext (StreamingContextStates state)
+		{
+			this.state = state;
+			additional = null;
+		}
+
+		public StreamingContext (StreamingContextStates state, object additional)
+		{
+			this.state = state;
+			this.additional = additional;
+		}
+
+		public object Context {
+			get {
+				return additional;
+			}
+		}
+
+		public StreamingContextStates {
+			get {
+				return state;
+			}
+		}
+
+		public bool Equals (Object o)
+		{
+			StreamingContext other;
+			
+			if (!(o is StreamingContext))
+				return false;
+
+			other = (StreamingContext) o;
+
+			return (other.state == this.state) && (other.additional == this.additional);
+		}
+
+		public int GetHashCode ()
+		{
+			// FIXME: Improve this?  Is this worth it?
+			
+			return o.GetHashCode ();
+		}
+	}
+}

+ 23 - 0
mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs

@@ -0,0 +1,23 @@
+//
+// System.Runtime.Serialization.StreamingContextStates.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+	public enum StreamingContextStates {
+		All,
+		Clone,
+		CrossAppDomain,
+		CrossMachine,
+		CrossProcess,
+		File,
+		Other,
+		Persistence,
+		Remoting
+	}
+}

+ 29 - 0
mcs/class/corlib/System/MarshalByRefObject.cs

@@ -0,0 +1,29 @@
+//
+// System.MarshalByRefObject.cs
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) Ximian, Inc.  http://www.ximian.com
+//
+
+namespace System {
+
+	public abstract class MarshalByRefObject {
+
+		public virtual ObjRef CreateObjRef (Type type)
+		{
+			return null;
+		}
+
+		public object GetLifeTimeService ()
+		{
+			return null;
+		}
+
+		public virtual object InitializeLifeTimeService ()
+		{
+			return null;
+		}
+	}
+}