Ejemplo n.º 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            if (File.Exists(".\\data.dat"))
            {
                times = times.Load(".\\data.dat");
            }
            SetText(tbWiFi, times.WLANID, times.connectOnWLAN);
            WlanClient client = new WlanClient();

            while (true)
            {
                foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
                {
                    // Lists all networks with WEP security
                    Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
                    foreach (Wlan.WlanAvailableNetwork network in networks)
                    {
                        String nam = network.profileName;
                        //if (nam == "wlan_lab_01")
                        if (nam == times.WLANID || rbProgramm.Checked)
                        {
                            times.addTimestamp();
                            times.Save(times, ".\\data.dat");
                        }
                    }
                }


                System.Threading.Thread.Sleep(1000);
            }
        }
Ejemplo n.º 2
0
        //Serializing the List
        public void Save(cTimes emps, String filename)
        {
            //Create the stream to add object into it.
            System.IO.Stream ms = File.OpenWrite(filename);
            //Format the object as Binary

            BinaryFormatter formatter = new BinaryFormatter();

            //It serialize the employee object
            formatter.Serialize(ms, emps);
            ms.Flush();
            ms.Close();
            ms.Dispose();
        }
Ejemplo n.º 3
0
        public cTimes Load(String filename)
        {
            //Format the object as Binary
            BinaryFormatter formatter = new BinaryFormatter();

            //Reading the file from the server
            FileStream fs = File.Open(filename, FileMode.Open);

            object obj  = formatter.Deserialize(fs);
            cTimes emps = (cTimes)obj;

            fs.Flush();
            fs.Close();
            fs.Dispose();
            return(emps);
        }