예제 #1
0
        public PlanetServerHub()
        {
            if (satellites == null)
            {
                satellites = new List <SatelliteClient>();
            }

            if (statusesToDump == null)
            {
                statusesToDump = new Queue <Status>();
            }

            if (clientsToDump == null)
            {
                clientsToDump = new Queue <SatelliteClient>();
            }

            if (shiftThread == null)
            {
                shiftThread = NetworkShiftThread.Instance;
                NetworkShiftThread.SetPlanetServerHubInstance(this);
                Thread t = new Thread(shiftThread.DoWork);
                t.Start();
            }

            if (updateDumper == null)
            {
                updateDumper = ArchiveUpdates.Instance;
                ArchiveUpdates.SetPlanetServerHubInstance(this);
                Thread t = new Thread(updateDumper.DoWork);
                t.Start();
            }
        }
예제 #2
0
        public void RegisterSatellite(string status)
        {
            Status s = Utilities.DeserializeStatus(status);

            if (!satellites.Exists(x => x.SatelliteName.Equals(s.SatelliteName)))
            {
                SatelliteClient sc = new SatelliteClient(s.SatelliteName, s.onStation, s.solarPanelsDeployed);

                clientsToDump.Enqueue(sc);
                satellites.Add(sc);
                NetworkShiftThread.AddSatellite(sc);
            }
        }