public PyPacket CreateEmptySessionChange() { // Fill all the packet data, except the dest/source SessionChangeNotification scn = new SessionChangeNotification(); scn.changes = Session.EncodeChanges(); if (scn.changes.Dictionary.Count == 0) { // Nothing to do return(null); } Dictionary <int, Connection> nodes = ConnectionManager.Nodes; // Add all the nodeIDs foreach (KeyValuePair <int, Connection> node in nodes) { scn.nodesOfInterest.Items.Add(new PyInt(node.Key)); } PyPacket p = new PyPacket(); p.type_string = "macho.SessionChangeNotification"; p.type = Macho.MachoNetMsg_Type.SESSIONCHANGENOTIFICATION; p.userID = (uint)AccountID; p.payload = scn.Encode().As <PyTuple>(); p.named_payload = new PyDict(); p.named_payload.Set("channel", new PyString("sessionchange")); return(p); }
public PyPacket CreateEmptySessionChange() { // Fill all the packet data, except the dest/source SessionChangeNotification scn = new SessionChangeNotification(); scn.changes = session.EncodeChanges(); if (scn.changes.Dictionary.Count == 0) { // Nothing to do return(null); } // Add all the nodeIDs foreach (int node in NodeManager.nodes.Keys) { if (node == 0) { continue; } scn.nodesOfInterest.Items.Add(new PyInt(node)); } PyPacket p = new PyPacket(); p.type_string = "macho.SessionChangeNotification"; p.type = Macho.MachoNetMsg_Type.SESSIONCHANGENOTIFICATION; p.userID = (uint)ClientManager.GetClientID(this); p.payload = scn.Encode().As <PyTuple>(); p.named_payload = new PyDict(); p.named_payload.Set("channel", new PyString("sessionchange")); return(p); }