示例#1
0
        private static void ProcessCSVFiles(string theconnectionstring, DirectoryInfo dir)
        {
            thedata Kisdata = new thedata();
            gpsdata thegpsdata = new gpsdata();
            Kisdata.ConnectionString = theconnectionstring;
            thegpsdata.ConnectionString = theconnectionstring;
            int count = 0;
            double timestamp = 1161883162;
            DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);

            // Add the number of seconds in UNIX timestamp to be converted.
            dateTime = dateTime.AddSeconds(timestamp);

            // The dateTime now contains the right date/time so to format the string,
            // use the standard formatting methods of the DateTime object.
            // string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();

            // Print the date and time
            Console.WriteLine(dateTime);
            thegpsdata.LoadAll();
            do
            {
                if (!Kisdata.LoadByPrimaryKey(thegpsdata.Bssid))
                {
                    count++;
                    //Console.WriteLine(thegpsdata.Bssid);

                }
            } while (thegpsdata.MoveNext());
            Console.WriteLine(count);

            foreach (FileInfo f in dir.GetFiles("Kismet*.csv"))
            {
                StreamReader sr = File.OpenText(Application.StartupPath + "\\logs\\" + f.Name);
                string input;
                Console.WriteLine(f.Name);
                //string aoui = "";

                //string[] theoui;
                //string thecompany = "";
                sr.ReadLine();
                while ((input = sr.ReadLine()) != null)
                {
                    if (input.Length != 0)
                    {
                        //Console.WriteLine(input);
                        string[] thestrings;
                        thestrings = input.Split(new char[] { ';' });
                        //Console.WriteLine(thestrings.Length);
                        if(!Kisdata.LoadByPrimaryKey(thestrings[3]))
                        {
                            Console.WriteLine(thestrings[2]);
                            Console.WriteLine(thestrings[3]);
                        }

                    }

                }
            }
        }