public void Write(ByteArray v) { if (v != null) { ReAlloc(ref data_, pos_, v.Position); byte[] arr = v.GetData(); arr.CopyTo(data_, pos_); } }
public void WriteByteArray(ByteArray v) { if (v != null) { ReAlloc(ref data_, pos_, v.Position); byte[] arr = v.GetData(); Array.Copy(arr, 0, data_, pos_, v.Position); pos_ += v.Position; } }
public void WriteByteArray(ByteArray v) { if (v != null) { ReAlloc(ref this.data, this.pos, v.Position); byte[] arr = v.GetData(); Array.Copy(arr, 0, this.data, this.pos, v.Position); this.pos += v.Position; } }
static public int GetData(IntPtr l) { try { SLua.ByteArray self = (SLua.ByteArray)checkSelf(l); var ret = self.GetData(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
public static int GetData(IntPtr ptr) { try { ByteArray self = (ByteArray)LuaObject.CheckSelf(ptr); byte[] ret = self.GetData(); LuaObject.PushValue(ptr, true); LuaObject.PushValue(ptr, ret); return(2); } catch (Exception e) { return(Error(ptr, e)); } }
public static void ProtobufString(SLua.ByteArray data) { System.IO.MemoryStream ms = new System.IO.MemoryStream(data.GetData(), 0, data.Position); PBMessage.Person person = ProtoTransfer.DeserializeProtoBuf <PBMessage.Person>(ms); Debug.Log("age=" + person.age); Debug.Log("email=" + person.email); Debug.Log("name=" + person.name); Debug.Log("id=" + person.id); var table = SLua.LuaSvr.mainState.getFunction("TestParseProtobuf"); if (table != null) { table.call(data); } }