Example #1
0
        } /* WriteLine */

        private void  ParseTabDelStr(string s,
                                     int[]     fieldIndexes,
                                     ref bool valid
                                     )
        {
            valid = true;

            ctdDate = new DateTime(1, 1, 1, 0, 0, 0);

            string[] fields = s.Split('\t');

            if (fields.Length != fieldIndexes.Length)
            {
                valid = false;
                return;
            }

            int x = 0;

            for (x = 0; x < fields.Length; x++)
            {
                string field      = fields[x];
                float  floatValue = PicesKKStr.StrToFloat(field);
                int    fieldIndex = fieldIndexes[x];

                if (fieldIndex < numDataFields)
                {
                    data[fieldIndex] = floatValue;
                    continue;
                }

                switch (fieldIndex)
                {
                case  LatitudeIndex:        latitude = PicesKKStr.StrToDouble(field); break;

                case  LongitudeIndex:       longitude = PicesKKStr.StrToDouble(field); break;

                case  DateIndex:            time = PicesKKStr.StrToDateTime(field); break;

                case  ActiveBatteryIndex:   activeBattery = PicesKKStr.StrToInt(field); break;

                case  BatteryStatusesIndex: batteryStatuses = field.Trim();                        break;

                case  CTD_DateIndex:        ctdDate = PicesKKStr.StrToDateTime(field); break;

                case  ScanLineIndex:        scanLine = PicesKKStr.StrToInt(field); break;

                case  ByteOffseIndex:       byteOffset = PicesKKStr.StrToUInt64(field); break;

                case  CropLeftIndex:        cropLeft = (UInt16)PicesKKStr.StrToUint(field); break;

                case  CropRightIndex:       cropRight = (UInt16)PicesKKStr.StrToUint(field); break;

                case  ActiveColumnsIndex:   activeColumns = (UInt16)PicesKKStr.StrToUint(field); break;
                }
            }
        } /* ParseTabDelStr */
        private void  ParseDegreeMinutesStr(string str,
                                            ref double degrees,
                                            ref double minutes
                                            )
        {
            degrees = 0.0;
            minutes = 0.0;

            int x = str.IndexOf('.');

            if (x < 1)
            {
                return;
            }

            string degStr = str.Substring(0, x - 2);

            string minStr = str.Substring(x - 2);

            degrees = PicesKKStr.StrToDouble(degStr);
            minutes = PicesKKStr.StrToDouble(minStr);
        } /* ParseDegreeMinutesStr */