diff --git a/DataEditorX/Config/MyConfig.cs b/DataEditorX/Config/MyConfig.cs index e9b8ee3..ef20171 100644 --- a/DataEditorX/Config/MyConfig.cs +++ b/DataEditorX/Config/MyConfig.cs @@ -22,6 +22,10 @@ public static class MyConfig /// public const string PATH_DATA = "data"; /// + /// images directory + /// + public const string PATH_IMAGES = "Images"; + /// /// MSE /// public const string TAG_MSE_LANGUAGE = "mse_language"; diff --git a/DataEditorX/Core/MyTask.cs b/DataEditorX/Core/MyTask.cs index 0c4cf59..26bf97b 100644 --- a/DataEditorX/Core/MyTask.cs +++ b/DataEditorX/Core/MyTask.cs @@ -12,8 +12,6 @@ public enum MyTask CheckUpdate, ///导出数据 ExportData, - ///保存为MSE存档 - SaveAsMSE, ///裁剪图片 CutImages, ///转换图片 diff --git a/DataEditorX/Core/TaskHelper.cs b/DataEditorX/Core/TaskHelper.cs index 7d5968a..0d07f12 100644 --- a/DataEditorX/Core/TaskHelper.cs +++ b/DataEditorX/Core/TaskHelper.cs @@ -8,14 +8,11 @@ using DataEditorX.Common; using DataEditorX.Config; using DataEditorX.Core.Info; -using DataEditorX.Core.Mse; using DataEditorX.Language; using System; -using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; -using System.IO.Compression; using System.Windows.Forms; namespace DataEditorX.Core @@ -48,10 +45,6 @@ public class TaskHelper /// private readonly ImageSet imgSet = new(); /// - /// MSE转换 - /// - private readonly MseMaker mseHelper = new(); - /// /// 是否取消 /// private bool isCancel = false; @@ -69,10 +62,7 @@ public TaskHelper(string datapath, BackgroundWorker worker) Datapath = datapath; this.worker = worker; } - public MseMaker MseHelper - { - get { return mseHelper; } - } + public string Datapath { get; } public bool IsRuning() { return isRun; @@ -166,9 +156,10 @@ public void CutImages(string imgpath, bool isreplace) } i++; - worker.ReportProgress((i / count), string.Format("{0}/{1}", i, count)); + worker.ReportProgress(i / count, string.Format("{0}/{1}", i, count)); string jpg = MyPath.Combine(imgpath, $"{c.id}.jpg"); - string savejpg = MyPath.Combine(mseHelper.ImagePath, $"{c.id}.jpg"); + string outputPath = MyPath.Combine(Application.StartupPath, MyConfig.PATH_IMAGES); + string savejpg = MyPath.Combine(outputPath, $"{c.id}.jpg"); if (File.Exists(jpg) && (isreplace || !File.Exists(savejpg))) { using Bitmap bp = new(jpg); @@ -223,98 +214,6 @@ public void ConvertImages(string imgpath, string gamepath, bool isreplace) } #endregion - #region MSE存档 - public string Datapath { get; } - - public void SaveMSEs(string file, Card[] cards, bool isUpdate) - { - if (cards is null || cards.Length == 0) - { - return; - } - - string pack_db = MyPath.GetRealPath(MyConfig.ReadString("pack_db")); - bool rarity = MyConfig.ReadBoolean("mse_auto_rarity", false); -#if DEBUG - MessageBox.Show("db = " + pack_db + ",auto rarity=" + rarity); -#endif - int c = cards.Length; - //不分开,或者卡片数小于单个存档的最大值 - if (mseHelper.MaxNum == 0 || c < mseHelper.MaxNum) - { - SaveMSE(1, file, cards, pack_db, rarity, isUpdate); - } - else - { - int nums = c / mseHelper.MaxNum; - if (nums * mseHelper.MaxNum < c)//计算需要分多少个存档 - { - nums++; - } - - List clist = new(); - for (int i = 0; i < nums; i++)//分别生成存档 - { - clist.Clear(); - for (int j = 0; j < mseHelper.MaxNum; j++) - { - int index = i * mseHelper.MaxNum + j; - if (index < c) - { - clist.Add(cards[index]); - } - } - int t = file.LastIndexOf(".mse-set"); - string fname = (t > 0) ? file.Substring(0, t) : file; - fname += string.Format("_{0}.mse-set", i + 1); - SaveMSE(i + 1, fname, clist.ToArray(), pack_db, rarity, isUpdate); - } - } - } - public void SaveMSE(int num, string file, Card[] cards, string pack_db, bool rarity, bool isUpdate) - { - string setFile = file + ".txt"; - Dictionary images = mseHelper.WriteSet(setFile, cards, pack_db, rarity); - if (isUpdate)//仅更新文字 - { - return; - } - - try - { - using FileStream fs = new(file, FileMode.Create, FileAccess.Write); - using ZipArchive archive = new(fs, ZipArchiveMode.Create, false); - // 添加文字到压缩包,内部文件名固定为 "set" - archive.CreateEntryFromFile(setFile, "set"); - - int i = 0; - foreach (var kvp in images) - { - Card c = kvp.Key; - string img = kvp.Value; - if (isCancel) - { - break; - } - - i++; - worker.ReportProgress(i * 100 / images.Count, string.Format("{0}/{1}-{2}", i, images.Count, num)); - - // 获取需要写入的最终图片(可包含裁剪/缓存逻辑) - string cachePath = mseHelper.GetImageCache(img, c); - string entryName = Path.GetFileName(img); - if (File.Exists(cachePath)) - { - archive.CreateEntryFromFile(cachePath, entryName); - } - } - } - catch (Exception) - { - } - } - #endregion - #region 导出数据 public void ExportData(string path, string zipname, string _cdbfile, string modulescript) { @@ -409,13 +308,6 @@ public void Run() CutImages(mArgs[0], replace); } break; - case MyTask.SaveAsMSE: - if (mArgs.Length >= 2) - { - bool replace = (mArgs.Length >= 2) ? (mArgs[1] == bool.TrueString) : false; - SaveMSEs(mArgs[0], CardList, replace); - } - break; case MyTask.ConvertImages: if (mArgs.Length >= 2) { diff --git a/DataEditorX/DataEditForm.Designer.cs b/DataEditorX/DataEditForm.Designer.cs index 8776f91..680a066 100644 --- a/DataEditorX/DataEditForm.Designer.cs +++ b/DataEditorX/DataEditForm.Designer.cs @@ -38,9 +38,6 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.mainMenu = new System.Windows.Forms.MenuStrip(); - this.menu_image = new System.Windows.Forms.ToolStripMenuItem(); - this.menuitem_saveasmse_select = new System.Windows.Forms.ToolStripMenuItem(); - this.menuitem_saveasmse = new System.Windows.Forms.ToolStripMenuItem(); this.menu_data = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_operacardsfile = new System.Windows.Forms.ToolStripMenuItem(); this.menuitem_default_script = new System.Windows.Forms.ToolStripMenuItem(); @@ -131,7 +128,6 @@ private void InitializeComponent() // mainMenu // this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menu_image, this.menu_data, this.menuitem_help}); this.mainMenu.Location = new System.Drawing.Point(0, 0); @@ -140,29 +136,6 @@ private void InitializeComponent() this.mainMenu.TabIndex = 0; this.mainMenu.Text = "mainMenu"; // - // menu_image - // - this.menu_image.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menuitem_saveasmse_select, - this.menuitem_saveasmse}); - this.menu_image.Name = "menu_image"; - this.menu_image.Size = new System.Drawing.Size(66, 20); - this.menu_image.Text = "Image(&I)"; - // - // menuitem_saveasmse_select - // - this.menuitem_saveasmse_select.Name = "menuitem_saveasmse_select"; - this.menuitem_saveasmse_select.Size = new System.Drawing.Size(193, 22); - this.menuitem_saveasmse_select.Text = "Select Save As MSE"; - this.menuitem_saveasmse_select.Click += new System.EventHandler(this.Menuitem_saveasmse_selectClick); - // - // menuitem_saveasmse - // - this.menuitem_saveasmse.Name = "menuitem_saveasmse"; - this.menuitem_saveasmse.Size = new System.Drawing.Size(193, 22); - this.menuitem_saveasmse.Text = "All Now Save As MSE"; - this.menuitem_saveasmse.Click += new System.EventHandler(this.Menuitem_saveasmseClick); - // // menu_data // this.menu_data.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1148,10 +1121,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem menuitem_readimages; private System.Windows.Forms.ToolStripMenuItem menuitem_readydk; private System.Windows.Forms.MenuStrip mainMenu; - private System.Windows.Forms.ToolStripMenuItem menu_image; private System.Windows.Forms.ToolStripSeparator tsep6; - private System.Windows.Forms.ToolStripMenuItem menuitem_saveasmse_select; - private System.Windows.Forms.ToolStripMenuItem menuitem_saveasmse; private System.Windows.Forms.ToolStripMenuItem menuitem_cutimages; private System.Windows.Forms.ToolStripMenuItem menuitem_operacardsfile; private System.Windows.Forms.ToolStripSeparator tsep2; diff --git a/DataEditorX/DataEditForm.cs b/DataEditorX/DataEditForm.cs index 236884a..7fc54c7 100644 --- a/DataEditorX/DataEditForm.cs +++ b/DataEditorX/DataEditForm.cs @@ -8,7 +8,6 @@ using DataEditorX.Common; using DataEditorX.Config; using DataEditorX.Core; -using DataEditorX.Core.Mse; using DataEditorX.Language; using System; using System.Collections; @@ -1143,9 +1142,6 @@ void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerC case MyTask.CutImages: MyMsg.Show(LMSG.CutImageOK); break; - case MyTask.SaveAsMSE: - MyMsg.Show(LMSG.SaveMseOK); - break; case MyTask.ConvertImages: MyMsg.Show(LMSG.ConvertImageOK); break; @@ -1197,7 +1193,7 @@ public void SaveCards(Card[] cards) } #endregion - #region MSE存档/裁剪图片 + #region 裁剪图片 //裁剪图片 void Menuitem_cutimagesClick(object sender, EventArgs e) { @@ -1215,48 +1211,6 @@ void Menuitem_cutimagesClick(object sender, EventArgs e) tasker.SetTask(MyTask.CutImages, cardlist.ToArray(), ygopath.picpath, isreplace.ToString()); Run(LanguageHelper.GetMsg(LMSG.CutImage)); } - void Menuitem_saveasmse_selectClick(object sender, EventArgs e) - { - //选择 - SaveAsMSE(true); - } - - void Menuitem_saveasmseClick(object sender, EventArgs e) - { - //全部 - SaveAsMSE(false); - } - void SaveAsMSE(bool onlyselect) - { - if (!IsOpened()) - { - return; - } - - if (isRun()) - { - return; - } - - Card[] cards = GetCardList(onlyselect); - if (cards.Length == 0) - { - return; - } - //select save mse-set - using SaveFileDialog dlg = new(); - dlg.Title = LanguageHelper.GetMsg(LMSG.SelectMseSet); - dlg.Filter = MyConfig.MSE_TYPE; - if (dlg.ShowDialog() == DialogResult.OK) - { - bool isUpdate = false; -#if DEBUG - isUpdate = MyMsg.Question(LMSG.OnlySet); -#endif - tasker.SetTask(MyTask.SaveAsMSE, cards, dlg.FileName, isUpdate.ToString()); - Run(LanguageHelper.GetMsg(LMSG.SaveMse)); - } - } #endregion #region 导入卡图 diff --git a/DataEditorX/MainForm.cs b/DataEditorX/MainForm.cs index c97d853..059080e 100644 --- a/DataEditorX/MainForm.cs +++ b/DataEditorX/MainForm.cs @@ -46,7 +46,7 @@ public MainForm(string datapath) this.datapath = datapath; //文件路径 conflang = MyConfig.GetLanguageFile(datapath); - //游戏数据,MSE数据 + //游戏数据 datacfg = new DataConfig(MyConfig.GetCardInfoFile(datapath)); history = new History(this); YGOUtil.SetConfig(datacfg); diff --git a/DataEditorX/app.config b/DataEditorX/app.config index dbbcfe1..f405a73 100644 --- a/DataEditorX/app.config +++ b/DataEditorX/app.config @@ -31,9 +31,6 @@ - - - diff --git a/DataEditorX/data/language_chinese.txt b/DataEditorX/data/language_chinese.txt index eb438dd..1030124 100644 --- a/DataEditorX/data/language_chinese.txt +++ b/DataEditorX/data/language_chinese.txt @@ -20,12 +20,6 @@ DataEditForm.pl_bottom.btn_add 新增 DataEditForm.pl_bottom.btn_mod 修改 DataEditForm.pl_bottom.btn_undo N/A # -DataEditForm.mainMenu.menu_image MSE(&M) -DataEditForm.mainMenu.menuitem_mseconfig 设置MSE的配置文件 -DataEditForm.mainMenu.menuitem_saveasmse_select 把选中导为MSE存档 -DataEditForm.mainMenu.menuitem_saveasmse 把结果导为MSE存档 -DataEditForm.mainMenu.menuitem_testpendulumtext 测试灵摆效果文本 -# DataEditForm.mainMenu.menu_data 数据(&D) DataEditForm.mainMenu.menuitem_operacardsfile 同步操作卡片图片和脚本 DataEditForm.mainMenu.menuitem_default_script Set default script name @@ -104,12 +98,12 @@ MainForm.mainMenu.menuitem_closeall 关闭所有 0x25 N/A 0x26 当前有其他任务正在进行 0x27 正在检查更新 -0x28 正在复制卡片 -0x29 卡片复制完成 -0x2a MSE存档 +0x28 N/A +0x29 N/A +0x2a N/A 0x2b N/A -0x2c 正在导出MSE存档 -0x2d 导出MSE存档完成 +0x2c N/A +0x2d N/A 0x2e 正在裁剪图片 0x2f 裁剪图片完成 0x30 没有选中一张卡片 diff --git a/DataEditorX/data/language_english.txt b/DataEditorX/data/language_english.txt index 45ca9a8..9d102c7 100644 --- a/DataEditorX/data/language_english.txt +++ b/DataEditorX/data/language_english.txt @@ -18,17 +18,12 @@ DataEditForm.pl_bottom.btn_add Add #DataEditForm.pl_bottom.btn_PageUp Page Up DataEditForm.lv_cardlist.0 Card Code DataEditForm.lv_cardlist.1 Card Name -DataEditForm.mainMenu.menu_image MSE(&M) DataEditForm.mainMenu.menu_data Data(&D) DataEditForm.mainMenu.menuitem_operacardsfile Opera with Card's files DataEditForm.mainMenu.menuitem_default_script Set default script name DataEditForm.mainMenu.menuitem_readydk Read From ydk File(&Y) DataEditForm.mainMenu.menuitem_readimages Read From Images Path(&I) DataEditForm.mainMenu.menuitem_exportdata Export Data As zip -DataEditForm.mainMenu.menuitem_mseconfig Set MSE Config -DataEditForm.mainMenu.menuitem_testpendulumtext test pendulum texts -DataEditForm.mainMenu.menuitem_saveasmse_select Save Selected As MSE-set -DataEditForm.mainMenu.menuitem_saveasmse Save All As MSE-set DataEditForm.mainMenu.menuitem_cutimages Cut Images DataEditForm.mainMenu.menuitem_convertimage Convert Images DataEditForm.mainMenu.menuitem_export_all_sql Export all to sql @@ -98,12 +93,12 @@ MainForm.mainMenu.menuitem_closeall Close All 0x25 N/A 0x26 The Task is running. 0x27 Checking Update... -0x28 Copying Database... -0x29 Copied Database successfully. -0x2a Save Mse-set file +0x28 N/A +0x29 N/A +0x2a N/A 0x2b N/A -0x2c Exporting Mse-set -0x2d Export Mse-set OK +0x2c N/A +0x2d N/A 0x2e Cutting Images... 0x2f Cut Images successfully. 0x30 No card selected diff --git a/DataEditorX/readme.txt b/DataEditorX/readme.txt index ac7b75b..bec07dc 100644 --- a/DataEditorX/readme.txt +++ b/DataEditorX/readme.txt @@ -55,52 +55,10 @@ id between 10000000 and 20000000 id: 10000000, alias: 20000000 - - ★图片设置 在裁剪和导入图片时候使用。 image_quality 保存的图片质量 1-100 - image 游戏图片大小,小图宽/高,大图宽/高,共4个值 + image 游戏图片大小,大图宽/高,共2个值 image_other 一般卡图裁剪 image_xyz xyz卡图裁剪 image_pendulum Pendulum卡图裁剪 - -★MSE存档 -读取 -存档结构:(要求:每张卡的内容,开头是card,最后一行是gamecode,在MSE的card_fields修改gamecode为最后的元素) -card: -.... - gamecode: 123456 - -★MSE图片 -支持:密码,带0密码,卡名的png,jpg图片 - -★Magic Set Editor 2 -https://github.com/247321453/MagicSetEditor2 - -★MSE存档生成设置 -在每个语言的mse_xxx.txt修改\r\n会替换为换行,\t会替换为tab -简体转繁体 -cn2tw = false -每个存档最大数,0则是无限 -maxcount = 0 - -从下面的文件夹找图片添加到存档,名字为密码/卡名.png/jpg -imagepath = ./Images -魔法陷阱标志,%%替换为符号,如果只是%% ,需要设置下面的ST mark is text: yes -spell = [魔法卡%%] -trap = [陷阱卡%%] -游戏yugioh,风格standard,语言CN,Edition:MSE,P怪的中间图不包含P文本区域 -head = mse version: 0.3.8\r\ngame: yugioh\r\nstylesheet: standard\r\nset info:\r\n\tlanguage: CN\r\n\tedition: MSE\r\n\tST mark is text: no\r\n\tpendulum image is small: yes -读取存档,卡片描述 -text =【摇摆效果】\n%ptext%\n【怪兽效果】\n%text%\n -获取P文本 -pendulum-text = 】[\s\S]*?\n([\S\s]*?)\n【 -获取怪兽文本 -monster-text = [果|介|述|報]】\n([\S\s]*) -替换特殊字 -replace = ([鮟|鱇|・|·]) $1 -把空格替换为^,(占1/3字宽) -#replace = \s ^ -把A-Z替换为另外一种字体 -#replace = ([A-Z]) $1 diff --git a/DataEditorX/readme_english.txt b/DataEditorX/readme_english.txt index a08bdd1..03d20be 100644 --- a/DataEditorX/readme_english.txt +++ b/DataEditorX/readme_english.txt @@ -53,10 +53,6 @@ Support:png, jpg files with card number ★Database comparison -★Lua search -Find lua from C++ Source -Return in parameter type, C++ implement code - ★Copy a card: Copy and Replace: If there's a card with same name, replace it. Copy without Replace: If there's a card with same name, ignore it. @@ -81,55 +77,3 @@ id: 0, alias: 10000000 id between 10000000 and 20000000 id: 10000000, alias: 20000000 - -★CodeEditor: -Input keyword in the under text box,press Enter -Ctrl+F Look up -Ctrl+H Replace -Ctrl+left mouse skip to function definition -Ctrl+K List of function -Ctrl+T List of constant -Ctrl+The mouse wheel Zoom in/out - -★Magic Set Editor 2 -https://github.com/247321453/MagicSetEditor2 - -★MSE pics -Support:png,jpg pics with card number/card number with 0 -Tick “Set MSE'Image ”,Import pics will go into pics folder under MSE - -★MSE flie making setting -mse_xxx.txt modify\r\n can be newlines,\t will replace for tab - -Turn Simplified into traditional, -cn2tw = false - -The maxcount of every file,0 stands for unlimited -maxcount = 0 - -Add image from the folder,pic name:card number(or card name).png/jpg -imagepath = ./Images - -Symbol of spell and traps,turn %% into your sign,If you want to use %% ,put the "ST mark is text: yes" -spell = [魔法卡%%] -trap = [陷阱卡%%] - -Game name:yugioh,Style:standard,Language:CN,Edition:MSE,pics of pendulum monster don't include the text box in the central -head = mse version: 0.3.8\r\ngame: yugioh\r\nstylesheet: standard\r\nset info:\r\n\tlanguage: CN\r\n\tedition: MSE\r\n\tST mark is text: no\r\n\tpendulum image is small: yes - -Read flie text -text =【摇摆效果】\n%ptext%\n【怪兽效果】\n%text%\n - -Obtain Pendulum-text -pendulum-text = 】[\s\S]*?\n([\S\s]*?)\n【 - -Obtain monster-text -monster-text = [果|介|述|報]】\n([\S\s]*) - -Replace speical number -replace = ([鮟|鱇|?|·]) $1 - -Replace blank space with^,(takes a third of a word) -#replace = \s ^ -Change A-Z into another Typeface -#replace = ([A-Z]) $1 \ No newline at end of file diff --git a/README.md b/README.md index f774175..48f3611 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Require: * Create and edit card databases. * Compare, copy and paste cards across databases. * Read card records from ygopro decks (.ydk file) or card picture directories (like pics/ of ygooro). -* Export and import [MSE](https://github.com/247321453/MagicSetEditor2) sets. > **FAQ** Q: How to add a new archetype?