public void NativeStringCopyFrom(String s, CopyError expectedError) { NativeString64 ns = new NativeString64(); var error = ns.CopyFrom(s); Assert.AreEqual(expectedError, error); }
public void ReadNativeString(ref NativeString64 nativeString, int maxLength = 64) { ValidateSchema(NetworkSchema.FieldType.String, 0, false, maxLength); uint count = m_Input[m_Position++]; GameDebug.Assert(count <= maxLength); byte *data = (byte *)(m_Input + m_Position); m_Position += maxLength / 4; nativeString.LengthInBytes = 0; if (count == 0) return; fixed(char *dest = s_CharBuffer) { var numChars = NetworkConfig.encoding.GetChars(data, (int)count, dest, s_CharBuffer.Length); nativeString.CopyFrom(dest, (ushort)numChars); } }