Esempio n. 1
0
        static public bool OpenCreateStreamForm(string Path, ref string NodeName, ref string FileName, ref string Addition, ref bool Compress)
        {
            CreateStreamForm tForm = new CreateStreamForm(Path);

            if (tForm.ShowDialog() == DialogResult.Cancel)
            {
                tForm.Dispose();
                return(false);
            }
            else
            {
                NodeName = tForm.textBox2.Text;
                FileName = tForm.textBox3.Text;
                Addition = tForm.textBox4.Text;
                Compress = tForm.checkBox1.Checked;
                tForm.Dispose();
                return(true);
            }
        }
Esempio n. 2
0
        public static bool OpenCreateStreamForm(string Path, ref string NodeName, ref string FileName, ref string Addition, ref bool Compress)
        {
            CreateStreamForm tForm = new CreateStreamForm(Path);

            if (tForm.ShowDialog() == DialogResult.Cancel)
            {
                tForm.Dispose();
                return false;
            }
            else
            {
                NodeName = tForm.textBox2.Text;
                FileName = tForm.textBox3.Text;
                Addition = tForm.textBox4.Text;
                Compress = tForm.checkBox1.Checked;
                tForm.Dispose();
                return true;
            }
        }
Esempio n. 3
0
        // --- 创建流 ---
        private void ToolStripMenuItem_CreateStream_Click(object sender, EventArgs e)
        {
            // 获得父节点
            TreeNode tParent = treeView_Main.SelectedNode;

            if (tParent != null)
            {
                // 检查父节点
                if (!((FCYResPackageNode)tParent.Tag).IsFloder())
                {
                    showErr("请选择一个文件夹节点。");
                    return;
                }

                // 获得父节点
                FCYResPackageFloderNode tParentFloder = (FCYResPackageFloderNode)tParent.Tag;

                // 获得新节点名称
                string tNodeName = "";
                string tFileName = "";
                string tAddition = "";
                bool   tCompress = false;

                if (!CreateStreamForm.OpenCreateStreamForm(treeView_Main.SelectedNode.FullPath, ref tNodeName, ref tFileName, ref tAddition, ref tCompress))
                {
                    return;
                }

                if (tNodeName == "")
                {
                    showErr("无效的名称。");
                    return;
                }

                // 创建节点
                FCYResPackageDataNode tNewSubNode = new FCYResPackageDataNode((FCYResPackage)treeView_Main.Tag, tParentFloder, tNodeName, tFileName);

                // 尝试加入
                try
                {
                    tParentFloder.Add(tNewSubNode);
                }
                catch
                {
                    showErr("节点名已存在或者无效。");
                    return;
                }

                // 设置属性
                tNewSubNode.IsCompressed = tCompress;
                tNewSubNode.AdditionData = tAddition;

                // 创建树节点
                TreeNode tTreeNode = new TreeNode(tNodeName, 1, 1);
                tTreeNode.Tag = tNewSubNode;

                // 加入
                tParent.Nodes.Add(tTreeNode);
                tParent.Expand();
            }
        }