Beispiel #1
0
        private void JieXi()
        {
            List <EventData> listEvent = new List <EventData>();

            foreach (DataRow dr in DataHelper.XkfyData.Tables["DevelopQuestData"].Rows)
            {
                string   iType      = dr["iType"].ToString();
                string[] iArg1      = dr["iArg1"].ToString().Split(',');
                string[] iArg2      = dr["iArg2"].ToString().Split(',');
                string[] iCondition = dr["iCondition"].ToString().Split(',');

                EventData ed = new EventData();
                ed.EventId = dr["iID"].ToString();
                for (int i = 0; i < iCondition.Length; i++)
                {
                    if (iCondition[i] == "7")
                    {
                        ed.Round = iArg1[i];
                    }

                    if (iCondition[i] == "9")
                    {
                        ed.ParantId = iArg1[i];
                    }
                }
                if (!string.IsNullOrWhiteSpace(ed.ParantId) || !string.IsNullOrWhiteSpace(ed.Round))
                {
                    listEvent.Add(ed);
                }
            }
            string path = Application.StartupPath + "\\CustomData\\EventData.xml";

            XmlHelper.XmlSerializeToFile(listEvent, path, Encoding.UTF8);
        }
Beispiel #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     XmlHelper.XmlSerializeToFile(_menuList, _path, Encoding.UTF8);
     CboData.BindiComboBox(_cb, _path);
     MessageBox.Show("修改成功!");
     this.Close();
 }
Beispiel #3
0
        /// <summary>
        /// 新建解决方案
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmCreate_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folder = new FolderBrowserDialog();

            folder.SelectedPath = Application.StartupPath + "\\修改后的文件";
            if (folder.ShowDialog() == DialogResult.OK)
            {
                AppConfig ac = new AppConfig();
                ac.CreatePath = folder.SelectedPath;

                List <AppConfig> listAc = new List <AppConfig>();
                listAc.Add(ac);
                //保存Mod的路径,方便选择
                string appConfigPath = Application.StartupPath + "\\CustomData\\AppConfig.xml";
                XmlHelper.XmlSerializeToFile(listAc, appConfigPath, Encoding.UTF8);

                string filePath = Application.StartupPath + "\\原始文件";
                FileUtils.CopyFolderTo(filePath, folder.SelectedPath);
                ClearData();
                Start(folder.SelectedPath);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 新建解决方案
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmCreate_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folder = new FolderBrowserDialog();

            folder.SelectedPath = FilePathHelper.DefaultSelectFilePath;
            if (folder.ShowDialog() == DialogResult.OK)
            {
                ModConfig mc = new ModConfig();
                mc.Name = "ModFiles";
                mc.Path = "Config";//FilePathHelper.ModsFolder;

                ModConfig mc1 = new ModConfig();
                mc1.Name = "ToolFiles";
                mc1.Path = "ToolFiles";

                List <ModConfig> list = new List <ModConfig>();
                list.Add(mc);
                list.Add(mc1);
                string xmlFileName = folder.SelectedPath + "\\xkfy.project";

                //保存mod方案文件
                XmlHelper.XmlSerializeToFile(list, xmlFileName, Encoding.UTF8);

                AppConfig ac = new AppConfig();
                ac.CreatePath = folder.SelectedPath;

                List <AppConfig> listAc = new List <AppConfig>();
                listAc.Add(ac);
                //保存Mod的路径,方便选择
                string appConfigPath = Application.StartupPath + "\\工具配置文件\\AppConfig.xml";
                XmlHelper.XmlSerializeToFile(listAc, appConfigPath, Encoding.UTF8);

                CopyFolderTo(FilePathHelper.FullModsFolder, Path.Combine(folder.SelectedPath, FilePathHelper.GameModsFolder));
                ClearData();
                Start(xmlFileName);
            }
        }
Beispiel #5
0
        private void tsmImportXML_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Multiselect = true;
            fileDialog.Title       = "请选择文件";
            fileDialog.Filter      = "1.1MOD的注释文件|*.xml";

            DataTable dt = new DataTable();

            dt.Columns.Add("tablename");
            dt.Columns.Add("column");
            dt.Columns.Add("Value");

            Dictionary <string, string> dlcTbName = new Dictionary <string, string>();
            StringBuilder sb = new StringBuilder();

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                string      file = fileDialog.FileName;
                XmlDocument doc  = new XmlDocument();
                doc.Load(file);                                                    //加载Xml文件
                XmlElement  rootElem    = doc.DocumentElement;                     //获取根节点
                XmlNodeList personNodes = rootElem.GetElementsByTagName("Table1"); //获取person子节点集合
                foreach (XmlNode node in personNodes)
                {
                    XmlNodeList tablename = ((XmlElement)node).GetElementsByTagName("tablename");  //获取age子XmlElement集合
                    XmlNodeList column    = ((XmlElement)node).GetElementsByTagName("column");
                    XmlNodeList value     = ((XmlElement)node).GetElementsByTagName("Value");
                    string      tbName    = tablename[0].InnerText;
                    if (!dlcTbName.ContainsKey(tbName))
                    {
                        dlcTbName.Add(tbName, tbName);
                    }
                    DataRow dr = dt.NewRow();
                    dr["tablename"] = tbName;
                    dr["column"]    = column[0].InnerText;
                    dr["Value"]     = value[0].InnerText;
                    dt.Rows.Add(dr);
                }
            }
            ToolsHelper tl   = new ToolsHelper();
            string      path = Application.StartupPath + "\\工具配置文件\\TableExplain";

            foreach (KeyValuePair <string, string> dlc in dlcTbName)
            {
                List <TableExplain> list = new List <TableExplain>();
                DataRow[]           drs  = dt.Select("tablename='" + dlc.Key + "'");
                foreach (DataRow item in drs)
                {
                    TableExplain te = new TableExplain();
                    te.Column = item["column"].ToString();
                    string value = item["Value"].ToString();
                    if (StringUtils.GetCnLength(value) <= 8)
                    {
                        te.Text = value;
                    }
                    te.Explain = item["Value"].ToString();

                    list.Add(te);
                }
                XmlHelper.XmlSerializeToFile(list, Path.Combine(path, dlc.Key), Encoding.UTF8);
                MessageBox.Show("导入成功!");
            }
        }
Beispiel #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     XmlHelper.XmlSerializeToFile(_menuList, _path, Encoding.UTF8);
     MessageBox.Show("修改成功!");
 }
Beispiel #7
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("修改成功!");
        }