public static void UpdateBoddy(Serverb _serv) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); using (JsonWriter writer = new JsonTextWriter(sw)) { writer.Formatting = Formatting.None; writer.WriteStartArray(); writer.WriteValue((int)ServerOpcode.channel_players); writer.WriteStartArray(); foreach (UserManager.UserClass _user in Program.Users) { writer.WriteValue(_user.user_id); writer.WriteValue(_user.Name); writer.WriteValue(_user.rank); writer.WriteValue(_user.unk0); } writer.WriteEndArray(); writer.WriteEndArray(); } _serv.Broadcast(sb.ToString()); }
public static void SendList(Serverb _serv) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); using (JsonWriter writer = new JsonTextWriter(sw)) { writer.Formatting = Formatting.None; writer.WriteStartArray(); writer.WriteValue((int)ServerOpcode.rooms_list); writer.WriteStartArray(); foreach (Chanel _cha in Program.Chanels) { writer.WriteStartArray(); writer.WriteValue(_cha._chanel_id); writer.WriteValue(_cha._chanel_name); writer.WriteValue(_cha._chanel_useronli); writer.WriteValue(_cha._chanel_maxplayers); writer.WriteValue(_cha._chanel_status); writer.WriteValue(_cha._chanel_gamemode); writer.WriteValue(_cha._chanel_look); writer.WriteValue(_cha._chanel_map); writer.WriteValue(_cha._chanel_poweruse); writer.WriteEndArray(); } writer.WriteEndArray(); writer.WriteValue(0); writer.WriteValue(0); writer.WriteEndArray(); } _serv.Send(sb.ToString()); }