Example #1
0
        public static byte[] ReadByteArray(Stream fs)
        {
            int bytesLength = FileSerializeHelper.ReadInt32(fs);

            if (bytesLength > 0)
            {
                return(FileSerializeHelper.ReadBytes(fs, bytesLength));
            }
            else
            {
                return(new byte[0]);
            }
        }
Example #2
0
        public static string ReadString(Stream fs)
        {
            int bytesLength = FileSerializeHelper.ReadInt32(fs);

            if (bytesLength > 0)
            {
                byte[] bytes = FileSerializeHelper.ReadBytes(fs, bytesLength);
                return(Encoding.Unicode.GetString(bytes, 0, bytesLength));
            }
            else
            {
                return(string.Empty);
            }
        }