コード例 #1
0
ファイル: JsonValue.cs プロジェクト: porohkun/DexterDefence
 public void ToFile(string path, JsonComposeSettings settings = null)
 {
     using (var writer = new JsonWriter(path, settings == null ? new JsonComposeSettings() : settings))
     {
         Compose(writer);
     }
 }
コード例 #2
0
ファイル: JsonValue.cs プロジェクト: porohkun/DexterDefence
        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
ファイル: JsonValue.cs プロジェクト: porohkun/DexterDefence
        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
ファイル: JsonValue.cs プロジェクト: porohkun/DexterDefence
        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();
 }