//加载工作区
        public void LoadWorkSpace()
        {
            //读取行为树类信息
            NodeClasses = XmlUtility.Read <NodeClasses>(GetNodeClassPath());
            if (NodeClasses == null)
            {
                NodeClasses = new NodeClasses();
                NodeClasses.ResetEnums();
                NodeClasses.ResetNodes();
                XmlUtility.Save(MainForm.Instance.GetNodeClassPath(), MainForm.Instance.NodeClasses);
            }

            NodeClassesStringContent = XmlUtility.ObjectToString(NodeClasses);

            this.Text = Settings.Default.EditorTitle;
            if (string.IsNullOrEmpty(Settings.Default.WorkDirectory) || string.IsNullOrEmpty(Settings.Default.WorkSpaceName))
            {
                return;
            }

            WorkSpaceData = XmlUtility.Read <WorkSpaceData>(GetWorkSpacePath());

            if (WorkSpaceData == null)
            {
                return;
            }

            if (WorkSpaceData != null)
            {
                this.Text = string.Format("{0}[{1}]", Settings.Default.EditorTitle, WorkSpaceData.WorkSpaceName);
            }

            //读取行为树数据
            LoadBehaviorTreeData();
        }
 //重置数据
 private void Reset()
 {
     EditorUtility.NodeClassDic.Clear();
     treeView1.Nodes.Clear();
     NodeClasses = new NodeClasses();
     NodeClasses.ResetEnums();
     NodeClasses.ResetNodes();
     TreeData = new TreeData();
     SetSelectedAgent(null);
 }
        //打开工作区
        public void OpenWorkSpace()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = string.Format("工作区配置|*{0}", Settings.Default.WorkSpaceSetupSuffix);
            openFileDialog.Title  = "打开工作区";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string workSpaceFile = openFileDialog.FileName.Trim();
                if (File.Exists(workSpaceFile))
                {
                    DirectoryInfo dirInfo       = new DirectoryInfo(workSpaceFile);
                    string        workDirectory = dirInfo.Parent.FullName;
                    WorkSpaceData = XmlUtility.Read <WorkSpaceData>(workSpaceFile);
                    if (WorkSpaceData != null)
                    {
                        Settings.Default.WorkDirectory = workDirectory;
                        Settings.Default.WorkSpaceName = WorkSpaceData.WorkSpaceName;
                        Settings.Default.Save();
                        Text = string.Format("{0}[{1}]", Settings.Default.EditorTitle, WorkSpaceData.WorkSpaceName);
                        ShowInfo("打开工作区,时间:" + DateTime.Now);

                        //读取行为树类信息
                        NodeClasses = XmlUtility.Read <NodeClasses>(GetNodeClassPath());
                        if (NodeClasses == null)
                        {
                            NodeClasses = new NodeClasses();
                            NodeClasses.ResetNodes();
                            XmlUtility.Save(GetNodeClassPath(), NodeClasses);
                        }

                        NodeClassesStringContent = XmlUtility.ObjectToString(NodeClasses);

                        //读取行为树数据
                        LoadBehaviorTreeData();

                        CreateTreeViewManager();
                    }
                }
            }
        }