Beispiel #1
0
        public static StudTable Load(string filePath = "")
        {
            //get the static filePath
            filePath = filePath ?? FilePath;
            var table = new StudTable();

            string[] data = File.ReadAllLines(filePath);
            table.Spacing = data[0].Split(',');
            table.Keys    = data[1].Split(',');

            string[] values = null;
            for (int k = 0; k < table.Floors; k++)
            {
                switch (k)
                {
                case 0:
                    values = data.Skip(2).ToArray();
                    break;

                case 1:
                    values = data.Skip(10).ToArray();
                    break;

                case 2:
                    values = data.Skip(18).ToArray();
                    break;

                default:
                    break;
                }

                for (int i = 0; i < table.Keys.Length; i++)
                {
                    for (int j = 0; j < table.Spacing.Length; j++)
                    {
                        string[] dimRaw = values[i].Split(',');
                        var      dim    = dimRaw[j].Split(' ');

                        var x    = Convert.ToDouble(dim[0]);
                        var y    = Convert.ToDouble(dim[1]);
                        var cell = new StudCell(
                            Convert.ToDouble(table.Spacing[j]),
                            Convert.ToDouble(table.Keys[i]),
                            new IfDimension(x, y, 0)
                            );

                        cell.Floor = k + 1;
                        table.Cells.Add(cell);
                    }
                }
            }

            return(table);
        }
Beispiel #2
0
        public StudCell ToMilliMeter()
        {
            var s = new StudCell()
            {
                Spacing = Length.FromInches(Spacing).MilliMeter,
                Height  = Length.FromFeet(Height).MilliMeter,
                Floor   = Floor
            };

            return(s);
        }