public OctetsStream Marshal(OctetsStream os) { os.Marshal(State); os.Marshal(Msg); os.Marshal(Token); return(os); }
public OctetsStream Marshal(OctetsStream os) { os.Marshal(Aid); os.Marshal(Pid); os.Marshal(SysTime); return(os); }
public OctetsStream Marshal(OctetsStream os) { os.Marshal(State); os.Marshal(Id); os.Marshal(GeneralCheck); os.Marshal(Precondition); return(os); }
public OctetsStream Marshal(OctetsStream os) { MessageResponse.Marshal(os); os.Marshal(LoginStage); os.Marshal(Sex); os.Marshal(Name); os.Compact_uint32(Param.Count); foreach (KeyValuePair <string, int> e in Param) { os.Marshal(e.Key); os.Marshal(e.Value); } os.Compact_uint32(EntitySet.Count); foreach (MessageEntity v in EntitySet) { os.Marshal(v); } os.Compact_uint32(EntityList.Count); foreach (MessageEntity v in EntityList) { os.Marshal(v); } os.Compact_uint32(EntityArray.Length); foreach (MessageEntity v in EntityArray) { os.Marshal(v); } return(os); }
public void MarshalStringTest1() { var marshal = new OctetsStream(); marshal.Marshal("hello"); var m = marshal.Size; }
public void Unmarshal_byteTest() { var marshall = new OctetsStream(); Assert.AreEqual(0, marshall.Size); marshall.Marshal((byte)3); Assert.AreEqual(1, marshall.Size); }
public void MarshalTest() { var marshall = new OctetsStream(); Assert.AreEqual(0, marshall.Size); marshall.Marshal((byte)3); Assert.AreEqual(1, marshall.Size); marshall.Marshal(true); Assert.AreEqual(2, marshall.Size); marshall.Marshal((short)32); Assert.AreEqual(4, marshall.Size); marshall.Marshal('Z'); Assert.AreEqual(6, marshall.Size); marshall.Marshal((int)328); Assert.AreEqual(10, marshall.Size); marshall.Marshal((long)328392); Assert.AreEqual(18, marshall.Size); marshall.Marshal(3.14159f); Assert.AreEqual(22, marshall.Size); marshall.Marshal(38293.3234); Assert.AreEqual(30, marshall.Size); marshall.Compact_uint32(32); Assert.AreEqual(31, marshall.Size); marshall.Compact_uint32(100); Assert.AreEqual(33, marshall.Size); marshall.Compact_sint32(-100); Assert.AreEqual(35, marshall.Size); }
public OctetsStream Marshal(OctetsStream s) { if (this.v1) { s.Marshal2(0x0401); } if (this.v2 != 0) { s.Marshal1((byte)0x08).Marshal(this.v2); } if (this.v3 != 0) { s.Marshal1((byte)0x0c).Marshal(this.v3); } if (this.v4 != 0) { s.Marshal1((byte)0x10).Marshal(this.v4); } if (this.v5 != 0) { s.Marshal1((byte)0x14).Marshal(this.v5); } if (this.v6 != 0) { s.Marshal2(0x1b08).Marshal(this.v6); } if (this.v7 != 0) { s.Marshal2(0x1f09).Marshal(this.v7); } if (this.v8 != null && !this.v8.Empty()) { s.Marshal1((byte)0x21).Marshal(this.v8); } if (!string.IsNullOrEmpty(this.v9)) { s.Marshal1((byte)0x25).Marshal(this.v9); } if (this.v10 != null && this.v10.Count > 0) { s.Marshal2(0x2b00).MarshalUInt(this.v10.Count); foreach (bool e in Util.Enum(this.v10)) { s.Marshal(e); } } if (this.v11 != null && this.v11.Count > 0) { s.Marshal2(0x2f00).MarshalUInt(this.v11.Count); foreach (sbyte e in Util.Enum(this.v11)) { s.Marshal(e); } } if (this.v12 != null && this.v12.Count > 0) { s.Marshal2(0x3300).MarshalUInt(this.v12.Count); foreach (int e in Util.Enum(this.v12)) { s.Marshal(e); } } if (this.v13 != null && this.v13.Count > 0) { s.Marshal2(0x3700).MarshalUInt(this.v13.Count); foreach (long e in Util.Enum(this.v13)) { s.Marshal(e); } } if (this.v14 != null && this.v14.Count > 0) { s.Marshal2(0x3b04).MarshalUInt(this.v14.Count); foreach (float e in Util.Enum(this.v14)) { s.Marshal(e); } } if (this.v15 != null && this.v15.Count > 0) { s.Marshal2(0x3f05).MarshalUInt(this.v15.Count); foreach (double e in Util.Enum(this.v15)) { s.Marshal(e); } } if (this.v16 != null && this.v16.Count > 0) { s.Marshal2(0x4341).MarshalUInt(this.v16.Count); foreach (KeyValuePair <long, string> p in Util.Enum(this.v16)) { s.Marshal(p.Key).Marshal(p.Value); } } if (this.v17 != null && this.v17.Count > 0) { s.Marshal2(0x4750).MarshalUInt(this.v17.Count); foreach (KeyValuePair <TestBean, bool> p in Util.Enum(this.v17)) { s.Marshal(p.Key).Marshal(p.Value); } } if (this.v18 != null && this.v18.Count > 0) { s.Marshal2(0x4b4a).MarshalUInt(this.v18.Count); foreach (KeyValuePair <Octets, TestBean> p in Util.Enum(this.v18)) { s.Marshal(p.Key).Marshal(p.Value); } } if (this.v19 != null) { int n = s.Size(); this.v19.Marshal(s.Marshal1((byte)0x4e)); if (s.Size() - n < 3) { s.Resize(n); } } return(s.Marshal1((byte)0)); }