Commit 02392a2d authored by keyongyu's avatar keyongyu

1.6.0.0

parent 928a6ceb
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
using System.Configuration; using System.Configuration;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.IO.Compression; using System.IO.Compression;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -49,11 +50,14 @@ public class MSE ...@@ -49,11 +50,14 @@ public class MSE
mTypedic = typedic; mTypedic = typedic;
mRacedic = racedic; mRacedic = racedic;
MSEConvert.Init(typedic, racedic); MSEConvert.Init(typedic, racedic);
isInit=true;
} }
public static void Save(string file, Card[] cards,string pic){ public static void Save(string file, Card[] cards,string pic){
if(!isInit)
return;
string setFile=Path.Combine(Application.StartupPath, "set.tmp"); string setFile=Path.Combine(Application.StartupPath, "mse-set.txt");
string[] images=WriteSet(setFile, cards, pic); string[] images=WriteSet(setFile, cards, pic);
using(ZipStorer zips=ZipStorer.Create(file, "")) using(ZipStorer zips=ZipStorer.Create(file, ""))
{ {
...@@ -64,7 +68,6 @@ public class MSE ...@@ -64,7 +68,6 @@ public class MSE
} }
zips.Close(); zips.Close();
} }
File.Delete(setFile);
} }
public static string[] WriteSet(string file,Card[] cards,string pic) public static string[] WriteSet(string file,Card[] cards,string pic)
{ {
...@@ -83,35 +86,34 @@ public static string[] WriteSet(string file,Card[] cards,string pic) ...@@ -83,35 +86,34 @@ public static string[] WriteSet(string file,Card[] cards,string pic)
} }
else else
jpg=""; jpg="";
if(c.IsType(CardType.TYPE_SPELL)||c.IsType(CardType.TYPE_TRAP))
if(c.IsType(CardType.TYPE_SPELL)) sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL)));
sw.WriteLine(getSpell(c, jpg));
else if(c.IsType(CardType.TYPE_TRAP))
sw.WriteLine(getTrap(c, jpg));
else if(c.IsType(CardType.TYPE_PENDULUM))
sw.WriteLine(getPendulum(c, jpg));
else else
sw.WriteLine(getMonster(c, jpg)); sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM)));
} }
sw.Close(); sw.Close();
} }
return list.ToArray(); return list.ToArray();
} }
public static string reItalic(string str) public static string reItalic(string str)
{ {
str=MSEConvert.cn2tw(str);
foreach(string s in cfg.repalces) foreach(string s in cfg.repalces)
{ {
if(!string.IsNullOrEmpty(s)) if(!string.IsNullOrEmpty(s) && !s.StartsWith("#") && s.Length>0)
str=str.Replace(s,"<i>"+s+"</i>"); str= Regex.Replace(str, "("+s+")", "<i>$1</i>");
} }
return str; return str;
} }
static string getMonster(Card c,string img) static string getMonster(Card c,string img,bool isPendulum)
{ {
StringBuilder sb=new StringBuilder(cfg.monster); StringBuilder sb=new StringBuilder();
if(isPendulum)
sb.Append(cfg.pendulum);
else
sb.Append(cfg.monster);
string[] types=MSEConvert.GetTypes(c); string[] types=MSEConvert.GetTypes(c);
string race=MSEConvert.GetRace(c.race); string race=MSEConvert.GetRace(c.race);
sb.Replace("%type%", types[0]); sb.Replace("%type%", types[0]);
...@@ -123,87 +125,36 @@ static string getMonster(Card c,string img) ...@@ -123,87 +125,36 @@ static string getMonster(Card c,string img)
sb.Replace("%type1%",types[1]); sb.Replace("%type1%",types[1]);
sb.Replace("%type2%",types[2]); sb.Replace("%type2%",types[2]);
sb.Replace("%type3%",types[3]); sb.Replace("%type3%",types[3]);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc)); if(isPendulum){
if(!string.IsNullOrEmpty(race)) sb.Replace("%desc%", MSEConvert.ReDesc(
{ MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString()); sb.Replace("%pl%", ((c.level >> 0x18) & 0xff).ToString());
sb.Replace("%def%", (c.def<0)?"?":c.def.ToString()); sb.Replace("%pr%", ((c.level >> 0x10) & 0xff).ToString());
sb.Replace("%pdesc%", MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_pendulum)));
} }
sb.Replace("%code%",c.id.ToString("00000000")); else
return sb.ToString(); sb.Replace("%desc%", MSEConvert.ReDesc(
} MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
static string getPendulum(Card c,string img)
{
StringBuilder sb=new StringBuilder(cfg.pendulum);
string[] types=MSEConvert.GetTypes(c);
string race=MSEConvert.GetRace(c.race);
sb.Replace("%type%", types[0]);
sb.Replace("%name%", MSE.reItalic(c.name));
sb.Replace("%attribute%", MSEConvert.GetAttribute(c.attribute));
sb.Replace("%level%", MSEConvert.GetStar(c.level));
sb.Replace("%image%", img);
sb.Replace("%race%", race);
sb.Replace("%type1%",types[1]);
sb.Replace("%type2%",types[2]);
sb.Replace("%type3%",types[3]);
sb.Replace("%desc%", MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
if(!string.IsNullOrEmpty(race)) if(!string.IsNullOrEmpty(race))
{ {
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString()); sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString());
sb.Replace("%def%", (c.def<0)?"?":c.def.ToString()); sb.Replace("%def%", (c.def<0)?"?":c.def.ToString());
} }
sb.Replace("%code%",c.id.ToString("00000000")); sb.Replace("%code%",c.id.ToString("00000000"));
sb.Replace("%pl%", ((c.level >> 0x18) & 0xff).ToString());
sb.Replace("%pr%", ((c.level >> 0x10) & 0xff).ToString());
sb.Replace("%pdesc%",MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_pendulum)));
return sb.ToString();
}
static string getSpell(Card c,string img)
{
string level="";
if(c.IsType(CardType.TYPE_EQUIP))
level="+";
else if(c.IsType(CardType.TYPE_QUICKPLAY))
level="$";
else if(c.IsType(CardType.TYPE_FIELD))
level="&";
else if(c.IsType(CardType.TYPE_CONTINUOUS))
level="%";
else if(c.IsType(CardType.TYPE_RITUAL))
level="#";
else
level="^";
StringBuilder sb=new StringBuilder(cfg.spelltrap);
sb.Replace("%type%", "spell card");
sb.Replace("%name%", MSE.reItalic(c.name));
sb.Replace("%attribute%", "spell");
sb.Replace("%level%", level);
sb.Replace("%image%", img);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
sb.Replace("%code%", c.id.ToString("00000000"));
return sb.ToString(); return sb.ToString();
} }
static string getTrap(Card c,string img) static string getSpellTrap(Card c,string img,bool isSpell)
{ {
string level="";
if(c.IsType(CardType.TYPE_COUNTER))
level="!";
else if(c.IsType(CardType.TYPE_CONTINUOUS))
level="%";
else
level="^";
StringBuilder sb=new StringBuilder(cfg.spelltrap); StringBuilder sb=new StringBuilder(cfg.spelltrap);
sb.Replace("%type%", "trap card"); sb.Replace("%type%", isSpell?"spell card":"trap card");
sb.Replace("%name%", MSE.reItalic(c.name)); sb.Replace("%name%", MSE.reItalic(c.name));
sb.Replace("%attribute%", "trap"); sb.Replace("%attribute%", isSpell?"spell":"trap");
sb.Replace("%level%", level); sb.Replace("%level%", MSEConvert.GetST(c));
sb.Replace("%image%", img); sb.Replace("%image%", img);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc)); sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
sb.Replace("%code%", c.id.ToString("00000000")); sb.Replace("%code%", c.id.ToString("00000000"));
return sb.ToString(); return sb.ToString();
} }
} }
} }
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
using System.Text; using System.Text;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Microsoft.VisualBasic;
using System.Configuration;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -17,6 +19,7 @@ namespace DataEditorX.Core ...@@ -17,6 +19,7 @@ namespace DataEditorX.Core
/// </summary> /// </summary>
public class MSEConvert public class MSEConvert
{ {
static bool Iscn2tw;
static Dictionary<long,string> mTypedic=null; static Dictionary<long,string> mTypedic=null;
static Dictionary<long,string> mRacedic=null; static Dictionary<long,string> mRacedic=null;
public static void Init(Dictionary<long,string> typedic, public static void Init(Dictionary<long,string> typedic,
...@@ -24,10 +27,46 @@ public class MSEConvert ...@@ -24,10 +27,46 @@ public class MSEConvert
{ {
mTypedic = typedic; mTypedic = typedic;
mRacedic = racedic; mRacedic = racedic;
string tmp=ConfigurationManager.AppSettings["mse-cn2tw"];
if(tmp!=null && tmp.ToLower()=="true")
Iscn2tw=true;
else
Iscn2tw=false;
}
public static string GetST(Card c)
{
string level;
if(c.IsType(CardType.TYPE_EQUIP))
level="+";
else if(c.IsType(CardType.TYPE_QUICKPLAY))
level="$";
else if(c.IsType(CardType.TYPE_FIELD))
level="&";
else if(c.IsType(CardType.TYPE_CONTINUOUS))
level="%";
else if(c.IsType(CardType.TYPE_RITUAL))
level="#";
else if(c.IsType(CardType.TYPE_COUNTER))
level="!";
else
level="^";
return level;
}
public static string cn2tw(string str)
{
if(Iscn2tw){
str= Strings.StrConv(str,VbStrConv.TraditionalChinese,0);
str=str.Replace("巖","岩");
}
return str;
} }
public static string ReDesc(string desc) public static string ReDesc(string desc)
{ {
desc=cn2tw(desc);
StringBuilder sb=new StringBuilder(MSE.reItalic(desc)); StringBuilder sb=new StringBuilder(MSE.reItalic(desc));
sb.Replace(Environment.NewLine, "\n"); sb.Replace(Environment.NewLine, "\n");
sb.Replace("\n\n","\n"); sb.Replace("\n\n","\n");
sb.Replace("\n","\n\t\t"); sb.Replace("\n","\n\t\t");
...@@ -124,7 +163,7 @@ static string GetType(CardType type) ...@@ -124,7 +163,7 @@ static string GetType(CardType type)
if(mTypedic==null) if(mTypedic==null)
return ""; return "";
if(mTypedic.ContainsKey(key)) if(mTypedic.ContainsKey(key))
return mTypedic[key].Trim(); return cn2tw(mTypedic[key].Trim());
return ""; return "";
} }
...@@ -144,7 +183,7 @@ public static string GetRace(long race) ...@@ -144,7 +183,7 @@ public static string GetRace(long race)
if(mRacedic==null) if(mRacedic==null)
return ""; return "";
if(mRacedic.ContainsKey(race)) if(mRacedic.ContainsKey(race))
return mRacedic[race]; return cn2tw(mRacedic[race]);
return ""; return "";
} }
......
...@@ -97,12 +97,12 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -97,12 +97,12 @@ void DataEditFormLoad(object sender, EventArgs e)
//设置空白卡片 //设置空白卡片
oldCard=new Card(0); oldCard=new Card(0);
SetCard(oldCard); SetCard(oldCard);
checkupdate(false);
if(File.Exists(nowCdbFile)) if(File.Exists(nowCdbFile))
Open(nowCdbFile); Open(nowCdbFile);
#if !DEBUG
checkupdate(false);
#endif
} }
//窗体关闭 //窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e) void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
......
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
// //
// You can specify all the values or you can use the default the Revision and // You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below: // Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.5.2")] [assembly: AssemblyVersion("1.6.0.0")]
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<add key="image_xyz" value="24,51,128,128" /> <add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" /> <add key="image_pendulum" value="14,46,149,120" />
<!-- MSE --> <!-- MSE -->
<add key="mse-cn2tw" value="true"/>
<add key="mse-pendulum-text" value="】[\s\S]*?\n([\S\s]*?)\n【" /> <add key="mse-pendulum-text" value="】[\s\S]*?\n([\S\s]*?)\n【" />
<add key="mse-monster-text" value="[果|介|述]】\n([\S\s]*)" /> <add key="mse-monster-text" value="[果|介|述|報]】\n([\S\s]*)" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
game: yugioh game: yugioh
stylesheet: standard stylesheet: standard
set info: set info:
language: CN language: TW
edition: MSE Editrion edition: MSE Editrion
ST mark is text: yes ST mark is text: yes
pendulum image is small: yes pendulum image is small: yes
\ No newline at end of file
\ [\\]
鮟鱇 [鮟|鱇]
\ No newline at end of file [A-Z]
\ No newline at end of file
[DataEditorX]1.5.5.2[DataEditorX] [DataEditorX]1.6.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -7,6 +7,15 @@ ...@@ -7,6 +7,15 @@
下载/更新: 下载/更新:
Magic Set Editor 2/update/download.bat Magic Set Editor 2/update/download.bat
★MSE存档生成设置
config文件,设置pendulum文本和普通文本的正则正则表达式,用来分离文本
mse-head MSE的风格设置文件
mse-monster 普通怪兽模版
mse-pendulum P怪兽模版
mse-spelltrap 魔陷模版
mse-italic 特数字替换,达到一个位置使用2种字体的效果
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
关联cdb文件: 关联cdb文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。 请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
...@@ -47,6 +56,9 @@ DataEditorX.exe.config ...@@ -47,6 +56,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.6.0.0
增加简体转繁体功能
mse-italic.txt支持正则替换
1.5.5.2 1.5.5.2
增加MSE的mse-italic.txt 增加MSE的mse-italic.txt
1.5.5.1 1.5.5.1
......
No preview for this file type
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<add key="image_xyz" value="24,51,128,128" /> <add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" /> <add key="image_pendulum" value="14,46,149,120" />
<!-- MSE --> <!-- MSE -->
<add key="mse-cn2tw" value="true"/>
<add key="mse-pendulum-text" value="】[\s\S]*?\n([\S\s]*?)\n【" /> <add key="mse-pendulum-text" value="】[\s\S]*?\n([\S\s]*?)\n【" />
<add key="mse-monster-text" value="[果|介|述]】\n([\S\s]*)" /> <add key="mse-monster-text" value="[果|介|述|報]】\n([\S\s]*)" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
game: yugioh game: yugioh
stylesheet: standard stylesheet: standard
set info: set info:
language: CN language: TW
edition: MSE Editrion edition: MSE Editrion
ST mark is text: yes ST mark is text: yes
pendulum image is small: yes pendulum image is small: yes
\ No newline at end of file
\ [\\]
鮟鱇 [鮟|鱇]
\ No newline at end of file [A-Z]
\ No newline at end of file
[DataEditorX]1.5.5.2[DataEditorX] [DataEditorX]1.6.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。 ★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
...@@ -7,6 +7,15 @@ ...@@ -7,6 +7,15 @@
下载/更新: 下载/更新:
Magic Set Editor 2/update/download.bat Magic Set Editor 2/update/download.bat
★MSE存档生成设置
config文件,设置pendulum文本和普通文本的正则正则表达式,用来分离文本
mse-head MSE的风格设置文件
mse-monster 普通怪兽模版
mse-pendulum P怪兽模版
mse-spelltrap 魔陷模版
mse-italic 特数字替换,达到一个位置使用2种字体的效果
★支持关联cdb文件,命令参数启动。 ★支持关联cdb文件,命令参数启动。
关联cdb文件: 关联cdb文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。 请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
...@@ -47,6 +56,9 @@ DataEditorX.exe.config ...@@ -47,6 +56,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.6.0.0
增加简体转繁体功能
mse-italic.txt支持正则替换
1.5.5.2 1.5.5.2
增加MSE的mse-italic.txt 增加MSE的mse-italic.txt
1.5.5.1 1.5.5.1
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment