Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string dir      = "/data/source/player/M2/部件/";
            string outputM2 = DirectoryToString(dir);

            FileFolderHelper.StringToFile(outputM2, "../output3_M2.tab");

            dir = "/data/source/player/F2/部件/";
            string outputF2 = DirectoryToString(dir);

            FileFolderHelper.StringToFile(outputF2, "../output3_F2.tab");
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (bImport)
            {
                // 导入到数据表:mm_sword3Item
                Helper.ClearDbTable("mm_sword3Item", Conn);
                bool bSucc = Helper.ImportTab("mm_sword3Item", sword3itemtabfile, Conn);
                if (!bSucc)
                {
                    MessageBox.Show("导入失败!");
                    return;
                }
            }


            ReInitMtl3();

            StringBuilder sb = new StringBuilder();

            sb.Append("RepresentID"); sb.Append('\t');
            sb.Append("套名"); sb.Append('\t');
            sb.Append("Color"); sb.Append('\t');
            sb.Append("m1"); sb.Append('\t');
            sb.Append("m2"); sb.Append('\t');
            sb.Append("m2_m3"); sb.Append('\t');
            sb.Append("m3"); sb.Append('\t');
            sb.Append("f1"); sb.Append('\t');
            sb.Append("f2"); sb.Append('\t');
            sb.Append("f2_f3"); sb.Append('\t');
            sb.Append("f3"); sb.Append('\t');

            sb.Append("部件"); sb.Append('\t');
            sb.Append("删除重复前"); sb.Append('\t');
            sb.Append("删除重复后"); sb.Append('\t');
            sb.Append("Name"); sb.Append('\t');
            sb.Append("GetType"); sb.Append('\t');
            sb.Append("Quality"); sb.Append('\t');
            sb.Append("Level"); sb.Append('\t');
            sb.Append("RequireLevel");
            sb.Append("\r\n");

            DataTable tblColorNum   = Helper.GetDataTable("select * from mm_colorNum order by representid", Conn);
            DataTable tblEquipName  = Helper.GetDataTable("select * from mm_EquipName order by name", Conn);
            DataTable tblSword3Item = Helper.GetDataTable("select * from mm_sword3Item order by tabtype, id", Conn);

            foreach (DataRow row in tblColorNum.Rows)
            {
                int    representid = Convert.ToInt32(row["RepresentID"]);
                int    colorNum    = Convert.ToInt32(row["ColorNum"]);
                string name        = row["Name"].ToString().Trim();

                for (int color = 1; color <= colorNum; color++)
                {
                    foreach (DataRow r in tblEquipName.Rows)
                    {
                        string equip   = r["name"].ToString().Trim();
                        string equipcn = r["name_cn"].ToString().Trim();

                        string    strselect = string.Format("RepresentID={0} and 实际偏色={1} and 部件='{2}'", representid, color, equipcn);
                        DataRow[] rowsMatch = tblSword3Item.Select(strselect, "TabType, ID");

                        // 先看看去掉重复名字后的装备有多少
                        ArrayList namesArr = new ArrayList();
                        foreach (DataRow rowMatch in rowsMatch)
                        {
                            string namematch = rowMatch["Name"].ToString().Trim();
                            if (!namesArr.Contains(namematch))
                            {
                                namesArr.Add(namematch);
                            }
                        }
                        int CountNoDup = namesArr.Count;

                        foreach (DataRow rowMatch in rowsMatch)
                        {
                            string namematch    = rowMatch["Name"].ToString().Trim();
                            string gettype      = rowMatch["GetType"].ToString().Trim();
                            string quality      = rowMatch["Quality"].ToString().Trim();
                            string level        = rowMatch["Level"].ToString().Trim();
                            string requirelevel = rowMatch["RequireLevel"].ToString().Trim();

                            sb.Append(representid); sb.Append('\t');
                            sb.Append(name); sb.Append('\t');
                            sb.Append(color); sb.Append('\t');

                            foreach (string playermodel in playermodels)
                            {
                                string targetFile = equip + "_" + playermodel + ".txt";
                                targetFile = client + "/represent/player/equip/" + targetFile;
                                string mtl = FindMtlInFile(targetFile, representid);
                                sb.Append(mtl); sb.Append('\t');

                                if (playermodel == "m2" || playermodel == "f2")
                                {
                                    if (mtl3.ContainsKey(mtl.ToLower()))
                                    {
                                        sb.Append("√"); sb.Append('\t');
                                        mtl3[mtl.ToLower()] = true;
                                    }
                                    else
                                    {
                                        sb.Append(string.Empty); sb.Append('\t');
                                    }
                                }
                            }
                            sb.Append(equipcn); sb.Append('\t');
                            sb.Append(rowsMatch.Length); sb.Append('\t');
                            sb.Append(CountNoDup); sb.Append('\t');
                            sb.Append(namematch); sb.Append('\t');
                            sb.Append(gettype); sb.Append('\t');
                            sb.Append(quality); sb.Append('\t');
                            sb.Append(level); sb.Append('\t');
                            sb.Append(requirelevel);
                            sb.Append("\r\n");
                        }
                    }
                }
            }

            // 输出m3中没用到的
            OutputRestMtl3(ref sb);

            string content = sb.ToString();

            FileFolderHelper.StringToFile(content, "../output1.tab");
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            ReInitMtl3();

            string[] mdlplugs = { "head", "body", "leg", "hand", "belt", "plait", "bang" };

            // 第一行
            StringBuilder sb = new StringBuilder();

            sb.Append("RepresentID"); sb.Append('\t');
            sb.Append("Map"); sb.Append('\t');
            sb.Append("Name"); sb.Append('\t');
            sb.Append("MainModelFile"); sb.Append('\t');
            sb.Append("IsPlayerModel"); sb.Append('\t');
            foreach (string mdlplug in mdlplugs)
            {
                sb.Append(mdlplug); sb.Append('\t');
                sb.Append(mdlplug + "_m3"); sb.Append('\t');
            }
            sb.Append("\r\n");

            //
            string    sql    = @"SELECT RepresentID, map, Model, IsPlayerModel, MainModelFile FROM npc WHERE (IsPlayerModel = 1) ORDER BY map, Model";
            DataTable TblNpc = Helper.GetDataTable(sql, Conn);

            foreach (DataRow row in TblNpc.Rows)
            {
                int    representid   = Convert.ToInt32(row["RepresentID"]);
                string map           = row["map"].ToString().Trim();
                string model         = row["Model"].ToString().Trim();
                int    isplayermodel = Convert.ToInt32(row["IsPlayerModel"]);
                string mainmodelfile = row["MainModelFile"].ToString().Trim();

                sb.Append(representid); sb.Append('\t');
                sb.Append(map); sb.Append('\t');
                sb.Append(model); sb.Append('\t');
                sb.Append(mainmodelfile); sb.Append('\t');
                sb.Append(isplayermodel); sb.Append('\t');

                string   file           = client + "/" + mainmodelfile;
                string   mdlFileContent = FileFolderHelper.FileToString(file);
                string[] lines          = mdlFileContent.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

                string[] htMtl = { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };
                string[] htM3  = { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty };

                foreach (string line in lines)
                {
                    string linelow = line.ToLower();

                    // 忽略首行
                    if (line.Contains(".txt"))
                    {
                        continue;
                    }

                    string[] cols    = linelow.Split(new string[] { "  " }, StringSplitOptions.RemoveEmptyEntries);
                    string   meshmtl = cols[cols.Length - 1]; // 取出mtl或者mesh
                    meshmtl = meshmtl.Substring(meshmtl.LastIndexOf('\\') + 1);
                    meshmtl = meshmtl.Replace(".mesh", string.Empty);
                    meshmtl = meshmtl.Replace(".mtl", string.Empty);

                    for (int i = 0; i < mdlplugs.Length; i++)
                    {
                        if (meshmtl.Contains(mdlplugs[i]))
                        {
                            htMtl[i] = meshmtl;
                            break;
                        }
                    }

                    for (int i = 0; i < htMtl.Length; i++)
                    {
                        if (mtl3.ContainsKey(htMtl[i]))
                        {
                            htM3[i]        = "√";
                            mtl3[htMtl[i]] = true;
                        }
                    }
                }

                for (int i = 0; i < htMtl.Length; i++)
                {
                    sb.Append(htMtl[i]);
                    sb.Append('\t');
                    sb.Append(htM3[i]);
                    sb.Append('\t');
                }

                sb.Append("\r\n");
            }

            // 输出m3中没用到的
            OutputRestMtl3(ref sb);

            string filecontent = sb.ToString();

            FileFolderHelper.StringToFile(filecontent, "../output2.tab");
        }