public static void WriteByteArray(Stream fs, byte[] bytes) { if (bytes == null) { bytes = new byte[0]; } FileSerializeHelper.WriteInt32(fs, bytes.Length); FileSerializeHelper.WriteBytes(fs, bytes); }
public static void WriteString(Stream fs, string str) { if (str == null) { str = string.Empty; } byte[] bytes = Encoding.Unicode.GetBytes(str); FileSerializeHelper.WriteInt32(fs, bytes.Length); FileSerializeHelper.WriteBytes(fs, bytes); }