Esempio 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;
 }
Esempio n. 2
0
        public static byte[] GetBytes(object o, int version)
        {
            MarshalWriter mw = new MarshalWriter(version);

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

            mw.WriteObject(o);
            return(mw.GetBytes());
        }
Esempio 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);
        }
Esempio 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());
 }
Esempio 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()));
        }
Esempio 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);
                    }
                }
Esempio 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);
        }
Esempio 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;
        }
Esempio 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);
                    }
                }
Esempio n. 11
0
 public static byte[] GetBytes (object o, int version) {
     MarshalWriter mw = new MarshalWriter (version);
     mw.WriteObject (o);
     return mw.GetBytes ();
 }
Esempio n. 12
0
 static byte[] ObjectToBytes(object o)
 {
     MarshalWriter mw = new MarshalWriter();
     mw.WriteObject(o);
     return mw.GetBytes();
 }