示例#1
0
        /****************************************************************************************
        * Function:Parse_SFL
        * Purpose: This method will parse the entire SFL File and is the main methog of this
        *          class
        *          Method Order:
        *          1. Get_File_Info
        *          2. Determine_Record_Prams();
        *          3.
        * Input: A string that contains a valid SFL file meeting the standard format as of
        *        3/3/2018
        * Output: A CSV of the SFL file parsed in teh output directory selected or an error.
        ****************************************************************************************/
        public void Parse_SFL(string sfl_file_string)
        {
            //Initialize the Record... DUH!
            Records = new List <SFL_Record>();
            //Call method to set file information.
            Get_File_Info(sfl_file_string);

            Determine_Record_Prams();

            //Now we know how many ports the device has, how ong each recode is and the record count
            //SFL_Record tst_rec = new SFL_Record(SFL_to_parse, Record_Length, Port_Count);
            Record_Strings = Make_List_Of_Records();

            int rec_counter = 1;

            foreach (String rec in Record_Strings)
            {
                SFL_Record tmp_record = new SFL_Record(rec, SFL_file_name, SFL_file_path, Record_Length, Port_Count, rec_counter, Record_Strings.Count());
                Records.Add(tmp_record);
                rec_counter++;
            }

            //We should now have acomplete record with whcih to create a csv
            Console.WriteLine("SFL File {0} Parsed", Records[0].SFL_File_Name);
            //This is where we should creat the CSV FILE
        }
示例#2
0
        public void Print_Curet_Record(SFL_Record cur_rec)
        {
            //Lets just print all the Records properties to the console
            String boarder = new System.String('=', 80);

            Console.WriteLine(boarder);
            //Line 1
            Console.WriteLine("{0}{1}",
                              cur_rec.SFL_File_Path,
                              cur_rec.SFL_File_Name);
            Console.WriteLine("Record {0} of {1}\t\tModified: {2}",
                              cur_rec.Cur_Record_Count,
                              cur_rec.Total_Records_Count,
                              cur_rec.Mod_Date);
            Console.WriteLine(boarder);
            //Line 2
            Console.WriteLine("Site Code: {0}\t\tSite Name: {1}\tDate: {2} at {3}",
                              cur_rec.Site,
                              cur_rec.Site_Name_Str,
                              cur_rec.Date_Str,
                              cur_rec.Time_Str
                              );
            //Line 3
            Console.WriteLine("Logger " + @"# " + "{0}\t\tActive Ports: {1} of {2}",
                              cur_rec.Logger_Number,
                              cur_rec.Active_Port_Count,
                              cur_rec.Ports_Avail);
            //line 4
            Console.WriteLine("Latitude: {0}\t\tLongitude: {1}\t\tAltitude: {2}",
                              cur_rec.Latitude,
                              cur_rec.Longitude,
                              cur_rec.Altitude
                              );
            Console.WriteLine("Port\tCode\tInstrument\tSensitivity\tPod#\tZero Offse\tCounts/mv");

            int  counter = 1;
            bool flipper = true;

            foreach (SFL_Record_Data cur in cur_rec.Record_Data)
            {
                if (flipper)
                {
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Yellow);
                    Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}",
                                      counter,
                                      cur.Data_Code,
                                      cur.Inst_Num,
                                      cur.Sensitivity,
                                      cur.POD, cur.Zero_Offset,
                                      cur.Countes_MV);
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.White);
                    flipper = !flipper;
                    counter++;
                }
                else
                {
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Green);
                    Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}",
                                      counter,
                                      cur.Data_Code,
                                      cur.Inst_Num,
                                      cur.Sensitivity,
                                      cur.POD, cur.Zero_Offset,
                                      cur.Countes_MV);
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.White);
                    flipper = !flipper;
                    counter++;
                }
            }
        }