Esempio n. 1
0
        private void formExplain_Load(object sender, EventArgs e)
        {
            List <MyConfig> list     = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(Application.StartupPath + "/工具配置文件/TableConfig.xml", Encoding.UTF8);
            List <Menu>     menuList = XmlHelper.XmlDeserializeFromFile <List <Menu> >(Application.StartupPath + "/工具配置文件/MenuConfig.xml", Encoding.UTF8);

            string filePath = DataHelper.FilePath;

            foreach (Menu m in menuList)
            {
                TreeNode node = new TreeNode();
                node.Text = m.MenuText;
                node.Tag  = m.MenuTag;
                node.Name = m.MenuName;
                tvMenu.Nodes.Add(node);
            }

            _tbConfig = new Dictionary <string, string>();
            foreach (MyConfig item in list)
            {
                TreeNode chldNode = new TreeNode();
                chldNode.Text = item.Notes + "(" + item.TxtName + ")";
                chldNode.Tag  = item.MainDtName;
                tvMenu.Nodes[item.Classify].Nodes.Add(chldNode);
                _tbConfig.Add(item.MainDtName, item.DtType);
            }
        }
Esempio n. 2
0
 private string GetModFilePath()
 {
     try
     {
         string path = Application.StartupPath + "/工具配置文件/AppConfig.xml";
         if (!File.Exists(path))
         {
             MessageBox.Show("你还没有新建过方案,请先新建方案!");
             return("");
         }
         List <AppConfig> list = XmlHelper.XmlDeserializeFromFile <List <AppConfig> >(path, Encoding.UTF8);
         if (list.Count > 0 && !string.IsNullOrEmpty(list[0].CreatePath))
         {
             return(list[0].CreatePath + "\\xkfy.project");
         }
         else
         {
             MessageBox.Show("方案配置文件有误,请重新创建!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return("");
     }
     return("");
 }
Esempio n. 3
0
        private void FrmTbConfig_Load(object sender, EventArgs e)
        {
            _menuList = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(PathHelper.TableConfigPath, Encoding.UTF8);
            BindingList <MyConfig> bl = new BindingList <MyConfig>(_menuList);

            dg1.DataSource = bl;
        }
Esempio n. 4
0
        /// <summary>
        /// 生成所有打开过的MOD文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsCreateMOD_Click(object sender, EventArgs e)
        {
            List <MyConfig> list = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(Application.StartupPath + "/工具配置文件/TableConfig.xml", Encoding.UTF8);

            foreach (MyConfig item in list)
            {
                if (!DataHelper.XkfyData.Tables.Contains(item.MainDtName))
                {
                    continue;
                }
                BuildModsFiles(item.MainDtName);
            }

            foreach (DataTable dt in DataHelper.MapData.Tables)
            {
                string txtName = dt.TableName + ".txt";
                StructureMapData(dt, txtName);
                _tl.BuildDataSetXmlMap(dt.TableName);
            }
            if (!string.IsNullOrEmpty(DataHelper.FilePath))
            {
                DialogResult dialogR = MessageBox.Show("Mod数据生成成功!是否打开生成的数据目录?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dialogR == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("explorer.exe", DataHelper.FilePath);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 开始
        /// </summary>
        /// <param name="path"></param>
        private void Start(string path)
        {
            string           endPath = path.Substring(0, path.IndexOf("xkfy.project"));
            List <ModConfig> list    = XmlHelper.XmlDeserializeFromFile <List <ModConfig> >(path, Encoding.UTF8);

            foreach (ModConfig m in list)
            {
                if (m.Name == "ModFiles")
                {
                    DataHelper.FilePath = endPath + m.Path;
                    DataHelper.MapPath  = endPath + m.Path;
                }
                if (m.Name == "ToolFiles")
                {
                    DataHelper.ToolFilesPath = endPath + m.Path;
                }
            }
            _dock1 = new Dock();

            _dock1.Show(this.dockPanel1, DockState.DockLeft);

            foreach (DockContent frm in this.dockPanel1.Contents)
            {
                if (frm.Text == "关于")
                {
                    frm.Activate();
                    return;
                }
            }
            _c           = new About();
            _c.MdiParent = this;
            _c.Show(this.dockPanel1);
        }
Esempio n. 6
0
        private void frmSetUp_Load(object sender, EventArgs e)
        {
            _menuList = XmlHelper.XmlDeserializeFromFile <List <DicConfig> >(_path, Encoding.UTF8);
            BindingList <DicConfig> bl = new BindingList <DicConfig>(_menuList);

            dg1.DataSource = bl;
        }
Esempio n. 7
0
        private void test_Load(object sender, EventArgs e)
        {
            string                 _path     = Application.StartupPath + "\\工具配置文件\\TableConfig.xml";
            List <MyConfig>        _menuList = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(_path, Encoding.UTF8);
            BindingList <MyConfig> bl        = new BindingList <MyConfig>(_menuList);

            dg1.DataSource = bl;
        }
Esempio n. 8
0
        private void tvMenu_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode currentNode = e.Node;

            if (currentNode.Parent == null)
            {
                return;
            }

            string fileName = e.Node.Tag.ToString() + ".xml";

            _path     = Path.Combine(Application.StartupPath + "\\工具配置文件\\TableExplain", fileName);
            _menuList = XmlHelper.XmlDeserializeFromFile <List <TableExplain> >(_path, Encoding.UTF8);
            BindingList <TableExplain> bl = new BindingList <TableExplain>(_menuList);

            dg1.DataSource = bl;
        }
Esempio n. 9
0
        /// <summary>
        /// 打开解决方案
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            List <AppConfig> list = XmlHelper.XmlDeserializeFromFile <List <AppConfig> >(Application.StartupPath + "/CustomData/AppConfig.xml", Encoding.UTF8);

            if (list.Count > 0 && !string.IsNullOrEmpty(list[0].CreatePath))
            {
                fileDialog.InitialDirectory = list[0].CreatePath;
            }
            fileDialog.Multiselect = true;
            fileDialog.Title       = "请选择文件";
            fileDialog.Filter      = "Mod解决方案|*.project";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                ClearData();
                string file = fileDialog.FileName;
                Start(file);
            }
        }
Esempio n. 10
0
        private void AttributeList_Load(object sender, EventArgs e)
        {
            string      path = Application.StartupPath + "/工具配置文件/";
            List <Menu> list = XmlHelper.XmlDeserializeFromFile <List <Menu> >(path + _fileName, Encoding.UTF8);

            foreach (Menu ls in list)
            {
                TreeNode node = new TreeNode();
                node.Text = ls.MenuText;
                node.Tag  = ls.MenuTag;
                foreach (KeyValuePair <string, string> dic in DataHelper.ExplainConfig[ls.MenuName])
                {
                    TreeNode chldNode = new TreeNode();
                    chldNode.Text = dic.Value;
                    chldNode.Tag  = dic.Key;
                    node.Nodes.Add(chldNode);
                }
                treeView1.Nodes.Add(node);
            }
        }
Esempio n. 11
0
        private void EventChart_Load(object sender, EventArgs e)
        {
            BindingSource bs = new BindingSource();

            dg1.DataSource = bs;
            bs.DataSource  = DataHelper.DropDownListDict["Public.HuiHe"];

            FileHelper.LoadTable("BattleAreaData");
            FileHelper.LoadTable("RewardData");
            FileHelper.LoadTable("TalkManager");
            FileHelper.LoadTable("DevelopQuestData");

            string path = Application.StartupPath + "\\CustomData\\EventData.xml";

            eventData = XmlHelper.XmlDeserializeFromFile <List <EventData> >(path, Encoding.UTF8);
            if (eventData.Count <= 0)
            {
                JieXi();
                eventData = XmlHelper.XmlDeserializeFromFile <List <EventData> >(path, Encoding.UTF8);
            }
            else
            {
                foreach (EventData ed in eventData)
                {
                    if (ed.Round == null)
                    {
                        continue;
                    }
                    if (!isHaveEvent.ContainsKey(ed.Round))
                    {
                        isHaveEvent.Add(ed.Round, ed.EventId);
                    }
                }
            }
            SetDg1BgColor();
        }
Esempio n. 12
0
        private void Dock_Load(object sender, EventArgs e)
        {
            try
            {
                //如果文件目录不存在提示出错直接返回
                if (!Directory.Exists(DataHelper.FilePath) || !Directory.Exists(DataHelper.FilePath))
                {
                    MessageBox.Show(DataHelper.FilePath + "目录不存在!");
                    return;
                }

                //加载所有表配置
                List <MyConfig> list = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(Application.StartupPath + "/工具配置文件/TableConfig.xml", Encoding.UTF8);
                //加载左侧菜单数据
                List <Menu> menuList = XmlHelper.XmlDeserializeFromFile <List <Menu> >(Application.StartupPath + "/工具配置文件/MenuConfig.xml", Encoding.UTF8);

                ToolsHelper   tl       = new ToolsHelper();
                string        filePath = DataHelper.FilePath;
                DirectoryInfo di       = new DirectoryInfo(filePath);
                DataHelper.GetAllFile(di, DataHelper.DicFile);

                foreach (Menu m in menuList)
                {
                    TreeNode node = new TreeNode();
                    node.Text = m.MenuText;
                    node.Tag  = m.MenuTag;
                    node.Name = m.MenuName;
                    MenuTree.Nodes.Add(node);
                }


                #region 循环窗体配置,并且保存到静态变量中去
                //循环窗体配置
                foreach (MyConfig item in list)
                {
                    if (!DataHelper.DicFile.ContainsKey(item.TxtName))
                    {
                        if (item.TxtName == "NpcProduct.txt" || item.TxtName == "MapInfo.txt")
                        {
                            continue;
                        }
                        DataHelper.newFilesInfo.AppendFormat("文件名:{0}没有对应的配置文件!\r\n", item.TxtName);
                        continue;
                    }
                    TreeNode chldNode = new TreeNode();
                    chldNode.Text = item.Notes + "(" + item.TxtName + ")";
                    chldNode.Tag  = item.MainDtName;
                    chldNode.Name = item.Notes + "(" + item.TxtName + ")";
                    MenuTree.Nodes[item.Classify].Nodes.Add(chldNode);

                    //保存窗体配置文件
                    DataHelper.FormConfig.Add(item.MainDtName, item);
                    DataHelper.ConfigFile.Add(item.TxtName, item.TxtName);
                }
                #endregion

                //foreach (KeyValuePair<string, string> files in DataHelper.DicFile)
                //{
                //    if(!DataHelper.ConfigFile.ContainsKey(files.Key))
                //    {
                //        DataHelper.newFilesInfo.AppendFormat("文件名:{0}没有对应的配置文件!\r\n", files.Value);
                //    }
                //}

                if (DataHelper.DicFile.ContainsKey("MapID.txt"))
                {
                    string mapId = DataHelper.DicFile["MapID.txt"];
                    //读取地图文件,以ID为KEY的字典
                    DataHelper.readConfig(mapId, "mapId");
                    //循环所有地图,加入到左侧菜单
                    foreach (KeyValuePair <string, string> map in DataHelper.SelItem["mapId"])
                    {
                        TreeNode node = new TreeNode();
                        node.Text = map.Value;
                        node.Tag  = "map";
                        node.Name = map.Key;
                        MenuTree.Nodes["map"].Nodes.Add(node);
                    }

                    //读取所有地图文件
                    DirectoryInfo dfMap = new DirectoryInfo(DataHelper.MapPath);
                    DataHelper.GetMapIconFile(dfMap, DataHelper.MapFile);

                    //循环所有地图文件
                    foreach (KeyValuePair <string, string> map in DataHelper.MapFile)
                    {
                        //截取文件名称的关键信息,和大地图匹配
                        string key = map.Key.Substring(9, 8);


                        //保存文件名称,作为数据名称
                        string tableName = map.Key.Substring(0, map.Key.LastIndexOf('.'));

                        //判断地图集合是否存在地图文件
                        if (!DataHelper.SelItem["mapId"].ContainsKey(key))
                        {
                            //截取NPC信息
                            key = map.Key.Substring(11, 8);
                            if (!DataHelper.SelItem["mapId"].ContainsKey(key))
                            {
                                continue;
                            }
                        }


                        TreeNode chldNode = new TreeNode();
                        chldNode.Text = map.Key;
                        chldNode.Tag  = tableName;
                        chldNode.Name = map.Key;
                        MenuTree.Nodes["map"].Nodes[key].Nodes.Add(chldNode);
                    }
                }
                else
                {
                    MessageBox.Show("mod文件夹中缺少Mapid.txt文件,无法正确加载地图文件!");
                }

                //读取下拉框联动配置信息
                DataHelper.readConfig();
                //设置琴棋书画等数值
                DataHelper.SetDicValue();
                //设置回合对应的年月日
                DataHelper.SetHuiHeDicValue();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 13
0
        private void btnBuild_Click(object sender, EventArgs e)
        {
            string          path     = Application.StartupPath + "\\工具配置文件\\TableConfig.xml";
            List <MyConfig> menuList = XmlHelper.XmlDeserializeFromFile <List <MyConfig> >(path, Encoding.UTF8);

            int rowIndex = 1;

            foreach (DataGridViewRow row in dg1.Rows)
            {
                DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)row.Cells["chkSel"];
                Boolean flag = Convert.ToBoolean(checkCell.Value);
                if (flag)
                {
                    string dlcFileName = row.Cells["DlcFileName"].Value.ToString();
                    string dlcFilePath = row.Cells["DlcFilePath"].Value.ToString();
                    string tbName      = dlcFileName.Substring(0, dlcFileName.IndexOf("."));

                    string configFileName    = tbName + ".xml";
                    string configRawFileName = tbName.Substring(4, tbName.Length - 4) + ".xml";
                    string configFilepath    = Path.Combine(Application.StartupPath + "\\工具配置文件\\TableExplain", configFileName);
                    string configRawFilepath = Path.Combine(Application.StartupPath + "\\工具配置文件\\TableExplain", configRawFileName);

                    if (!File.Exists(configRawFilepath))
                    {
                        continue;
                    }


                    MyConfig mc = new MyConfig();
                    mc.TxtName          = dlcFileName;
                    mc.Classify         = "Dlc";
                    mc.Notes            = dlcFileName;
                    mc.HaveColumn       = "NO";
                    mc.IsCache          = "0";
                    mc.DtType           = "3";
                    mc.BasicCritical    = "";
                    mc.EffectCritical   = "";
                    mc.HaveHelperColumn = "";
                    mc.DetailDtName     = "";
                    mc.MainDtName       = tbName;
                    menuList.Add(mc);

                    List <TableExplain> configFileList = new List <TableExplain>();


                    int index = 0;
                    using (StreamReader sr = new StreamReader(dlcFilePath, Encoding.Default))
                    {
                        string names = string.Empty;
                        string ids   = string.Empty;
                        while (index < 2)
                        {
                            if (index == 0)
                            {
                                names = sr.ReadLine(); //读取一行数据
                            }
                            else
                            {
                                ids = sr.ReadLine();
                            }
                            index++;
                        }
                        string[] rowIds   = ids.Split('\t');
                        string[] rowNames = names.Split('\t');

                        List <TableExplain> teList = XmlHelper.XmlDeserializeFromFile <List <TableExplain> >(configRawFilepath, Encoding.UTF8);
                        for (int i = 0; i < rowIds.Length; i++)
                        {
                            TableExplain te = new TableExplain();
                            if (i < 3)
                            {
                                te.IsSelect = "1";
                            }
                            te.Column      = teList[i].Column;
                            te.Explain     = teList[i].Explain;
                            te.Text        = rowNames[i];
                            te.ToolsColumn = teList[i].ToolsColumn;
                            configFileList.Add(te);
                            rowIndex++;
                        }
                        rowIndex = rowIndex + 10;
                    }


                    XmlHelper.XmlSerializeToFile(configFileList, configFilepath, Encoding.UTF8);
                }
            }

            XmlHelper.XmlSerializeToFile(menuList, path, Encoding.UTF8);
            MessageBox.Show("修改成功!");
        }