示例#1
0
 private void Button_lua_Click(object sender, EventArgs e)
 {
     if (textBox_code.Text.Length > 0)
     {
         CCFile.CheckFolder(SET.GamePath + @"script");
         string luafile = SET.GamePath + @"script\c" + textBox_code.Text + ".lua";
         if (!File.Exists(luafile))
         {
             if (MessageBox.Show("是否创建?\n" + luafile, "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 CCFile.WriteText(luafile, "--" + textBox_name.Text + "\n", new UTF8Encoding(false));
             }
         }
         if (File.Exists(luafile))
         {
             if (File.Exists(SET.NPPpath))
             {
                 CCFile.RUN(SET.NPPpath, " \"" + luafile + "\"");
             }
             else
             {
                 luaEditor le = new luaEditor(luafile);
                 le.Show();
             }
         }
     }
 }
示例#2
0
        public static void SaveSet(string file)
        {
            StringBuilder st = new StringBuilder();

            st.Append(@"##这是DataEditor V2的配置文件");
            st.Append("\r\n");            /*
                                           * st.Append(@"##MAX是搜索结果每页最大数量");
                                           * st.Append("\r\n");
                                           * st.Append(@"MAX "+MAX.ToString());
                                           * st.Append("\r\n");*/
            st.Append(@"##Length是裁剪图片的宽高");
            st.Append("\r\n");
            st.Append(@"Length " + Length.ToString());
            st.Append("\r\n");
            st.Append(@"##GameName是游戏王YGOPRO的exe文件名 ");
            st.Append("\r\n");
            st.Append(@"GameName " + GameName);
            st.Append("\r\n");
            st.Append(@"##GamePath是游戏王YGOPRO的文件夹路径 ");
            st.Append("\r\n");
            st.Append(@"GamePath " + GamePath);
            st.Append("\r\n");
            st.Append(@"##NPPpath是notepad++的exe路径");
            st.Append("\r\n");
            st.Append(@"NPPpath " + NPPpath);
            CCFile.WriteText(file, st.ToString(), Encoding.UTF8);
            st = null;
        }
示例#3
0
 private void textBox_alias_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (!CCFile.Check_KeyisInt(e.KeyChar))
     {
         e.Handled = true;
     }
 }
示例#4
0
 private void Copy()
 {
     a = 0;
     foreach (int id in CDB.ids.Values)
     {
         if (stop == false)
         {
             a++;
             CCFile.CopyData(path1, path2, id);
             progressBar1.Invoke(pb1);
             label1.Invoke(lb1);
         }
         else
         {
             break;
         }
     }
     if (stop == true)
     {
         MessageBox.Show("已经取消!");
     }
     else
     {
         stop = true;
         MessageBox.Show("复制完成。\n文件在" + path2);
     }
     this.Invoke(fm);
 }
示例#5
0
        private void ProcessForm_Load(object sender, EventArgs e)
        {
            t         = null;
            stop      = true;
            this.Text = title;
            switch (title)
            {
            case "复制图片,脚本":
                stop = false;
                CCFile.CheckFolder(path2);
                CCFile.CheckFolder(path2 + "pics");
                CCFile.CheckFolder(path2 + "pics\\field");
                CCFile.CheckFolder(path2 + "pics\\thumbnail");
                CCFile.CheckFolder(path2 + "script");
                NUM = CDB.ids.Count;
                t   = new Thread(Copy);
                break;

            case "裁剪图片":
                stop = false;
                CCFile.CheckFolder(path2);
                NUM = CDB.cards.Count;
                t   = new Thread(Cut);
                break;

            case "图片调整":
                stop = false;
                CCFile.CheckFolder(path2);
                CCFile.CheckFolder(path2 + "pics");
                CCFile.CheckFolder(path2 + "pics\\thumbnail");
                names = CCFile.FindFiles(path1, ex, false);
                NUM   = names.Length;
                t     = new Thread(ReSize);
                break;

            case "提取图片":
                stop               = false;
                label1.Text        = "提取中。。。";
                progressBar1.Style = ProgressBarStyle.Marquee;
                NUM = 1;
                t   = new Thread(Get_setjpg);
                break;
            }
            if (t != null && NUM > 0)
            {
                pb1 = new _ProcessBar1(ProcessADD);
                lb1 = new _Label1(Setlabel);
                fm  = new _Form(closeForm);
                progressBar1.Maximum = NUM;
                t.IsBackground       = true;
                t.Start();
            }
            else
            {
                stop = true;
                this.Close();
            }
        }
