protected static void WriteString(BinaryWriter bw, string s) { byte[] b = new byte[s.Length]; for (int i = 0; i < s.Length; i++) b[i] = (byte)s[i]; bw.Write(b, 0, s.Length); }