Esempio n. 1
0
 public static MsgPack Write(this MsgPack mp, string file, bool JSON = false)
 {
     if (JSON)
     {
         JSONIO IO = new JSONIO(File.OpenWriter(file + ".json", true));
         IO.Write(mp, "\n", "  ").Close(); IO = null;
     }
     else
     {
         MPIO IO = new   MPIO(File.OpenWriter(file + ".mp", true));
         IO.Write(mp).Close(); IO = null;
     }
     return(mp);
 }
Esempio n. 2
0
 public static MsgPack WriteAfterAll(this MsgPack mp, string file, bool JSON = false)
 {
     byte[] data = null;
     if (JSON)
     {
         JSONIO IO = new JSONIO(File.OpenWriter());
         IO.Write(mp, true); data = IO.ToArray(true);
     }
     else
     {
         MPIO IO = new   MPIO(File.OpenWriter());
         IO.Write(mp); data = IO.ToArray(true);
     }
     File.WriteAllBytes(file + (JSON ? ".json" : ".mp"), data);
     return(mp);
 }