Ejemplo n.º 1
1
 public static object Dump(WriterSites/*!*/ sites, RubyModule/*!*/ self, object obj, [NotNull]RubyIO/*!*/ io, [Optional]int? limit)
 {
     BinaryWriter writer = io.GetBinaryWriter();
     MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);
     dumper.Dump(obj);
     return io;
 }
Ejemplo n.º 2
0
        public static byte[] GetBytes(object o, int version)
        {
            MarshalWriter mw = new MarshalWriter(version);

            mw.WriteObject(o);
            return(mw.GetBytes());
        }
Ejemplo n.º 3
0
        static byte[] ObjectToBytes(object o)
        {
            MarshalWriter mw = new MarshalWriter();

            mw.WriteObject(o);
            return(mw.GetBytes());
        }
Ejemplo n.º 4
0
        public static object Dump(WriterSites /*!*/ sites, RubyModule /*!*/ self, object obj, [NotNull] RubyIO /*!*/ io, [Optional] int?limit)
        {
            BinaryWriter  writer = io.GetBinaryWriter();
            MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);

            dumper.Dump(obj);
            return(io);
        }
Ejemplo n.º 5
0
 public static MutableString Dump(WriterSites/*!*/ sites, RubyModule/*!*/ self, object obj, int limit)
 {
     MemoryStream buffer = new MemoryStream();
     BinaryWriter writer = new BinaryWriter(buffer);
     MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);
     dumper.Dump(obj);
     return MutableString.CreateBinary(buffer.ToArray());
 }
Ejemplo n.º 6
0
        public static MutableString Dump(WriterSites /*!*/ sites, RubyModule /*!*/ self, object obj, int limit)
        {
            MemoryStream  buffer = new MemoryStream();
            BinaryWriter  writer = new BinaryWriter(buffer);
            MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);

            dumper.Dump(obj);
            return(MutableString.CreateBinary(buffer.ToArray()));
        }
Ejemplo n.º 7
0
                internal SubclassData(MarshalWriter /*!*/ marshaller, object /*!*/ obj, Type type)
                {
                    RubyClass libClass = marshaller._context.GetClass(type);
                    RubyClass theClass = marshaller._context.GetClassOf(obj);

                    if (libClass != theClass && !(obj is RubyStruct))
                    {
                        marshaller._writer.Write((byte)'C');
                        marshaller.WriteSymbol(theClass.Name);
                    }
                }
Ejemplo n.º 8
0
        public static object Dump(RubyModule /*!*/ self, object obj, object io, [Optional] int?limit)
        {
            Stream stream = null;

            if (io != null)
            {
                stream = new IOWrapper(self.Context, io, FileAccess.Write);
            }
            if (stream == null || !stream.CanWrite)
            {
                throw RubyExceptions.CreateTypeError("instance of IO needed");
            }

            BinaryWriter  writer = new BinaryWriter(stream);
            MarshalWriter dumper = new MarshalWriter(writer, self.Context, limit);

            dumper.Dump(obj);
            return(io);
        }
Ejemplo n.º 9
0
        public static object Dump(WriterSites/*!*/ sites, RespondToStorage/*!*/ respondToStorage, 
            RubyModule/*!*/ self, object obj, object io, [Optional]int? limit) {
            Stream stream = null;
            if (io != null) {
                stream = RubyIOOps.CreateIOWrapper(respondToStorage, io, FileAccess.Write);
            }
            if (stream == null || !stream.CanWrite) {
                throw RubyExceptions.CreateTypeError("instance of IO needed");
            }

            BinaryWriter writer = new BinaryWriter(stream);
            MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);
            dumper.Dump(obj);
            return io;
        }
Ejemplo n.º 10
0
                internal SubclassData(MarshalWriter/*!*/ marshaller, object/*!*/ obj, Type type) {
                    RubyClass libClass = marshaller._context.GetClass(type);
                    RubyClass theClass = marshaller._context.GetClassOf(obj);

                    if (libClass != theClass && !(obj is RubyStruct)) {
                        marshaller._writer.Write((byte)'C');
                        marshaller.WriteSymbol(theClass.Name);
                    }
                }
Ejemplo n.º 11
0
 public static byte[] GetBytes (object o, int version) {
     MarshalWriter mw = new MarshalWriter (version);
     mw.WriteObject (o);
     return mw.GetBytes ();
 }
Ejemplo n.º 12
0
 static byte[] ObjectToBytes(object o)
 {
     MarshalWriter mw = new MarshalWriter();
     mw.WriteObject(o);
     return mw.GetBytes();
 }