示例#1
0
        private int currentLine; //Pointer to keep track of where in the file we are

        #endregion Fields

        #region Methods

        private void _parseBearingInfo()
        {
            currentLine = 550;
            _parseLine43();
            this.Bearings = new List<TreBearing>();
            for(int i = 0; i < Convert.ToInt32(this.NumberOfBearings); i++)
            {
                string[] contentsToParse = Contents[currentLine].Split(' ');
                this.Bearings.Add(new TreBearing(contentsToParse));
                currentLine++;
            }
            _parseLine45();
            string[] pointToParse = Contents[currentLine].Split(' ');
            this.BearingPoints = new List<TrePoint>();
            do
            {
                TrePoint pointToAdd = new TrePoint();
                pointToAdd.X = pointToParse[0];
                pointToAdd.Y = pointToParse[1];
                currentLine++;
                pointToParse = Contents[currentLine].Split(' ');
                this.BearingPoints.Add(pointToAdd);
            }
            while (pointToParse.Length > 1);
            //Lines 47 & 48
            this.NumberOfSegments = pointToParse[0];
            if (Convert.ToInt32(NumberOfSegments) > 0)
            {
                currentLine++;
                string[] panelsToParse = Contents[currentLine].Split(' ');
                this.NumberOfPanelsForSegmentAtIndex = new List<string>();
                for (int i = 0; i < Convert.ToInt32(NumberOfSegments); i++)
                {
                    this.NumberOfPanelsForSegmentAtIndex.Add(panelsToParse[i]);
                }
            }
            currentLine++;
            //Hip Extensions
            this.HipExtensions = new List<TreHipExension>();
            this.NumberOfCalHipExtensions = Contents[currentLine].Split(' ')[0];
            currentLine++;
            for (int i = 0; i < Convert.ToInt32(NumberOfCalHipExtensions); i++)
            {
                string[] hipExtensionToParse = Contents[currentLine].Split(' ');
                this.HipExtensions.Add(new TreHipExension(hipExtensionToParse));
                currentLine++;
            }
            //Drop Tops
            this.DropTops = new List<TreDropTop>();
            this.NumberOfDropTops = Contents[currentLine].Split(' ')[0];
            currentLine++;
            for (int i = 0; i < Convert.ToInt32(NumberOfCalHipExtensions); i++)
            {
                string[] hipExtensionToParse = Contents[currentLine].Split(' ');
                this.HipExtensions.Add(new TreHipExension(hipExtensionToParse));
                currentLine++;
            }
        }
示例#2
0
 private void _parseLine32(TreMember treMember)
 {
     // Parse line 32 (see MiTek's documentation file for the TRE file format)
     // Line 32 is the fourth line of member data for each member
     // So go to the fourth line of the first member (_memberInfoIndex + 5)
     // And then adjust based on which member we're on ( + i * 5) (5 lines per member)
     string[] line32 = Contents[currentLine].Trim().Split(','); // Split on comma, these are points
     if (line32.Length % 2 != 0)
     {
         throw new Exception("Problem while parsing a member in TRE file line " + 111 + ": there is an odd number of numbers - should be even because represents points, which are in pairs (x,y)");
     }
     List<TrePoint> points = new List<TrePoint>();
     for (int j = 0; j < line32.Length; j = j + 2) // Advance by two because we're going point by point
     {
         TrePoint point = new TrePoint();
         point.X = line32[j].Trim();
         point.Y = line32[j + 1].Trim();
         points.Add(point);
     }
     currentLine++;
 }
示例#3
0
        private void _parseBearingInfo()
        {
            while(Contents[currentLine].Trim().Equals("BEARING INFO") == false) //ToDo: Parse info between member and bearing
            {
                this.Unknown7 += Contents[currentLine++];
            }
            currentLine++;

            _parseLine43();
            this.TreBearings = new List<TreBearing>();
            for (int i = 0; i < Convert.ToInt32(this.NumberOfBearings); i++)
            {
                string[] contentsToParse = Contents[currentLine].Split(' ');
                this.TreBearings.Add(new TreBearing(contentsToParse));
                currentLine++;
            }
            _parseLine45();
            string[] pointToParse = Contents[currentLine].Split(' ');
            this.BearingPoints = new List<TrePoint>();
            do
            {
                TrePoint pointToAdd = new TrePoint();
                pointToAdd.X = pointToParse[0].Trim();
                pointToAdd.Y = pointToParse[1].Trim();
                currentLine++;
                pointToParse = Contents[currentLine].Split(' ');
                this.BearingPoints.Add(pointToAdd);
            }
            while (pointToParse.Length > 1);
            /* TODO: Unknown8
            //Lines 47 & 48
            this.NumberOfSegments = pointToParse[0].Trim();
            if (Convert.ToInt32(NumberOfSegments) > 0)
            {
                currentLine++;
                string[] panelsToParse = Contents[currentLine].Split(' ');
                this.NumberOfPanelsForSegmentAtIndex = new List<string>();
                for (int i = 0; i < Convert.ToInt32(NumberOfSegments); i++)
                {
                    this.NumberOfPanelsForSegmentAtIndex.Add(panelsToParse[i]);
                }
            }
            currentLine++;
            //Hip Extensions
            this.HipExtensions = new List<TreHipExension>();
            this.NumberOfCalHipExtensions = Contents[currentLine].Split(' ')[0].Trim();
            currentLine++;
            for (int i = 0; i < Convert.ToInt32(NumberOfCalHipExtensions); i++)
            {
                string[] hipExtensionToParse = Contents[currentLine].Split(' ');
                this.HipExtensions.Add(new TreHipExension(hipExtensionToParse));
                currentLine++;
            }
            //Drop Tops
            this.DropTops = new List<TreDropTop>();
            this.NumberOfDropTops = Contents[currentLine].Split(' ')[0].Trim();
            currentLine++;
            for (int i = 0; i < Convert.ToInt32(NumberOfCalHipExtensions); i++)
            {
                string[] dropTopsToParse = Contents[currentLine].Split(' ');
                this.DropTops.Add(new TreDropTop(dropTopsToParse));
                currentLine++;
            }
            */
        }