コード例 #1
0
 //public void WriteString2(byte[] s) { WriteString(JSConvertEx.BytesToString(s).Trim()); }
 public void WriteString(string s)
 {
     if (s == null)
     {
         s = string.Empty;
     }
     Append(JSConvert.StringToBytes(s));
     WriteByte(0);
     //Com.dprintln("MSG.WriteString:" + s.replace('\0', '@'));
 }
コード例 #2
0
        public void Print(string data2)
        {
            //Com.dprintln("SZ.print():<" + data2 + ">");
            int length = data2.Length;

            byte[] str = JSConvert.StringToBytes(data2);
            if (Length != 0)
            {
                if (Data[Length - 1] != 0)
                {
                    JSArrayEx.Copy(str, 0, Data, GetSpace(length + 1), length);
                }
                else
                {
                    JSArrayEx.Copy(str, 0, Data, GetSpace(length) - 1, length);
                }
            }
            else
            {
                // first print.
                JSArrayEx.Copy(str, 0, Data, GetSpace(length), length);
            }
            Data[Length - 1] = 0;
        }