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; }
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); }
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()); }
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())); }
internal MarshalWriter(WriterSites /*!*/ sites, BinaryWriter /*!*/ writer, RubyContext /*!*/ context, int?limit) { Assert.NotNull(sites, writer, context); _sites = sites; _writer = writer; _context = context; _recursionLimit = (limit.HasValue ? limit.Value : -1); _symbols = new Dictionary <string, int>(); _objects = new Dictionary <object, int>(ReferenceEqualityComparer.Instance); }
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); }
public static MutableString Dump(WriterSites /*!*/ sites, RubyModule /*!*/ self, object obj) { return(Dump(sites, self, obj, -1)); }
internal MarshalWriter(WriterSites/*!*/ sites, BinaryWriter/*!*/ writer, RubyContext/*!*/ context, int? limit) { Assert.NotNull(sites, writer, context); _sites = sites; _writer = writer; _context = context; _recursionLimit = (limit.HasValue ? limit.Value : -1); _symbols = new Dictionary<string, int>(); _encodingNames = new Dictionary<RubyEncoding, MutableString>(); _objects = new Dictionary<object, int>(ReferenceEqualityComparer<object>.Instance); }
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; }
public static MutableString Dump(WriterSites/*!*/ sites, RubyModule/*!*/ self, object obj) { return Dump(sites, self, obj, -1); }
internal MarshalWriter(WriterSites/*!*/ sites, BinaryWriter/*!*/ writer, RubyContext/*!*/ context, int? limit) { Assert.NotNull(sites, writer, context); _sites = sites; _writer = writer; _context = context; _recursionLimit = (limit.HasValue ? limit.Value : -1); _symbols = new Dictionary<string, int>(); _objects = new Dictionary<object, int>(ReferenceEqualityComparer.Instance); #if !SILVERLIGHT _streamingContext = new StreamingContext(StreamingContextStates.Other, _context); #endif }