private void newConnectionRequest(ConnectionManager.ConnectionInformation connection)
 {
     ConnectionHandeler handeler = new ConnectionHandeler(connection);
     handeler.Disconnection += serverDisconnected;
     AddConnection(handeler);
     handeler.Start();
 }
 private void AddConnection(ConnectionHandeler connection)
 {
     if (!liveConnections.ContainsKey(connection.getIp()))
     {
         liveConnections.Add(connection.getIp(), new List<ConnectionHandeler>());
     }
     liveConnections[connection.getIp()].Add(connection);
 }
 private void RemoveConnection(ConnectionHandeler connection)
 {
     if (liveConnections.ContainsKey(connection.getIp()))
     {
         liveConnections[connection.getIp()].Remove(connection);
         if (liveConnections[connection.getIp()].Count == 0)
             liveConnections.Remove(connection.getIp());
     }
 }
 public LicenseHolder(ConnectionHandeler connectionHandeler)
 {
     details = new ButterflyServerDetails(this);
     this.connectionHandeler = connectionHandeler;
     this.connectionHandeler.addPacketHandeler(ServerOpCode.License_Response, OnLicenseReceived);
     this.connectionHandeler.addPacketHandeler(ServerOpCode.User_count_update, OnUserCountUpdate);
     this.connectionHandeler.addPacketHandeler(ServerOpCode.Query_Result, OnQueryResult);
     this.connectionHandeler.addPacketHandeler(ServerOpCode.Server_Full, OnServerFull);
     this.connectionHandeler.sendPacket(new LicenseRequest());
 }
 public void Dispose()
 {
     if (this.addedToMainListDetails)
     {
         AwsomeLicense.licenseRequester.RemoveActiveLicense(this);
         details.serverDisconnect();
     }
     //Clean up my own shit
     this.connectionHandeler = null;
     this.gettingData = false;
 }
 private void serverDisconnected(ConnectionHandeler handeler)
 {
     RemoveConnection(handeler);
     handeler.Disconnection -= serverDisconnected;
 }