Exemple #1
0
        /// <summary>
        /// Load file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = false;
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Load file
                Reader reader = new UniversalReader(ofd.FileName);


                try
                {
                    // and parse it
                    reader.Read();

                    // Add Datatables
                    this.dataGridView1.DataSource = reader.Dataset.Tables[Reader.ACCESSPOINTS_DATATABLE];
                    this.dataGridView2.DataSource = reader.Dataset.Tables[Reader.STATIONS_DATATABLE];
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception: " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                // Set file type
                this.lblFiletype.Text = reader.ReaderType;

                // Set filename
                this.lblFilename.Text = reader.Filename;

                // Indicate if parsing was successful
                if (reader.ParseSuccess)
                {
                    this.lblParsed.Text = "Yes";
                }
                else
                {
                    this.lblParsed.Text = "No";
                }
            }
        }
Exemple #2
0
		public static void Main (string[] args)
		{
			Console.WriteLine(DateTime.Now + " - Program started");
			Reader r = new UniversalReader("/home/user/dump-01.csv");
			
			List<Station> stationList = new List<Station>();
			
			// Read the file
			r.Read();
			
			// Add existing stations to the list
			stationList.AddRange(r.Stations);
				
			while (true) {
				// Sleep 5 seconds
				Thread.Sleep(5000);
			
				Console.WriteLine(DateTime.Now + " - Checking for updates");
				
				// Update file
				r.Read();
				
				// Get station list
				foreach(Station sta in r.Stations) {
					
					// If new station, update us
					if (!stationList.Contains(sta)) {
						stationList.Add(sta);
						
						// Display it on the command line
						Console.WriteLine(DateTime.Now + " - New station: " + sta.StationMAC);
						
						// Display it as a notification
						Notification.Notify(sta.BSSID, sta.StationMAC);
					}
				}
			}
			
		}