示例#6
0
        private void ToolStrip_cutfolder_Click(object sender, EventArgs e)
        {
            string cpath = SET.GamePath + "ExportImages";

            if (Directory.Exists(cpath))
            {
                CCFile.Start(cpath);
            }
        }
示例#7
0
        private void textBox_jpg_Click(object sender, EventArgs e)
        {
            string f;

            if (CCFile.SelectFolder(out f, "请选择需要调整的图片文件夹", ""))
            {
                textBox_jpg.Text = f;
            }
        }
示例#8
0
        private void textBox_save_Click(object sender, EventArgs e)
        {
            string f;

            if (CCFile.SelectFolder(out f, "请选择调整后保存的文件夹", ""))
            {
                textBox_save.Text = f;
            }
        }
示例#9
0
        private void Read(Encoding encode)
        {
            string str;

            if (CCFile.ReadText(file, out str, encode))
            {
                str           = str.Replace("\n", "\r\n");
                textBox1.Text = str;
            }
        }
示例#10
0
        private void ToolStrip_startcut_Click(object sender, EventArgs e)
        {
            string f;

            if (CCFile.SelectOpenFile(out f, "请选择MSE存档。", "mse-set", ""))
            {
                ProcessForm pf = new ProcessForm(f, path + "Images\\");
                pf.ShowDialog();
            }
        }
示例#11
0
        private void textBox_save_Click(object sender, EventArgs e)
        {
            string f;

            if (CCFile.SelectSaveFile(out f, @"mse-set", "请保存MSE存档", ""))
            {
                textBox_save.Text = f;
                isok = true;
            }
        }
示例#12
0
        private void ToolStrip_copycards_Click(object sender, EventArgs e)
        {
            string cdb = "diy.cdb";

            if (CCFile.SelectOpenFile(out cdb, "数据将要复制到->选择的数据库", "cdb", SET.GamePath))
            {
                CDB.Updata(cdb);
                MessageBox.Show("复制完成!", "提示");
            }
        }
示例#13
0
 private void ToolStrip_notepad_Click(object sender, EventArgs e)
 {
     if (CCFile.SelectOpenFile(out SET.NPPpath, "请选择lua编辑器(notepad++.exe)", "exe", ""))
     {
         if (File.Exists(SET.NPPpath))
         {
             SET.SaveSet(setfile);
             ToolStrip_notepad.ToolTipText = SET.NPPpath;
         }
     }
 }
示例#14
0
        private void ToolStrip_ReadYDK_Click(object sender, EventArgs e)
        {
            string file;

            if (CCFile.SelectOpenFile(out file, "请选择卡组文件(.ydk)", "ydk", SET.GamePath + "deck"))
            {
                CDB.Read(CDBfile, CCFile.ReadYDK(file));
                Count = CDB.ids.Count;
                SetNum();
                Add_cardslist();
            }
        }
示例#15
0
        private void ToolStrip_openCDB_Click(object sender, EventArgs e)
        {
            string file;

            if (CCFile.SelectOpenFile(out file, "请输入新数据库的名字", "cdb", ""))
            {
                CDBfile = file;
                SET.LastCDB.Add(file);
                this.Text = CDBfile + "  -DataEditor V2";
                ReadData();
            }
        }
示例#16
0
        private void ToolStrip_SearchJPG_Click(object sender, EventArgs e)
        {
            string path;

            if (CCFile.SelectFolder(out path, "请选择:\n需要读取的卡片的图片文件夹(jpg格式)", ""))
            {
                CDB.Read(CDBfile, CCFile.FindFiles(path, "jpg", false));
                Count = CDB.ids.Count;
                SetNum();
                Add_cardslist();
            }
        }
示例#17
0
        private void ToolStrip_newCDB_Click(object sender, EventArgs e)
        {
            string file;

            if (CCFile.SelectSaveFile(out file, "cdb", "请输入新数据库的名字", SET.GamePath))
            {
                CDBfile = file;
                CDB.Create(file);
                SET.LastCDB.Add(file);
                this.Text = CDBfile + "  -DataEditor V2";
                ReadData();
            }
        }
