Beispiel #1
0
        /****************************************************************************************
        * Function: Determine_Record_Prams()
        * Purpose: This function will set the classes Port count and record length.
        *
        *          *** THIS METHOD MUST BE CALLED SECOND IN PARSER ****
        *
        * Input: None
        * Output: None
        * Var State Changes: Record_Length and Port_Count will be set in the class.
        * Dependancies: Globals class for constants AND ConsoleColors class for coloring cmd
        *               line output.
        ****************************************************************************************/
        private void Determine_Record_Prams()
        {
            //This is a hacky appraoch for inconsistant record
            //File_Length (+/- 2) =record_length * record_count
            File_Length = SFL_to_parse.Length;

            int Mod_Result = 5000;

            for (int i = 0; i < Globals.Record_Lengths.Length; i++)
            {
                Mod_Result = File_Length % Globals.Record_Lengths[i];
                if (Mod_Result == 0)
                {
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Cyan);
                    Port_Count    = Globals.Port_Values[i];
                    Record_Length = Globals.Record_Lengths[i];
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Cyan);
                    //Console.WriteLine("The port Count is: " + Port_Count.ToString());
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Blue);
                    //Console.WriteLine("The Record length is: " + Record_Length.ToString());
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.White);
                    break;
                }
                else if (Mod_Result == 2)
                {
                    Port_Count    = Globals.Port_Values[i];
                    Record_Length = Globals.Record_Lengths[i];
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Cyan);
                    //Console.WriteLine("The port Count is: " + Port_Count.ToString());
                    //ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Blue);
                    //Console.WriteLine("The Record length is: " + Record_Length.ToString());
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Red);
                    Console.WriteLine("Error! Slight Correction made, data might be bad!");
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.White);
                    break;
                }

                //This handles the case of no matching file length and conforms to the standard method
                // of record lengths using globals.
                if (i == Globals.Record_Lengths.Length - 1)
                {
                    Port_Count    = 16;
                    Record_Length = (Globals.Header_Length + (Globals.Data_Length * Port_Count));
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Red);
                    Console.WriteLine("The port Count is: " + Port_Count.ToString());
                    Console.WriteLine("The Record length is: " + Record_Length.ToString());
                    Console.WriteLine("Error! Couldnt determin port count, revert to pre 3/3/2018 default of 16 ports");
                    ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.White);
                    break;
                }
            }
        }
Beispiel #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++;
                }
            }
        }