public void SetStations(Station[] InitialStationList)
        {
            this.InitialStationList = InitialStationList;

            FilterStations = InitialStationList.OrderByDescending(o => o.LastSeenDate).ToArray();
            StationList.VirtualListSize = FilterStations.Length;
        }
		public override void Configure(IEnumerable<Recipe> recipes)
		{
			_availableStations = AvailableStations;

			CalculateShortestPaths();

			foreach (var recipe in recipes)
				ConfigureInternal(recipe);
		}
Beispiel #3
0
        public Sector(string id, params Station[] stations)
        {
            if(stations == null)
            {
                throw new ArgumentNullException($"{nameof(stations)}");
            }

            if(stations.Length == 0)
            {
                throw new ArgumentException($"You need at least a station for this sector.");
            }

            Id = id;
            Stations = stations;

            StationsList = new LinkedList<Station>(Stations);
        }
        private void btnApplyStationFilter_Click(object sender, EventArgs e)
        {
            StationList.Items.Clear();

            Station[] stations = InitialStationList;

            if (cbDeviceNameFilter.Checked)
            {
                List<Station> TempStations = new List<Station>();

                foreach (Station station in stations)
                {
                    if (station.DeviceNames.Length > 0)
                    {
                        TempStations.Add(station);
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbMacAddrFilter.Checked)
            {
                List<Station> TempStations = new List<Station>();

                foreach (Station station in stations)
                {
                    if (station.SourceMacAddressStr.ToLower().Contains(txtMacAddrFilter.Text.ToLower()))
                    {
                        TempStations.Add(station);
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbProbeFilter.Checked)
            {
                List<Station> TempStations = new List<Station>();

                foreach (Station station in stations)
                {
                    foreach (ProbePacket probe in station.Probes)
                    {
                        if (!String.IsNullOrEmpty(probe.SSID) && probe.SSID.ToLower().Contains(txtProbeFilter.Text.ToLower()))
                        {
                            TempStations.Add(station);
                            break;
                        }
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbOnlyKnownDevice.Checked)
            {
                List<Station> TempStations = new List<Station>();

                foreach (Station station in stations)
                {
                    if (station.DeviceTypeStr.Length > 0)
                    {
                        TempStations.Add(station);
                    }
                }
                stations = TempStations.ToArray();
            }

            if (cbStationContainsHTTP.Checked)
            {
                List<Station> TempStations = new List<Station>();

                foreach (Station station in stations)
                {
                    foreach (WiFiSpy.src.Packets.DataFrame frame in station.DataFrames)
                    {
                        if ((frame.isIPv4 && (frame.isTCP || frame.isUDP)) && frame.PortDest == 80 || frame.PortSource == 80)
                        {
                            TempStations.Add(station);
                            break;
                        }
                    }
                }
                stations = TempStations.ToArray();
            }

            FilterStations = stations.OrderByDescending(o => o.LastSeenDate).ToArray();
            StationList.VirtualListSize = FilterStations.Length;
        }
Beispiel #5
0
 // ================================
 internal static void Reset(bool ResetLogs)
 {
     // track manager
     TrackManager.CurrentTrack = new TrackManager.Track();
     // train manager
     TrainManager.Trains = new TrainManager.Train[] { };
     // game
     Interface.ClearMessages();
     CurrentInterface = InterfaceType.Normal;
     RouteComment = "";
     RouteImage = "";
     RouteAccelerationDueToGravity = 9.80665;
     RouteRailGauge = 1.435;
     RouteInitialAirPressure = 101325.0;
     RouteInitialAirTemperature = 293.15;
     RouteInitialElevation = 0.0;
     RouteSeaLevelAirPressure = 101325.0;
     RouteSeaLevelAirTemperature = 293.15;
     Stations = new Station[] { };
     Sections = new Section[] { };
     BufferTrackPositions = new double[] { };
     Messages = new Message[] { };
     MarkerTextures = new Textures.Texture[] { };
     PointsOfInterest = new PointOfInterest[] { };
     PrecedingTrainTimeDeltas = new double[] { };
     PrecedingTrainSpeedLimit = double.PositiveInfinity;
     BogusPretrainInstructions = new BogusPretrainInstruction[] { };
     TrainName = "";
     TrainStart = TrainStartMode.EmergencyBrakesNoAts;
     NoFogStart = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0);
     NoFogEnd = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0);
     PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0);
     CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5);
     NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 1.0);
     InfoTotalTriangles = 0;
     InfoTotalTriangleStrip = 0;
     InfoTotalQuads = 0;
     InfoTotalQuadStrip = 0;
     InfoTotalPolygon = 0;
     InfoStaticOpaqueFaceCount = 0;
     if (ResetLogs) {
         LogRouteName = "";
         LogTrainName = "";
         LogDateTime = DateTime.Now;
         CurrentScore = new Score();
         ScoreMessages = new ScoreMessage[] { };
         ScoreLogs = new ScoreLog[64];
         ScoreLogCount = 0;
         BlackBoxEntries = new BlackBoxEntry[256];
         BlackBoxEntryCount = 0;
         BlackBoxNextUpdate = 0.0;
     }
     // renderer
     Renderer.Reset();
 }
Beispiel #6
0
        private void StationsLoaded(object sender, EventArgs e)
        {
            this.stations = StationLoader.Stations;

            menuPlayerStations.MenuItems.Clear();
            menuPlayerStations.MenuItems.Add("-");
            int sharedIndex = 0;
            Station quickMixStation = null;

            foreach (Station station in stations)
            {
                MenuItem menuItem = new MenuItem(station.Name, new EventHandler(menuPlayerStations_Click));

                if (station.Shared)
                {
                    menuPlayerStations.MenuItems.Add(sharedIndex, menuItem);
                    ++sharedIndex;
                }
                else if (station.QuickMix)
                {
                    quickMixStation = station;
                }
                else
                {
                    menuPlayerStations.MenuItems.Add(menuItem);
                }
            }

            if (quickMixStation != null)
            {
                menuPlayerStations.MenuItems.Add("-");

                MenuItem menuItem = new MenuItem(quickMixStation.Name, new EventHandler(menuPlayerStations_Click));
                menuPlayerStations.MenuItems.Add(menuItem);
            }

            if (sharedIndex == 0)
            {
                menuPlayerStations.MenuItems.RemoveAt(0);
            }

            Station currentStation = null;

            foreach (Station station in stations)
            {
                if (station.Code.Equals(currentStationCode))
                {
                    currentStation = station;
                    break;
                }
            }

            if (currentStation != null)
            {
                foreach (MenuItem menuItem in menuPlayerStations.MenuItems)
                {
                    if (menuItem.Text.Equals(currentStation.Name))
                    {
                        menuItem.Checked = true;
                    }
                    else
                    {
                        menuItem.Checked = false;
                    }
                }
            }

            menuPlayerStations.Enabled = true;
        }
Beispiel #7
0
    public void Cargar_Terminales()
    {
        DDL_Terminales.Items.Clear();
        myStations = MR.GetStationList(0, 10);
        DDL_Terminales.Items.Add("Selecciona la Terminal Deseada");
        DDL_Terminal_Rutas.Items.Add("Selecciona la Terminal Deseada");

        for (int i = 0; i < myStations.Length; i++)
        {
            int id = myStations[i].Id;
            DDL_Terminales.Items.Add(myStations[i].Name);
            DDL_Terminales.DataValueField = id.ToString();
        }
    }
Beispiel #8
0
 public void LogIn(string username, string password, string stationID = null)
 {
     bool success;
     stations = api.UserLogin(username, password, out success);
     if (!success) {
         EventHandler invalidLoginHandler = InvalidLogin;
         if (invalidLoginHandler != null)
             invalidLoginHandler(this, null);
     }
     if (stations.Length == 0)
         return;
     bool stationIDStored = false;
     if (stationID != null) {
         for (int x = 0; x < stations.Length; x++) {
             Station thisStation = stations[x];
             if (thisStation.Token == stationID) {
                 currentStation = x;
                 stationIDStored = true;
                 break;
             }
         }
     }
     if (!stationIDStored)
         PreferencesManager.SetPreference(Preferences.StationID, stations[currentStation].Token);
     StationEventHandler stationChangedHandler = StationChanged;
     if (stationChangedHandler != null)
         stationChangedHandler(this, stations[currentStation]);
     playNext();
 }
		/// <summary>
		///   Create a new instance controlling the given <see cref="Stations" />.
		/// </summary>
		protected ObserverController(params Station[] stations)
		{
			this.Stations = stations;
		}
Beispiel #10
0
 // ================================
 internal static void Reset()
 {
     // track manager
     TrackManager.CurrentTrack = new TrackManager.Track();
     // train manager
     TrainManager.Trains = new TrainManager.Train[] { };
     // game
     Interface.ClearMessages();
     RouteComment = "";
     RouteImage = "";
     RouteAccelerationDueToGravity = 9.80665;
     RouteRailGauge = 1.435;
     RouteInitialAirPressure = 101325.0;
     RouteInitialAirTemperature = 293.15;
     RouteInitialElevation = 0.0;
     RouteSeaLevelAirPressure = 101325.0;
     RouteSeaLevelAirTemperature = 293.15;
     Stations = new Station[] { };
     Sections = new Section[] { };
     BufferTrackPositions = new double[] { };
     MarkerTextures = new int[] { };
     PointsOfInterest = new PointOfInterest[] { };
     BogusPretrainInstructions = new BogusPretrainInstruction[] { };
     TrainName = "";
     TrainStart = TrainStartMode.EmergencyBrakesNoAts;
     PreviousFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.0);
     CurrentFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.5);
     NextFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 1.0);
     NoFogStart = (float)World.BackgroundImageDistance + 200.0f;
     NoFogEnd = 2.0f * NoFogStart;
     InfoTotalTriangles = 0;
     InfoTotalTriangleStrip = 0;
     InfoTotalQuads = 0;
     InfoTotalQuadStrip = 0;
     InfoTotalPolygon = 0;
     // object manager
     ObjectManager.Objects = new ObjectManager.StaticObject[16];
     ObjectManager.ObjectsUsed = 0;
     ObjectManager.ObjectsSortedByStart = new int[] { };
     ObjectManager.ObjectsSortedByEnd = new int[] { };
     ObjectManager.ObjectsSortedByStartPointer = 0;
     ObjectManager.ObjectsSortedByEndPointer = 0;
     ObjectManager.LastUpdatedTrackPosition = 0.0;
     ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4];
     ObjectManager.AnimatedWorldObjectsUsed = 0;
     // renderer / sound
     Renderer.Reset();
     SoundManager.StopAllSounds(true);
     GC.Collect();
 }