Exemple #1
0
 public void ToFile(string path, JsonComposeSettings settings = null)
 {
     using (var writer = new JsonWriter(path, settings == null ? new JsonComposeSettings() : settings))
     {
         Compose(writer);
     }
 }
Exemple #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
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #5
0
 public JsonWriter(string path, JsonComposeSettings settings, bool append, int bufferSize) : base(path, append, settings.Encoding, bufferSize)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #6
0
 public JsonWriter(string path, JsonComposeSettings settings) : base(path, false, settings.Encoding)
 {
     _settings = settings;
 }
Exemple #7
0
 public JsonWriter(Stream stream, JsonComposeSettings settings, int bufferSize, bool leaveOpen) : base(stream, settings.Encoding, bufferSize, leaveOpen)
 {
     _settings = settings;
 }
Exemple #8
0
 public JsonWriter(Stream stream, JsonComposeSettings settings) : base(stream, settings.Encoding)
 {
     _settings = settings;
 }
Exemple #9
0
 public JsonWriter(string path, bool append, Encoding encoding) : base(path, append, encoding)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #10
0
 public JsonWriter(string path, bool append) : base(path, append)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #11
0
 public JsonWriter(string path) : base(path)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #12
0
 public JsonWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen) : base(stream, encoding, bufferSize, leaveOpen)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #13
0
 public JsonWriter(Stream stream, Encoding encoding) : base(stream, encoding)
 {
     _settings = new JsonComposeSettings();
 }
Exemple #14
0
 public JsonWriter(Stream stream) : base(stream)
 {
     _settings = new JsonComposeSettings();
 }