private void Initialize() { if (!IsValidLineLength(Line1)) { throw new TleException("Invalid length for line one"); } if (!IsValidLineLength(Line2)) { throw new TleException("Invalid length for line two"); } if (Line1[0] != '1') { throw new TleException("Invalid line beginning for line one"); } if (Line2[0] != '2') { throw new TleException("Invalid line beginning for line two"); } ExtractInteger(Line1.Substring(Tle1ColNoradnum, Tle1LenNoradnum), out var satNumber1); ExtractInteger(Line2.Substring(Tle2ColNoradnum, Tle2LenNoradnum), out var satNumber2); if (satNumber1 != satNumber2) { throw new TleException("Satellite numbers do not match"); } NoradNumber = satNumber1; if (Name == "") { Name = Line1.Substring(Tle1ColNoradnum, Tle1LenNoradnum); } IntDesignator = Line1.Substring(Tle1ColIntldescA, Tle1LenIntldescA + Tle1LenIntldescB + Tle1LenIntldescC); ExtractInteger(Line1.Substring(Tle1ColEpochA, Tle1LenEpochA), out var year); ExtractDouble(Line1.Substring(Tle1ColEpochB, Tle1LenEpochB), 4, out var day); ExtractDouble(Line1.Substring(Tle1ColMeanmotiondt2, Tle1LenMeanmotiondt2), 2, out _meanMotionDt2); ExtractExponential(Line1.Substring(Tle1ColMeanmotionddt6, Tle1LenMeanmotionddt6), out _meanMotionDdt6); ExtractExponential(Line1.Substring(Tle1ColBstar, Tle1LenBstar), out _bstar); ExtractDouble(Line2.Substring(Tle2ColInclination, Tle2LenInclination), 4, out _inclination); ExtractDouble(Line2.Substring(Tle2ColRaascendnode, Tle2LenRaascendnode), 4, out _rightAscendingNode); ExtractDouble(Line2.Substring(Tle2ColEccentricity, Tle2LenEccentricity), -1, out _eccentricity); ExtractDouble(Line2.Substring(Tle2ColArgperigee, Tle2LenArgperigee), 4, out _argumentPerigee); ExtractDouble(Line2.Substring(Tle2ColMeananomaly, Tle2LenMeananomaly), 4, out _meanAnomaly); ExtractDouble(Line2.Substring(Tle2ColMeanmotion, Tle2LenMeanmotion), 3, out _meanMotion); ExtractInteger(Line2.Substring(Tle2ColRevatepoch, Tle2LenRevatepoch), out _orbitNumber); if (year < 57) { year += 2000; } else { year += 1900; } Epoch = new DateTime((int)year, 1, 1).AddDays(day - 1); }