private int sendOsu(SerializationWriter sw) { bSerializable bPayload = payload as bSerializable; if (type == RequestType.Irc_Only) { return(0); } long sentBytes = 0; //set the position to after the header.. MemoryStream payloadBuffer = (MemoryStream)sw.BaseStream; sw.Seek(HEADER_LEN, SeekOrigin.Begin); int payloadSize = 0; if (bPayload != null) { bPayload.WriteToStream(sw); payloadSize = (int)payloadBuffer.Position - HEADER_LEN; } sw.Seek(0, SeekOrigin.Begin); sw.Write((ushort)type); sw.Write((byte)0); sw.Write((uint)payloadSize); return(HEADER_LEN + payloadSize); }
public Command(short id, object serializable) { this.Id = id; this.noHasData = serializable == null; if (this.noHasData) { this.Serializable = null; this.RegularType = null; return; } this.Serializable = serializable as bSerializable; //If it isn't an bSerializable, then it should be a regulartype this.RegularType = this.Serializable == null ? serializable : null; }
public RequestGeneric(RequestType type, bSerializable payload) { this.type = type; this.payload = payload; }
internal static void SendRequest(RequestType resType, bSerializable obj) { SendRequest(new RequestGeneric(resType, obj)); }