X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Runtime.Serialization.Formatters.Binary%2FMessageFormatter.cs;h=8347f04482343753eb869167295202084d2caa72;hb=9e3370d3351358044231dd1f3df5fff3720bdcc2;hp=bfa81699a05df03bd327e78bd3939255d6ceb043;hpb=3989b96cc8c13c1d5c422c241d55b6f7d4de6f7a;p=mono.git diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs index bfa81699a05..8347f044823 100644 --- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs +++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs @@ -5,6 +5,29 @@ // // (C) 2003, Lluis Sanchez Gual // + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// using System; using System.IO; @@ -18,7 +41,7 @@ namespace System.Runtime.Serialization.Formatters.Binary { internal class MessageFormatter { - public static void WriteMethodCall (BinaryWriter writer, object obj, Header[] headers, ISurrogateSelector surrogateSelector, StreamingContext context) + public static void WriteMethodCall (BinaryWriter writer, object obj, Header[] headers, ISurrogateSelector surrogateSelector, StreamingContext context, FormatterAssemblyStyle assemblyFormat) { IMethodCallMessage call = (IMethodCallMessage)obj; writer.Write ((byte) BinaryElement.MethodCall); @@ -83,7 +106,7 @@ namespace System.Runtime.Serialization.Formatters.Binary if ((methodFlags & MethodFlags.PrimitiveArguments) > 0) { writer.Write ((uint)call.Args.Length); - for (int n=0; n 0) - info = resp.OutArgs; + info = resp.Args; if (info != null) { - ObjectWriter objectWriter = new ObjectWriter(surrogateSelector, context); + ObjectWriter objectWriter = new ObjectWriter (surrogateSelector, context, assemblyFormat); objectWriter.WriteObjectGraph (writer, info, headers); } else writer.Write ((byte) BinaryElement.End); } - public static object ReadMethodCall (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, ISurrogateSelector surrogateSelector, StreamingContext context, SerializationBinder binder) + public static object ReadMethodCall (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, BinaryFormatter formatter) { BinaryElement elem = (BinaryElement)reader.ReadByte(); // The element code if (elem != BinaryElement.MethodCall) throw new SerializationException("Invalid format. Expected BinaryElement.MethodCall, found " + elem); @@ -263,7 +286,7 @@ namespace System.Runtime.Serialization.Formatters.Binary if (((BinaryTypeCode)reader.ReadByte()) != BinaryTypeCode.String) throw new SerializationException ("Invalid format"); string className = reader.ReadString(); - bool hasContextInfo = (flags & MethodFlags.IncludesLogicalCallContext) > 0; + //bool hasContextInfo = (flags & MethodFlags.IncludesLogicalCallContext) > 0; object[] arguments = null; object methodSignature = null; @@ -284,7 +307,7 @@ namespace System.Runtime.Serialization.Formatters.Binary if ((flags & MethodFlags.NeedsInfoArrayMask) > 0) { - ObjectReader objectReader = new ObjectReader(surrogateSelector, context, binder); + ObjectReader objectReader = new ObjectReader (formatter); object result; objectReader.ReadObjectGraph (reader, hasHeaders, out result, out headers); @@ -339,7 +362,7 @@ namespace System.Runtime.Serialization.Formatters.Binary return call; } - public static object ReadMethodResponse (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, ISurrogateSelector surrogateSelector, StreamingContext context, SerializationBinder binder) + public static object ReadMethodResponse (BinaryReader reader, bool hasHeaders, HeaderHandler headerHandler, IMethodCallMessage methodCallMessage, BinaryFormatter formatter) { BinaryElement elem = (BinaryElement)reader.ReadByte(); // The element code if (elem != BinaryElement.MethodResponse) throw new SerializationException("Invalid format. Expected BinaryElement.MethodResponse, found " + elem); @@ -382,7 +405,7 @@ namespace System.Runtime.Serialization.Formatters.Binary { // There objects that need to be deserialized using an ObjectReader - ObjectReader objectReader = new ObjectReader(surrogateSelector, context, binder); + ObjectReader objectReader = new ObjectReader (formatter); object result; objectReader.ReadObjectGraph (reader, hasHeaders, out result, out headers); object[] msgInfo = (object[]) result;