Commit 9090b09b authored by keyongyu's avatar keyongyu

1.6.2.0

parent 02392a2d
...@@ -169,6 +169,20 @@ public override int GetHashCode() ...@@ -169,6 +169,20 @@ public override int GetHashCode()
return true; return true;
return false; return false;
} }
public bool IsSetCode(long sc)
{
if((this.setcode&0xffff)==sc)
return true;
else if(((this.setcode>>0x10)&0xffff)==sc)
return true;
else if(((this.setcode>>0x20)&0xffff)==sc)
return true;
else if(((this.setcode>>0x30)&0xffff)==sc)
return true;
else
return false;
}
} }
} }
...@@ -49,7 +49,7 @@ public class MSE ...@@ -49,7 +49,7 @@ public class MSE
cfg=new MSEConfig(path); cfg=new MSEConfig(path);
mTypedic = typedic; mTypedic = typedic;
mRacedic = racedic; mRacedic = racedic;
MSEConvert.Init(typedic, racedic); MSEConvert.Init(typedic, racedic, cfg.Iscn2tw, cfg.STisEn);
isInit=true; isInit=true;
} }
...@@ -87,7 +87,7 @@ public static string[] WriteSet(string file,Card[] cards,string pic) ...@@ -87,7 +87,7 @@ 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)||c.IsType(CardType.TYPE_TRAP))
sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL))); sw.WriteLine("2");//getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL)));
else else
sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM))); sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM)));
} }
...@@ -99,10 +99,9 @@ public static string[] WriteSet(string file,Card[] cards,string pic) ...@@ -99,10 +99,9 @@ public static string[] WriteSet(string file,Card[] cards,string pic)
public static string reItalic(string str) public static string reItalic(string str)
{ {
str=MSEConvert.cn2tw(str); str=MSEConvert.cn2tw(str);
foreach(string s in cfg.repalces) foreach(RegStr rs in cfg.replaces)
{ {
if(!string.IsNullOrEmpty(s) && !s.StartsWith("#") && s.Length>0) str= Regex.Replace(str, rs.pstr, rs.rstr);
str= Regex.Replace(str, "("+s+")", "<i>$1</i>");
} }
return str; return str;
} }
...@@ -114,6 +113,7 @@ static string getMonster(Card c,string img,bool isPendulum) ...@@ -114,6 +113,7 @@ static string getMonster(Card c,string img,bool isPendulum)
sb.Append(cfg.pendulum); sb.Append(cfg.pendulum);
else else
sb.Append(cfg.monster); 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]);
...@@ -134,8 +134,7 @@ static string getMonster(Card c,string img,bool isPendulum) ...@@ -134,8 +134,7 @@ static string getMonster(Card c,string img,bool isPendulum)
MSEConvert.GetDesc(c.desc, cfg.regx_pendulum))); MSEConvert.GetDesc(c.desc, cfg.regx_pendulum)));
} }
else else
sb.Replace("%desc%", MSEConvert.ReDesc( sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
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());
...@@ -150,6 +149,14 @@ static string getSpellTrap(Card c,string img,bool isSpell) ...@@ -150,6 +149,14 @@ static string getSpellTrap(Card c,string img,bool isSpell)
sb.Replace("%type%", isSpell?"spell card":"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%", isSpell?"spell":"trap"); sb.Replace("%attribute%", isSpell?"spell":"trap");
if(cfg.STisEn)
sb.Replace("%level%",
"["+
(isSpell?"Spell Card":"Trap Card")
+MSEConvert.GetST(c)
+"]"
);
else
sb.Replace("%level%", MSEConvert.GetST(c)); 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));
......
...@@ -7,11 +7,27 @@ ...@@ -7,11 +7,27 @@
*/ */
using System; using System;
using System.Configuration; using System.Configuration;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using DataEditorX.Language; using DataEditorX.Language;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
public class RegStr
{
public RegStr(string p,string r)
{
pstr=Re(p);
rstr=Re(r);
}
string Re(string str)
{
return str.Replace("\\n","\n").Replace("\\t","\t");
}
public string pstr;
public string rstr;
}
/// <summary> /// <summary>
/// Description of MSEConfig. /// Description of MSEConfig.
/// </summary> /// </summary>
...@@ -19,35 +35,70 @@ public class MSEConfig ...@@ -19,35 +35,70 @@ public class MSEConfig
{ {
public MSEConfig(string path) public MSEConfig(string path)
{ {
regx_pendulum=ConfigurationManager.AppSettings["mse-pendulum-text"]; Iscn2tw=false;
regx_monster=ConfigurationManager.AppSettings["mse-monster-text"];
if(regx_monster==null)
regx_monster="(\\s\\S*?)"; regx_monster="(\\s\\S*?)";
else
regx_monster=regx_monster.Replace("\\n","\n");
if(regx_pendulum==null)
regx_pendulum="(\\s\\S*?)"; regx_pendulum="(\\s\\S*?)";
else
regx_pendulum=regx_pendulum.Replace("\\n","\n");
head = read(path, "mse-head.txt"); head = read(path, "mse-head.txt");
monster = read(path, "mse-monster.txt"); monster = read(path, "mse-monster.txt");
pendulum = read(path, "mse-pendulum.txt"); pendulum = read(path, "mse-pendulum.txt");
spelltrap = read(path, "mse-spelltrap.txt"); spelltrap = read(path, "mse-spelltrap.txt");
string tmp=Path.Combine(path, "mse-italic.txt"); string tmp=Path.Combine(path, "mse-config.txt");
replaces=new List<RegStr>();
if(File.Exists(tmp)) if(File.Exists(tmp))
repalces = File.ReadAllLines(tmp); {
string[] lines=File.ReadAllLines(tmp, Encoding.UTF8);
foreach(string line in lines)
{
if(string.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if(line.StartsWith("cn2tw"))
Iscn2tw=(getValue(line).ToLower()=="true")?true:false;
else if(line.StartsWith("STisEn"))
STisEn=(getValue(line).ToLower()=="true")?true:false;
else if(line.StartsWith("pendulum-text"))
regx_pendulum=getRegex(getValue(line));
else if(line.StartsWith("monster-text"))
regx_monster=getRegex(getValue(line));
else if(line.StartsWith("replace")){
string word=getValue(line);
int t=word.IndexOf(" ");
if(t>0){
string p=word.Substring(0,t);
string r=word.Substring(t+1);
if(!string.IsNullOrEmpty(p))
replaces.Add(new RegStr(p, r));
}
}
}
}
else else
repalces = new String[1]; {
Iscn2tw=false;
}
}
string getRegex(string word)
{
return word.Replace("\\n","\n").Replace("\\t","\t");
}
string getValue(string line)
{
int t=line.IndexOf('=');
if(t>0)
return line.Substring(t+1).Trim();
return "";
} }
string read(string path,string name) string read(string path,string name)
{ {
string tmp=Path.Combine(path, name); string tmp=Path.Combine(path, name);
return File.Exists(tmp)?File.ReadAllText(tmp):""; return File.Exists(tmp)?File.ReadAllText(tmp):"";
} }
public string[] repalces; public bool STisEn;
public bool Iscn2tw;
public List<RegStr> replaces;
public string regx_pendulum; public string regx_pendulum;
public string regx_monster; public string regx_monster;
public string head; public string head;
......
...@@ -19,19 +19,17 @@ namespace DataEditorX.Core ...@@ -19,19 +19,17 @@ namespace DataEditorX.Core
/// </summary> /// </summary>
public class MSEConvert public class MSEConvert
{ {
static bool Iscn2tw; static bool Iscn2tw,STisEN;
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,
Dictionary<long,string> racedic) Dictionary<long,string> racedic,
bool iscn2tw,bool stisen)
{ {
mTypedic = typedic; mTypedic = typedic;
mRacedic = racedic; mRacedic = racedic;
string tmp=ConfigurationManager.AppSettings["mse-cn2tw"]; Iscn2tw=iscn2tw;
if(tmp!=null && tmp.ToLower()=="true") STisEN=stisen;
Iscn2tw=true;
else
Iscn2tw=false;
} }
public static string GetST(Card c) public static string GetST(Card c)
...@@ -49,6 +47,8 @@ public static string GetST(Card c) ...@@ -49,6 +47,8 @@ public static string GetST(Card c)
level="#"; level="#";
else if(c.IsType(CardType.TYPE_COUNTER)) else if(c.IsType(CardType.TYPE_COUNTER))
level="!"; level="!";
else if(STisEN)
level="";
else else
level="^"; level="^";
return level; return level;
......
...@@ -595,12 +595,18 @@ public void SetCards(Card[] cards, bool isfresh) ...@@ -595,12 +595,18 @@ public void SetCards(Card[] cards, bool isfresh)
if(cards!=null) if(cards!=null)
{ {
cardlist.Clear(); cardlist.Clear();
cardcount=cards.Length; foreach(Card c in cards){
if(srcCard.setcode==0)
cardlist.Add(c);
else if(c.IsSetCode(srcCard.setcode&0xffff))
cardlist.Add(c);
}
cardcount=cardlist.Count;
pageNum=cardcount/MaxRow; pageNum=cardcount/MaxRow;
if(cardcount%MaxRow > 0) if(cardcount%MaxRow > 0)
pageNum++; pageNum++;
tb_pagenum.Text=pageNum.ToString(); tb_pagenum.Text=pageNum.ToString();
cardlist.AddRange(cards);
if(isfresh) if(isfresh)
AddListView(page); AddListView(page);
else else
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<None Include="chinese\message.txt"> <None Include="chinese\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="chinese\mse-italic.txt"> <None Include="chinese\mse-config.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="chinese\mse-monster.txt"> <None Include="chinese\mse-monster.txt">
...@@ -173,6 +173,9 @@ ...@@ -173,6 +173,9 @@
<None Include="english\message.txt"> <None Include="english\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="english\mse-config.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="english\mse-head.txt"> <None Include="english\mse-head.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
......
...@@ -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.6.0.0")] [assembly: AssemblyVersion("1.6.2.0")]
...@@ -23,9 +23,5 @@ ...@@ -23,9 +23,5 @@
<add key="image_other" value="25,54,128,128" /> <add key="image_other" value="25,54,128,128" />
<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 -->
<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]*)" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
cn2tw = true
STisEn = false
pendulum-text = 】[\s\S]*?\n([\S\s]*?)\n【
monster-text = [果|介|述|報]】\n([\S\s]*)
replace = ([\\|鮟|鱇]) <i>$1</i>
replace = ([A-Z]) <i>$1</i>
\ No newline at end of file
[\\]
[鮟|鱇]
[A-Z]
\ No newline at end of file
cn2tw = false
STisEn = true
pendulum-text = Text:[\s\S]*?\n([\S\s]*?)\n[\s\S]*?Text:
monster-text = Text:[\s\S]*?\n([\S\s]*)
replace = ([\|鮟|鱇]) <i>$1</i>
replace = ([A-Z]) <i>$1</i>
\ No newline at end of file
[DataEditorX]1.6.0.0[DataEditorX] [DataEditorX]1.6.2.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++,等。
...@@ -56,6 +56,11 @@ DataEditorX.exe.config ...@@ -56,6 +56,11 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.6.2.0
MSE存档导出,修正english的魔法陷阱标志
增加单系列搜索
1.6.1.0
把config的MSE设置改为chinese(english)/mse-config.txt
1.6.0.0 1.6.0.0
增加简体转繁体功能 增加简体转繁体功能
mse-italic.txt支持正则替换 mse-italic.txt支持正则替换
......
No preview for this file type
...@@ -23,9 +23,5 @@ ...@@ -23,9 +23,5 @@
<add key="image_other" value="25,54,128,128" /> <add key="image_other" value="25,54,128,128" />
<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 -->
<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]*)" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
cn2tw = true
STisEn = false
pendulum-text = 】[\s\S]*?\n([\S\s]*?)\n【
monster-text = [果|介|述|報]】\n([\S\s]*)
replace = ([\\|鮟|鱇]) <i>$1</i>
replace = ([A-Z]) <i>$1</i>
\ No newline at end of file
[\\]
[鮟|鱇]
[A-Z]
\ No newline at end of file
cn2tw = false
STisEn = true
pendulum-text = Text:[\s\S]*?\n([\S\s]*?)\n[\s\S]*?Text:
monster-text = Text:[\s\S]*?\n([\S\s]*)
replace = ([\|鮟|鱇]) <i>$1</i>
replace = ([A-Z]) <i>$1</i>
\ No newline at end of file
[DataEditorX]1.6.0.0[DataEditorX] [DataEditorX]1.6.2.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++,等。
...@@ -56,6 +56,11 @@ DataEditorX.exe.config ...@@ -56,6 +56,11 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么) 描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史 ★更新历史
1.6.2.0
MSE存档导出,修正english的魔法陷阱标志
增加单系列搜索
1.6.1.0
把config的MSE设置改为chinese(english)/mse-config.txt
1.6.0.0 1.6.0.0
增加简体转繁体功能 增加简体转繁体功能
mse-italic.txt支持正则替换 mse-italic.txt支持正则替换
......
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