Пример #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);
 }
Пример #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);
 }
Пример #3
0
        public static MsgPack ReadMPAllAtOnce(this string file, bool JSON = false)
        {
            MsgPack MsgPack;

            if (JSON)
            {
                JSONIO IO = new JSONIO(File.OpenReader(file + ".json", true));
                MsgPack = IO.Read(); IO.Close(); IO = null;
            }
            else
            {
                MPIO IO = new   MPIO(File.OpenReader(file + ".mp", true));
                MsgPack = IO.Read(); IO.Close(); IO = null;
            }
            return(MsgPack);
        }