Commit 02392a2d authored by keyongyu's avatar keyongyu

1.6.0.0

parent 928a6ceb
......@@ -10,6 +10,7 @@
using System.Configuration;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO.Compression;
using System.Windows.Forms;
......@@ -49,11 +50,14 @@ public class MSE
mTypedic = typedic;
mRacedic = racedic;
MSEConvert.Init(typedic, racedic);
isInit=true;
}
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);
using(ZipStorer zips=ZipStorer.Create(file, ""))
{
......@@ -64,7 +68,6 @@ public class MSE
}
zips.Close();
}
File.Delete(setFile);
}
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
jpg="";
if(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));
if(c.IsType(CardType.TYPE_SPELL)||c.IsType(CardType.TYPE_TRAP))
sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL)));
else
sw.WriteLine(getMonster(c, jpg));
sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM)));
}
sw.Close();
}
return list.ToArray();
}
public static string reItalic(string str)
{
str=MSEConvert.cn2tw(str);
foreach(string s in cfg.repalces)
{
if(!string.IsNullOrEmpty(s))
str=str.Replace(s,"<i>"+s+"</i>");
if(!string.IsNullOrEmpty(s) && !s.StartsWith("#") && s.Length>0)
str= Regex.Replace(str, "("+s+")", "<i>$1</i>");
}
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 race=MSEConvert.GetRace(c.race);
sb.Replace("%type%", types[0]);
......@@ -123,87 +125,36 @@ static string getMonster(Card c,string img)
sb.Replace("%type1%",types[1]);
sb.Replace("%type2%",types[2]);
sb.Replace("%type3%",types[3]);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
if(!string.IsNullOrEmpty(race))
{
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString());
sb.Replace("%def%", (c.def<0)?"?":c.def.ToString());
if(isPendulum){
sb.Replace("%desc%", MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
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)));
}
sb.Replace("%code%",c.id.ToString("00000000"));
return sb.ToString();
}
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)));
else
sb.Replace("%desc%", MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
if(!string.IsNullOrEmpty(race))
{
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString());
sb.Replace("%def%", (c.def<0)?"?":c.def.ToString());
}
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();
}
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);
sb.Replace("%type%", "trap card");
sb.Replace("%type%", isSpell?"spell card":"trap card");
sb.Replace("%name%", MSE.reItalic(c.name));
sb.Replace("%attribute%", "trap");
sb.Replace("%level%", level);
sb.Replace("%attribute%", isSpell?"spell":"trap");
sb.Replace("%level%", MSEConvert.GetST(c));
sb.Replace("%image%", img);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
sb.Replace("%code%", c.id.ToString("00000000"));
return sb.ToString();
}
}
}
......@@ -9,6 +9,8 @@
using System.Text;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.VisualBasic;
using System.Configuration;
namespace DataEditorX.Core
{
......@@ -17,6 +19,7 @@ namespace DataEditorX.Core
/// </summary>
public class MSEConvert
{
static bool Iscn2tw;
static Dictionary<long,string> mTypedic=null;
static Dictionary<long,string> mRacedic=null;
public static void Init(Dictionary<long,string> typedic,
......@@ -24,10 +27,46 @@ public class MSEConvert
{
mTypedic = typedic;
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)
{
desc=cn2tw(desc);
StringBuilder sb=new StringBuilder(MSE.reItalic(desc));
sb.Replace(Environment.NewLine, "\n");
sb.Replace("\n\n","\n");
sb.Replace("\n","\n\t\t");
......@@ -124,7 +163,7 @@ static string GetType(CardType type)
if(mTypedic==null)
return "";
if(mTypedic.ContainsKey(key))
return mTypedic[key].Trim();
return cn2tw(mTypedic[key].Trim());
return "";
}
......@@ -144,7 +183,7 @@ public static string GetRace(long race)
if(mRacedic==null)
return "";
if(mRacedic.ContainsKey(race))
return mRacedic[race];
return cn2tw(mRacedic[race]);
return "";
}
......
......@@ -97,12 +97,12 @@ void DataEditFormLoad(object sender, EventArgs e)
//设置空白卡片
oldCard=new Card(0);
SetCard(oldCard);
checkupdate(false);
if(File.Exists(nowCdbFile))
Open(nowCdbFile);
#if !DEBUG
checkupdate(false);
#endif
}
//窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
......
......@@ -43,6 +43,7 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
......
......@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.5.2")]
[assembly: AssemblyVersion("1.6.0.0")]
......@@ -24,7 +24,8 @@
<add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" />
<!-- MSE -->
<add key="mse-cn2tw" value="true"/>
<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>
</configuration>
\ No newline at end of file
......@@ -2,7 +2,7 @@
game: yugioh
stylesheet: standard
set info:
language: CN
language: TW
edition: MSE Editrion
ST mark is text: 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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -7,6 +7,15 @@
下载/更新:
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文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
......@@ -47,6 +56,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.6.0.0
增加简体转繁体功能
mse-italic.txt支持正则替换
1.5.5.2
增加MSE的mse-italic.txt
1.5.5.1
......
No preview for this file type
......@@ -24,7 +24,8 @@
<add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" />
<!-- MSE -->
<add key="mse-cn2tw" value="true"/>
<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>
</configuration>
\ No newline at end of file
......@@ -2,7 +2,7 @@
game: yugioh
stylesheet: standard
set info:
language: CN
language: TW
edition: MSE Editrion
ST mark is text: 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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -7,6 +7,15 @@
下载/更新:
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文件:
请确保DataEditorX的文件夹名固定不变,然后右键随意一个cdb文件,打开方式--浏览--DataEditorX.exe。确定。
......@@ -47,6 +56,9 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.6.0.0
增加简体转繁体功能
mse-italic.txt支持正则替换
1.5.5.2
增加MSE的mse-italic.txt
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