示例#18
0
 private void ToolStrip_cdblist_MouseEnter(object sender, EventArgs e)
 {
     ToolStrip_cdblist.DropDownItems.Clear();
     ToolStrip_cdblist.DropDownItems.Add(@"新建数据库(&D)", null, ToolStrip_newCDB_Click);
     ToolStrip_cdblist.DropDownItems[0].ToolTipText = "创建一个空白的数据库";
     ToolStrip_cdblist.DropDownItems.Add(@"打开数据库(&O)", null, ToolStrip_openCDB_Click);
     ToolStrip_cdblist.DropDownItems[1].ToolTipText = "打开一个其他位置的数据库";
     if (!SET.GamePath.Equals(path))
     {
         SET.AddCDB(CCFile.FindFiles(path, "cdb", true));
     }
     SET.AddCDB(CCFile.FindFiles(SET.GamePath, "cdb", true));
     AddCDBlist();
 }
示例#19
0
        private void ToolStrip_open_Click(object sender, EventArgs e)
        {
            string f;

            if (CCFile.SelectOpenFile(out f, "请选择脚本文件(.lua)", "lua", SET.GamePath + "script"))
            {
                if (System.IO.File.Exists(f))
                {
                    file      = f;
                    this.Text = f;
                    Read(enc);
                }
            }
        }
示例#20
0
        private CardData GetCard()
        {
            int      i    = 0;
            CardData data = new CardData();

            {
                int.TryParse(textBox_code.Text, out data.code);
                int.TryParse(textBox_atk.Text, out data.attack);
                int.TryParse(textBox_def.Text, out data.defence);
                int.TryParse(textBox_alias.Text, out data.alias);
            }
            {
                data.level = comboBox_level.SelectedIndex;
                data.name  = textBox_name.Text;
                data.text  = textBox_desc.Text;
                data.desc  = str;
                data.ot    = comboBox_rule.SelectedIndex;
            }
            if (textBox_setname.Visible == true)
            {
                int.TryParse(textBox_setname.Text.Replace("0x", ""), System.Globalization.NumberStyles.HexNumber, null, out data.setcode);
            }
            else
            {
                data.setcode  = CCFile.Getint(SET.setname, comboBox_setname1.Text);
                data.setcode += (CCFile.Getint(SET.setname, comboBox_setname2.Text) << 0x10);
            }
            i = comboBox_race.SelectedIndex;
            if (i == 0)
            {
                data.race = 0;
            }
            else
            {
                data.race = ((int)1) << (i - 1);
            }
            i = comboBox_attribute.SelectedIndex;
            if (i == 0)
            {
                data.attribute = 0;
            }
            else
            {
                data.attribute = ((int)1) << (i - 1);
            }
            data.type     = Get_type();
            data.category = Get_category();
            return(data);
        }
示例#21
0
        public static void Savesetname(string file)
        {
            StringBuilder st = new StringBuilder();

            foreach (int key in setname.Keys)
            {
                st.Append("0x");
                st.Append(key.ToString("x"));
                st.Append(" ");
                st.Append(setname[key]);
                st.Append("\r\n");
            }
            CCFile.WriteText(file, st.ToString(), Encoding.UTF8);
            st = null;
        }
示例#22
0
        private void ToolStrip_game_Click(object sender, EventArgs e)
        {
            string str     = " -debug ";
            string CDBname = CCFile.GetName(CDBfile);

            if (File.Exists(SET.GamePath + SET.GameName) && CDBname.Length > 0)
            {
                if (!CDBname.Equals("cards.cdb", StringComparison.OrdinalIgnoreCase))
                {
                    str += " -e" + CDBname;
                }
            }
            MessageBox.Show("游戏参数:" + str);
            CCFile.RUN(SET.GamePath + SET.GameName, str);
        }
示例#23
0
 private void button_ok_Click(object sender, EventArgs e)
 {
     if (isok == true)
     {
         button_ok.Enabled = false;
         button_ok.Text    = "请等待";
         MSE.MSEmake(CDB.cards, textBox_jpg.Text, comboBox_lang.Text, comboBox_style.Text);
         string str = " a -tzip " + textBox_save.Text + @" @list.txt";
         CCFile._7zip(path, textBox_jpg.Text, str);
         File.Delete(textBox_jpg.Text + "set");
         File.Delete(textBox_jpg.Text + "list.txt");
         MessageBox.Show("制作完成");
         button_ok.Text    = "开始导出";
         button_ok.Enabled = true;
     }
 }
示例#24
0
        private void ToolStrip_gamepath_Click(object sender, EventArgs e)
        {
            string str = "";

            if (CCFile.SelectOpenFile(out str, "请选择游戏文件(ygopro_vs.exe)", "exe", ""))
            {
                if (File.Exists(str))
                {
                    SET.GameName = CCFile.GetName(str);
                    SET.GamePath = CCFile.GetPath(str);
                    SET.SaveSet(setfile);
                    ToolStrip_gamepath.ToolTipText = SET.GamePath;
                    ToolStrip_game.ToolTipText     = SET.GameName;
                }
            }
        }
示例#25
0
 private void Setcard(int id)
 {
     if (CDB.cards.ContainsKey(id))
     {
         int      index;
         int      snum;
         CardData data = CDB.cards[id];
         textBox_code.Text    = data.code.ToString();
         textBox_name.Text    = data.name;
         textBox_desc.Text    = data.text.Replace("\n", "\r\n");
         textBox_setname.Text = "0x" + data.setcode.ToString("x");
         listBox_str.Items.Clear();
         str = data.desc;
         for (index = 0; index < 0x10; index++)
         {
             listBox_str.Items.Add(data.desc[index]);
         }
         textBox_atk.Text                 = data.attack.ToString();
         textBox_def.Text                 = data.defence.ToString();
         textBox_alias.Text               = data.alias.ToString();
         comboBox_level.SelectedIndex     = data.level;
         comboBox_rule.SelectedIndex      = data.ot;
         comboBox_race.SelectedIndex      = CCFile.GetSelectIndex(data.race);
         comboBox_attribute.SelectedIndex = CCFile.GetSelectIndex(data.attribute);
         snum = data.setcode & 0xffff;
         if (!SET.setname.ContainsKey(snum))
         {
             SET.setname.Add(snum, data.name);
             Resetname();
         }
         comboBox_setname1.Text = SET.setname[snum];
         snum = data.setcode >> 0x10;
         if (!SET.setname.ContainsKey(snum))
         {
             SET.setname.Add(snum, data.name);
             Resetname();
         }
         comboBox_setname2.Text = SET.setname[snum];
         SetChecked_type(data.type);
         SetChecked_category(data.category);
         textBox_str.Text            = "";
         tabPage_jpg.BackgroundImage = CCFile.Setjpg(SET.GamePath, ToolStrip_yulan.Checked, id, SET.Length);
     }
 }
示例#26
0
        private void tabPage_jpg_DragDrop(object sender, DragEventArgs e)
        {
            if (textBox_code.Text.Length > 0)
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string str = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

                    if (str.EndsWith("jpg", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("png", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("bmp", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (MessageBox.Show("是否把调整图片", "提示", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                        {
                            CCFile.CheckFolder(SET.GamePath + "pics");
                            CCFile.CheckFolder(SET.GamePath + "pics\\thumbnail");
                            PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 177, 254), SET.GamePath + "pics\\" + textBox_code.Text + ".jpg", 96);
                            PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 44, 64), SET.GamePath + "pics\\thumbnail\\" + textBox_code.Text + ".jpg", 96);
                            MessageBox.Show("调整完成!");
                        }
                    }
                }
            }
        }
示例#27
0
 private void ToolStrip_opengpath_Click(object sender, EventArgs e)
 {
     CCFile.Start(SET.GamePath);
 }
示例#28
0
 private void ToolStrip_netdisk_Click(object sender, EventArgs e)
 {
     CCFile.Start(baidu);
 }
示例#29
0
 private void ToolStrip_opencutjpg_Click(object sender, EventArgs e)
 {
     CCFile.Start(path + "Images\\");
 }
示例#30
0
 private void GetSelect()
 {
     select_str = CCFile.GetSelect(GetCard());
 }