PersistentTrails.Track.parseLegacyTrack C# (CSharp) Method

parseLegacyTrack() private method

private parseLegacyTrack ( StreamReader reader ) : void
reader System.IO.StreamReader
return void
        private void parseLegacyTrack(StreamReader reader)
        {
            Debug.Log("parsing legacy track");

            this.TrackName = reader.ReadLine();
            this.Description = reader.ReadLine();
            string visString = reader.ReadLine();

            string refBodyName = reader.ReadLine();
            //Debug.Log("reading celestialbody = " + refBodyName);
            this.referenceBody = Utilities.CelestialBodyFromName(refBodyName);
            //Debug.Log("reading + parsing samplingFactor");
            this.SamplingFactor = int.Parse(reader.ReadLine());
            //Debug.Log("samplingString = " + samplingString + ", parsed to samplingFactor = " + samplingFactor);

            string colorString = reader.ReadLine();
            this.LineColor = Utilities.makeColor(colorString);
            LineWidth = float.Parse(reader.ReadLine());

            string numString = reader.ReadLine();
            this.ConeRadiusToLineWidthFactor = float.Parse(numString);
            numString = reader.ReadLine();
            this.NumDirectionMarkers = int.Parse(numString);

            //Debug.Log("Header reading complete");

            //Debug.Log("read waypoints");
            reader.ReadLine();//WAYPOINTS
            string line = reader.ReadLine(); //first waypoint
            while (line != "[LOGENTRIES]" && !reader.EndOfStream)
            {
                //Debug.Log("reading waypointline = " + line);
                string[] split = line.Split(';');
                double lat, lon, alt, time;
                Double.TryParse(split[0], out lat);
                Double.TryParse(split[1], out lon);
                Double.TryParse(split[2], out alt);
                Double.TryParse(split[3], out time);
                waypoints.Add(new Waypoint(lat, lon, alt, Quaternion.identity, new Vector3(), time));
                line = reader.ReadLine();
            }

            //Debug.Log("read logentries");
            line = reader.ReadLine();//first entry
            while (!reader.EndOfStream)
            {
                string trimmed = line;
                trimmed = trimmed.Trim();
                if (!string.IsNullOrEmpty(trimmed))
                {

                    //Debug.Log("reading logentryline = " + line);
                    string[] split = line.Split(';');
                    double lat, lon, alt, time;
                    Double.TryParse(split[0], out lat);
                    Double.TryParse(split[1], out lon);
                    Double.TryParse(split[2], out alt);
                    Double.TryParse(split[3], out time);
                    logEntries.Add(new LogEntry(lat, lon, alt, Quaternion.identity, new Vector3(), time, split[4], split[5]));
                }
                line = reader.ReadLine();
            }

            Debug.Log("Created track from file containing " + waypoints.Count + "waypoints and " + logEntries.Count + " log entries");
            Visible = (visString == "1");
            Modified = true; //legacy tracks are marked as modified for conversion
        }