예제 #1
0
 public void ToFile(string path, JsonComposeSettings settings = null)
 {
     using (var writer = new JsonWriter(path, settings == null ? new JsonComposeSettings() : settings))
     {
         Compose(writer);
     }
 }
예제 #2
0
        private void ToStream(Stream stream, JsonComposeSettings settings)
        {
#if NET45
            using (var writer = new JsonWriter(stream, settings, 1024, true))
            {
                Compose(writer);
            }
#else
            using (var writer = new JsonWriter(stream, settings))
            {
                Compose(writer);
            }
#endif
        }
예제 #3
0
        public byte[] ToBytes(JsonComposeSettings settings)
        {
#if NET45
            using (var stream = new MemoryStream())
#else
            using (var stream = new MyMemoryStream())
#endif
            {
                ToStream(stream, settings);
                stream.Position = 0;
                var bytes = stream.ToArray();
#if !NET45
                stream.ReallyClose();
#endif
                return(bytes);
            }
        }
예제 #4
0
        public string ToString(JsonComposeSettings settings)
        {
#if NET45
            using (var stream = new MemoryStream())
#else
            using (var stream = new MyMemoryStream())
#endif
            {
                ToStream(stream, settings);
                stream.Position = 0;
                var result = settings.Encoding.GetString(stream.ToArray());
#if !NET45
                stream.ReallyClose();
#endif
                return(result);
            }
        }
예제 #5
0
 public JsonWriter(string path, JsonComposeSettings settings, bool append, int bufferSize) : base(path, append, settings.Encoding, bufferSize)
 {
     _settings = new JsonComposeSettings();
 }
예제 #6
0
 public JsonWriter(string path, JsonComposeSettings settings) : base(path, false, settings.Encoding)
 {
     _settings = settings;
 }
예제 #7
0
 public JsonWriter(Stream stream, JsonComposeSettings settings, int bufferSize, bool leaveOpen) : base(stream, settings.Encoding, bufferSize, leaveOpen)
 {
     _settings = settings;
 }
예제 #8
0
 public JsonWriter(Stream stream, JsonComposeSettings settings) : base(stream, settings.Encoding)
 {
     _settings = settings;
 }
예제 #9
0
 public JsonWriter(string path, bool append, Encoding encoding) : base(path, append, encoding)
 {
     _settings = new JsonComposeSettings();
 }
예제 #10
0
 public JsonWriter(string path, bool append) : base(path, append)
 {
     _settings = new JsonComposeSettings();
 }
예제 #11
0
 public JsonWriter(string path) : base(path)
 {
     _settings = new JsonComposeSettings();
 }
예제 #12
0
 public JsonWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen) : base(stream, encoding, bufferSize, leaveOpen)
 {
     _settings = new JsonComposeSettings();
 }
예제 #13
0
 public JsonWriter(Stream stream, Encoding encoding) : base(stream, encoding)
 {
     _settings = new JsonComposeSettings();
 }
예제 #14
0
 public JsonWriter(Stream stream) : base(stream)
 {
     _settings = new JsonComposeSettings();
 }