示例#1
0
        /// <summary> 增加并读取BOX </summary>
        /// <param name="tk"> 要新增的表 </param>
        /// <param name="reader"> 数据流 </param>
        /// <param name="tempStr"> 后续新增表的名  </param>
        public void AddAndReadBox(TableKey tk, System.IO.StreamReader reader, string tempStr)
        {
            ModifyBoxModel model = new ModifyBoxModel(tk, region);
            StringBuilder  sb    = new StringBuilder();

            tk.Lines.ForEach(l => sb.AppendLine(l.Trim(KeyConfiger.splitKeyWord)));
            model.Value = sb.ToString();
            tk.Build(this.Z, this.X, this.Y);
            BOX box = new BOX("BOX");

            box.Region = this.region;
            box.ObsoverModel.Add(model);
            model.ParentKey = box;
            this.ModifyKeyCar.Add(box);

            ReadBOX(reader, tempStr);
        }
示例#2
0
        /// <summary> 循环读取BOX修改的关键字 </summary>
        public void ReadBOX(System.IO.StreamReader reader, string keyName)
        {
            TableKey tk = new TableKey(keyName);

            string tempStr;

            while (!reader.EndOfStream)
            {
                tempStr = reader.ReadLine().Trim();

                //  遇到结束符退出
                if (tempStr == KeyConfiger.EndFlag || tempStr == BOX.BoxEndFlag)
                {
                    break;
                }

                if (tempStr.IsKeyFormat())
                {
                    ReadBOX(reader, tempStr);

                    break;
                }

                //  有效行插入到集合
                if (tempStr.IsWorkLine())
                {
                    tk.Lines.Add(tempStr);
                }
            }

            tk.Build(region.ZTo - region.ZFrom, region.XTo - region.XFrom, region.YTo - region.YFrom);

            ModifyBoxModel model = new ModifyBoxModel(tk, region);

            this.ObsoverModel.Add(model);
        }
示例#3
0
        /// <summary> 循环读取BOX修改的关键字 </summary>
        public void ReadBOX(System.IO.StreamReader reader, string keyName)
        {
            TableKey tk = KeyConfigerFactroy.Instance.CreateKey <TableKey>(keyName, this.BaseFile.SimKeyType) as TableKey;

            tk.BaseFile = this.BaseFile;
            ModifyBoxModel model = new ModifyBoxModel(tk, this.newRegion);
            BOX            box   = new BOX("BOX");

            box.Region = this.newRegion;
            box.ObsoverModel.Add(model);
            model.ParentKey = box;
            this.ModifyKeyCar.Add(box);

            string tempStr;

            while (!reader.EndOfStream)
            {
                tempStr = reader.ReadLine().TrimEnd();

                ////  遇到结束符退出
                //if (tempStr == KeyConfiger.EndFlag || tempStr == _carfinEndFlag)
                //{
                //    break;
                //}

                //  遇到结束符退出
                if (tempStr == _carfinEndFlag)
                {
                    break;
                }

                bool isChildRegister = KeyConfigerFactroy.Instance.IsRegister(tempStr);

                if (isChildRegister)
                {
                    //  读到下一关注关键字终止
                    BaseKey tempKey = KeyConfigerFactroy.Instance.CreateKey <BaseKey>(tempStr);

                    //  是修正关键字
                    if (tempKey is ModifyKey)
                    {
                        tempKey.BaseFile  = this.BaseFile;
                        tempKey.ParentKey = this;

                        ModifyKey mk = tempKey as ModifyKey;
                        //  放入本定义下面
                        this._modifyKeyCar.Add(mk);
                        mk.BaseFile = this.BaseFile;
                        mk.ReadKeyLine(reader);

                        ////  执行更改
                        //mk.RunModify();
                    }
                    else if (tempKey is DynamicKey)
                    {
                        tempKey.BaseFile  = this.BaseFile;
                        tempKey.ParentKey = this;

                        //  放入本子节点下面
                        this.Keys.Add(tempKey);
                        tempKey.ReadKeyLine(reader);
                    }
                    else if (tempKey is TableKey)
                    {
                        ReadBOX(reader, tempStr);

                        break;
                    }

                    else
                    {
                        ReadBOX(reader, tempStr);

                        break;
                    }
                }
                else
                {
                    //  PERMX 2 /
                    if (tempStr.Trim().IsKeyFormat())
                    {
                        ReadBOX(reader, tempStr);

                        break;
                    }
                    else
                    {
                        //  有效行插入到集合
                        if (tempStr.IsWorkLine())
                        {
                            tk.Lines.Add(tempStr);
                        }
                    }
                }
            }

            //  构建数据
            StringBuilder sb = new StringBuilder();

            tk.Lines.ForEach(l => sb.AppendLine(l.Trim(KeyConfiger.splitKeyWord)));
            model.Value = sb.ToString();
            tk.Build(this.Z, this.X, this.Y);

            //this.ObsoverModel.Add(model);
        }
示例#4
0
        /// <summary> 循环读取BOX修改的关键字 </summary>
        public void ReadBOX(System.IO.StreamReader reader, string keyName)
        {
            TableKey tk = KeyConfigerFactroy.Instance.CreateKey <TableKey>(keyName, this.BaseFile.SimKeyType) as TableKey;

            tk.BaseFile  = this.BaseFile;
            tk.ParentKey = this;
            string tempStr;

            while (!reader.EndOfStream)
            {
                tempStr = reader.ReadLine().TrimEnd();

                //  遇到结束符退出
                if (tempStr == KeyConfiger.EndFlag || tempStr == BOX.BoxEndFlag)
                {
                    break;
                }


                bool isChildRegister = KeyConfigerFactroy.Instance.IsRegister(tempStr, this.BaseFile.SimKeyType);

                if (isChildRegister)
                {
                    //  读到下一关注关键字终止
                    BaseKey tempKey = KeyConfigerFactroy.Instance.CreateKey <BaseKey>(tempStr, this.BaseFile.SimKeyType);

                    //  是修正关键字
                    if (tempKey is ModifyKey)
                    {
                        tempKey.BaseFile  = this.BaseFile;
                        tempKey.ParentKey = this;

                        ModifyKey mk = tempKey as ModifyKey;
                        this.Keys.Add(mk);
                        mk.BaseFile = this.BaseFile;
                        mk.ReadKeyLine(reader);

                        ////  执行更改
                        //mk.RunModify();
                    }
                    else if (tempKey is TableKey)
                    {
                        ReadBOX(reader, tempStr);
                        break;
                    }

                    else
                    {
                        ReadBOX(reader, tempStr);

                        break;
                    }
                }
                else
                {
                    //  PERMX 2 /
                    if (tempStr.Trim().IsKeyFormat())
                    {
                        ReadBOX(reader, tempStr);

                        break;
                    }
                    else
                    {
                        //  有效行插入到集合
                        if (tempStr.IsWorkLine())
                        {
                            tk.Lines.Add(tempStr);
                        }
                    }
                }
            }

            ModifyBoxModel model = new ModifyBoxModel(tk, region);

            StringBuilder sb = new StringBuilder();

            tk.Lines.ForEach(l => sb.AppendLine(l.Trim(KeyConfiger.splitKeyWord)));

            model.Value = sb.ToString();

            //  创建BOX表格数据内存镜像文件
            tk.Build(region.ZTo - region.ZFrom, region.XTo - region.XFrom, region.YTo - region.YFrom);

            model.ParentKey = this;
            this.ObsoverModel.Add(model);
        }