public override String HandlePacket(WSClient client)
 {
     if (client.hasRegistered)
     {
         if (this.subID == "" || this.subID == null)
         {
             if (this.sendEvents)
             {
                 EventSubscriptions.subscribeClient((KSPEvents)this.eNum, client.ID);
                 if (this.cached)
                 {
                     String cachedEvent = EventSubscriptions.getLastEvent((KSPEvents)this.eNum);
                     if (cachedEvent != "") return cachedEvent;
                 }
             }
             else EventSubscriptions.unsubscribeClient((KSPEvents)this.eNum, client.ID);
         }
         else
         {
             if (this.sendEvents)
             {
                 SubEventSubscriptions.subscribeClient((KSPEvents)this.eNum, client.ID, this.subID);
                 if (this.cached)
                 {
                     String cachedEvent = SubEventSubscriptions.getLastEvent((KSPEvents)this.eNum, this.subID);
                     if (cachedEvent != "") return cachedEvent;
                 }
             }
             else SubEventSubscriptions.unsubscribeClient((KSPEvents)this.eNum, client.ID, this.subID);
         }
     }
     return "";
 }
 // t = 2
 public override String HandlePacket(WSClient client)
 {
     if (client.hasRegistered)
     {
         if (FlightGlobals.ActiveVessel != null) Staging.ActivateNextStage();
     }
     return "";
 }
 public virtual String HandlePacket(WSClient client)
 {
     return "";
 }
        public override String HandlePacket(WSClient client)
        {
            if (client.hasRegistered)
            {
                if (FlightGlobals.ready)
                {
                    List<VesselData> vesselData = new List<VesselData>();
                    foreach (Vessel v in FlightGlobals.Vessels)
                    {
                        VesselData vd = new VesselData();
                        vd.name = v.vesselName;
                        vd.ID = v.id.ToString();
                        vd.missionTime = v.missionTime;
                        vd.launchTime = v.launchTime;
                        vd.type = v.vesselType.ToString();
                        vd.landedOrSplashed = v.LandedOrSplashed;
                        vesselData.Add(vd);
                    }
                    KSPAlternateController.print(ID);

                    return new VesselDataResponse(ID, vesselData).toJson();
                }
                else return new DataNotAvailable(ID).toJson();
            }
            return "";
        }
 // t = 6
 public override String HandlePacket(WSClient client)
 {
     if (client.hasRegistered)
     {
         KSPAlternateController.addToList(ID, client, url);
     }
     return "";
 }
 public override String HandlePacket(WSClient client)
 {
     if (this.password != null)
     {
         if (this.password == KSPAlternateController.password)
         {
             client.hasRegistered = true;
             return new ConnectionAccepted(ID).toJson();
         }
     }
     return new IncorrectPassword(ID).toJson();
 }
Ejemplo n.º 7
0
 public override String HandlePacket(WSClient client)
 {
     if (client.hasRegistered)
     {
         FlightInputHandler.state.fastThrottle = (float)s;
         FlightInputHandler.state.mainThrottle = (float)s;
         FlightGlobals.ActiveVessel.ctrlState.mainThrottle = (float)s;
     }
     return "";
 }
Ejemplo n.º 8
0
 public static void addToList(String ID, WSClient client, String url)
 {
     HttpRequestThreadPool newObj = new HttpRequestThreadPool(ID, client, url);
     ThreadPool.QueueUserWorkItem(newObj.processReponse);
 }
 public HttpRequestThreadPool(String ID, WSClient client, String URL)
 {
     this.ID = ID;
     this.client = client;
     this.URL = URL;
 }