Example #1
0
        /// <summary>
        /// 打开 Region 文件
        /// </summary>
        /// <param name="files">要被打开的 Region 文件列表</param>
        private void openFiles(string[] files)
        {
            // 读取目标文件列表
            this.io = new CommandBlockIO(files);

            // 暂停 listView 的刷新
            this.listView.BeginUpdate();

            // 增加命令列表
            List <TileCommandBlock> commandBlocks = this.io.CommandBlocks;
            int id = 1;

            foreach (TileCommandBlock commandBlock in commandBlocks)
            {
                ListViewItem item = this.listView.Items.Add(id++.ToString());
                item.SubItems.Add(commandBlock.x.ToString());
                item.SubItems.Add(commandBlock.y.ToString());
                item.SubItems.Add(commandBlock.z.ToString());
                item.SubItems.Add(commandBlock.command);
            }

            // 自动设置列宽
            foreach (ColumnHeader column in listView.Columns)
            {
                column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            }

            // 启用 listView 的刷新
            this.listView.EndUpdate();

            // 设置菜单
            this.文件.Enabled     = true;
            this.自动修改命令.Enabled = true;
        }
Example #2
0
        /// <summary>
        /// 关闭已打开的 Region 文件
        /// </summary>
        private void closeFiles()
        {
            this.文件.Enabled     = false;
            this.自动修改命令.Enabled = false;
            this.listView.Items.Clear();

            if (this.io != null)
            {
                this.io.Dispose();
                this.io = null;
            }
        }