Commit 9090b09b authored by keyongyu's avatar keyongyu

1.6.2.0

parent 02392a2d
......@@ -169,6 +169,20 @@ public override int GetHashCode()
return true;
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
cfg=new MSEConfig(path);
mTypedic = typedic;
mRacedic = racedic;
MSEConvert.Init(typedic, racedic);
MSEConvert.Init(typedic, racedic, cfg.Iscn2tw, cfg.STisEn);
isInit=true;
}
......@@ -87,7 +87,7 @@ public static string[] WriteSet(string file,Card[] cards,string pic)
else
jpg="";
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
sw.WriteLine(getMonster(c, jpg, c.IsType(CardType.TYPE_PENDULUM)));
}
......@@ -99,10 +99,9 @@ public static string[] WriteSet(string file,Card[] cards,string pic)
public static string reItalic(string 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, "("+s+")", "<i>$1</i>");
str= Regex.Replace(str, rs.pstr, rs.rstr);
}
return str;
}
......@@ -114,6 +113,7 @@ static string getMonster(Card c,string img,bool 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]);
......@@ -134,8 +134,7 @@ static string getMonster(Card c,string img,bool isPendulum)
MSEConvert.GetDesc(c.desc, cfg.regx_pendulum)));
}
else
sb.Replace("%desc%", MSEConvert.ReDesc(
MSEConvert.GetDesc(c.desc, cfg.regx_monster)));
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
if(!string.IsNullOrEmpty(race))
{
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString());
......@@ -150,7 +149,15 @@ static string getSpellTrap(Card c,string img,bool isSpell)
sb.Replace("%type%", isSpell?"spell card":"trap card");
sb.Replace("%name%", MSE.reItalic(c.name));
sb.Replace("%attribute%", isSpell?"spell":"trap");
sb.Replace("%level%", MSEConvert.GetST(c));
if(cfg.STisEn)
sb.Replace("%level%",
"["+
(isSpell?"Spell Card":"Trap Card")
+MSEConvert.GetST(c)
+"]"
);
else
sb.Replace("%level%", MSEConvert.GetST(c));
sb.Replace("%image%", img);
sb.Replace("%desc%", MSEConvert.ReDesc(c.desc));
sb.Replace("%code%", c.id.ToString("00000000"));
......
......@@ -7,11 +7,27 @@
*/
using System;
using System.Configuration;
using System.Collections.Generic;
using System.IO;
using System.Text;
using DataEditorX.Language;
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>
/// Description of MSEConfig.
/// </summary>
......@@ -19,35 +35,70 @@ public class MSEConfig
{
public MSEConfig(string path)
{
regx_pendulum=ConfigurationManager.AppSettings["mse-pendulum-text"];
regx_monster=ConfigurationManager.AppSettings["mse-monster-text"];
if(regx_monster==null)
regx_monster="(\\s\\S*?)";
else
regx_monster=regx_monster.Replace("\\n","\n");
if(regx_pendulum==null)
regx_pendulum="(\\s\\S*?)";
else
regx_pendulum=regx_pendulum.Replace("\\n","\n");
Iscn2tw=false;
regx_monster="(\\s\\S*?)";
regx_pendulum="(\\s\\S*?)";
head = read(path, "mse-head.txt");
monster = read(path, "mse-monster.txt");
pendulum = read(path, "mse-pendulum.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))
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
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 tmp=Path.Combine(path, name);
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_monster;
public string head;
......
......@@ -19,19 +19,17 @@ namespace DataEditorX.Core
/// </summary>
public class MSEConvert
{
static bool Iscn2tw;
static bool Iscn2tw,STisEN;
static Dictionary<long,string> mTypedic=null;
static Dictionary<long,string> mRacedic=null;
public static void Init(Dictionary<long,string> typedic,
Dictionary<long,string> racedic)
Dictionary<long,string> racedic,
bool iscn2tw,bool stisen)
{
mTypedic = typedic;
mRacedic = racedic;
string tmp=ConfigurationManager.AppSettings["mse-cn2tw"];
if(tmp!=null && tmp.ToLower()=="true")
Iscn2tw=true;
else
Iscn2tw=false;
Iscn2tw=iscn2tw;
STisEN=stisen;
}
public static string GetST(Card c)
......@@ -49,6 +47,8 @@ public static string GetST(Card c)
level="#";
else if(c.IsType(CardType.TYPE_COUNTER))
level="!";
else if(STisEN)
level="";
else
level="^";
return level;
......
......@@ -595,12 +595,18 @@ public void SetCards(Card[] cards, bool isfresh)
if(cards!=null)
{
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;
if(cardcount%MaxRow > 0)
pageNum++;
tb_pagenum.Text=pageNum.ToString();
cardlist.AddRange(cards);
if(isfresh)
AddListView(page);
else
......
......@@ -128,7 +128,7 @@
<None Include="chinese\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\mse-italic.txt">
<None Include="chinese\mse-config.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\mse-monster.txt">
......@@ -173,6 +173,9 @@
<None Include="english\message.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="english\mse-config.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="english\mse-head.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
......@@ -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.6.0.0")]
[assembly: AssemblyVersion("1.6.2.0")]
......@@ -23,9 +23,5 @@
<add key="image_other" value="25,54,128,128" />
<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]*)" />
</appSettings>
</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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -56,6 +56,11 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.6.2.0
MSE存档导出,修正english的魔法陷阱标志
增加单系列搜索
1.6.1.0
把config的MSE设置改为chinese(english)/mse-config.txt
1.6.0.0
增加简体转繁体功能
mse-italic.txt支持正则替换
......
No preview for this file type
......@@ -23,9 +23,5 @@
<add key="image_other" value="25,54,128,128" />
<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]*)" />
</appSettings>
</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]
★使用前,请关联lua的打开方式,例如记事本,notepad++,等。
......@@ -56,6 +56,11 @@ DataEditorX.exe.config
描述不详细的bug,我修复不了。(都不知道是bug是什么)
★更新历史
1.6.2.0
MSE存档导出,修正english的魔法陷阱标志
增加单系列搜索
1.6.1.0
把config的MSE设置改为chinese(english)/mse-config.txt
1.6.0.0
增加简体转繁体功能
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