static int GetByteSize(string str) { if (ScriptUtils.IsKatakana(str)) { return(str.Length); } return(GetByteCount(str)); }
int Put(int index, string value) { bool katakana = ScriptUtils.IsKatakana(value); byte[] bytes; short length; if (katakana) { bytes = GetKatakanaBytes(value); length = (short)(bytes.Length | KatakanaFlag & 0xffff); } else { bytes = GetBytes(value); length = (short)bytes.Length; } Buffer.WriteInt16(index, length); System.Buffer.BlockCopy(bytes, 0, Buffer, index + ShortBytes, bytes.Length); return(index + ShortBytes + bytes.Length); }