Commit 83787ed0 authored by keyongyu's avatar keyongyu

2.2.7.0

parent edc418ec
......@@ -178,7 +178,7 @@ private void InitializeComponent()
// menuitem_about
//
this.menuitem_about.Name = "menuitem_about";
this.menuitem_about.Size = new System.Drawing.Size(152, 22);
this.menuitem_about.Size = new System.Drawing.Size(111, 22);
this.menuitem_about.Text = "About";
this.menuitem_about.Click += new System.EventHandler(this.AboutToolStripMenuItemClick);
//
......
......@@ -43,11 +43,6 @@ public CodeEditForm()
{
InitForm();
}
public CodeEditForm(string file)
{
InitForm();
Open(file);
}
void InitForm()
{
cardlist=new SortedDictionary<long, string>();
......@@ -208,7 +203,6 @@ void CodeEditFormEnter(object sender, EventArgs e)
,AutocompleteItem[] conlist)
{
this.tooltipDic=tooltipDic;
List<AutocompleteItem> items=new List<AutocompleteItem>();
items.AddRange(funlist);
items.AddRange(conlist);
......@@ -397,8 +391,9 @@ void Tb_inputKeyDown(object sender, KeyEventArgs e)
}
}
#endregion
void CodeEditFormFormClosing(object sender, FormClosingEventArgs e)
#region close
void CodeEditFormFormClosing(object sender, FormClosingEventArgs e)
{
if(!string.IsNullOrEmpty(oldtext))
{
......@@ -411,8 +406,10 @@ void CodeEditFormFormClosing(object sender, FormClosingEventArgs e)
Save();
}
}
public void SetCDBList(string[] cdbs)
#endregion
#region card tooltip
public void SetCDBList(string[] cdbs)
{
if(cdbs == null)
return;
......@@ -448,8 +445,10 @@ public void SetCards(Card[] cards)
cardlist.Add(c.id,c.ToString());
}
}
void FctbSelectionChangedDelayed(object sender, EventArgs e)
#endregion
#region selection
void FctbSelectionChangedDelayed(object sender, EventArgs e)
{
tb_input.Text=fctb.SelectedText;
fctb.VisibleRange.ClearStyle(SameWordsStyle);
......@@ -466,7 +465,10 @@ void FctbSelectionChangedDelayed(object sender, EventArgs e)
foreach(var r in ranges)
r.SetStyle(SameWordsStyle);
}
void FctbMouseClick(object sender, MouseEventArgs e)
#endregion
#region goto function define
void FctbMouseClick(object sender, MouseEventArgs e)
{
var fragment = fctb.Selection.GetFragment(@"\w");
string text = fragment.Text;
......@@ -481,6 +483,7 @@ void FctbMouseClick(object sender, MouseEventArgs e)
//MessageBox.Show(linenums[0].ToString());
}
}
}
}
}
#endregion
}
}
......@@ -26,7 +26,9 @@ public class MySyntaxHighlighter : SyntaxHighlighter
TextStyle ConStyle = new TextStyle(Brushes.YellowGreen, null, FontStyle.Regular);
TextStyle mKeywordStyle = new TextStyle(Brushes.DeepSkyBlue, null, FontStyle.Regular);
TextStyle mGrayStyle = new TextStyle(Brushes.Gray, null, FontStyle.Regular);
TextStyle mFunStyle = new TextStyle(Brushes.DeepSkyBlue, null, FontStyle.Regular);
TextStyle mFunStyle = new TextStyle(Brushes.LightGray, null, FontStyle.Bold);
/// <summary>
/// Highlights Lua code
/// </summary>
......@@ -44,7 +46,7 @@ public override void LuaSyntaxHighlight(Range range)
= @"^\s*[\w\.]+(\s\w+)?\s*(?<range>=)\s*(?<range>.+)";
//clear style of changed range
range.ClearStyle(mStrStyle, mGrayStyle, ConStyle, mNumberStyle, mKeywordStyle, mFunStyle);
range.ClearStyle(mStrStyle, mGrayStyle,ConStyle, mNumberStyle, mKeywordStyle, mFunStyle);
//
if (base.LuaStringRegex == null)
base.InitLuaRegex();
......@@ -56,18 +58,15 @@ public override void LuaSyntaxHighlight(Range range)
range.SetStyle(mGrayStyle, base.LuaCommentRegex3);
//number highlighting
range.SetStyle(mNumberStyle, base.LuaNumberRegex);
range.SetStyle(mNumberStyle, @"\bc\d+\b");
//keyword highlighting
range.SetStyle(mKeywordStyle, base.LuaKeywordRegex);
//functions highlighting
range.SetStyle(mFunStyle, base.LuaFunctionsRegex);
range.SetStyle(mNumberStyle, @"\bc\d+\b");
//range.SetStyle(mBoldStyle, @"\b(?<range>[a-zA-Z0-9_]+?)[.|:|=|\s]");
//constant
range.SetStyle(ConStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,]");
//function
//range.SetStyle(FunStyle, @"[:|.|\s](?<range>[^\(]*?)[\(|\)|\s]");
range.SetStyle(ConStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,|;]");
//range.SetStyle(mFunStyle, @"[:|\.|\s](?<range>[a-zA-Z0-9_]*?)[\(|\)|\s]");
//clear folding markers
range.ClearFoldingMarkers();
......
......@@ -218,7 +218,6 @@ public bool IsSetCode(long sc)
}
#endregion
}
}
using System;
using System.Drawing;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Configuration;
using WeifenLuo.WinFormsUI.Docking;
using FastColoredTextBoxNS;
using DataEditorX.Language;
using DataEditorX.Core;
using System.Text;
namespace DataEditorX.Core
{
class CodeConfig
{
public CodeConfig(string datapath)
{
funtxt = MyPath.Combine(datapath, "_functions.txt");
conlua = MyPath.Combine(datapath, "constant.lua");
confstring = MyPath.Combine(datapath, "strings.conf");
tooltipDic = new Dictionary<string, string>();
funList = new List<AutocompleteItem>();
conList = new List<AutocompleteItem>();
}
//函数提示
Dictionary<string, string> tooltipDic;
public Dictionary<string, string> TooltipDic
{
get { return tooltipDic; }
}
//自动完成
List<AutocompleteItem> funList;
List<AutocompleteItem> conList;
bool isInit;
public bool IsInit
{
get { return isInit; }
}
public AutocompleteItem[] FunList
{
get { return funList.ToArray(); }
}
public AutocompleteItem[] ConList
{
get { return conList.ToArray(); }
}
public string funtxt, conlua, confstring;
public void Init()
{
isInit = true;
tooltipDic.Clear();
funList.Clear();
conList.Clear();
AddFunction(funtxt);
AddConstant(conlua);
}
#region setnames strings
public void SetNames(Dictionary<long, string> dic)
{
foreach (long k in dic.Keys)
{
string key = "0x" + k.ToString("x");
if (!tooltipDic.ContainsKey(key))
{
AddConToolTip(key, dic[k]);
}
}
}
public void AddStrings(string str)
{
if (File.Exists(str))
{
string[] lines = File.ReadAllLines(str);
foreach (string line in lines)
{
if (line.StartsWith("!victory")
|| line.StartsWith("!counter"))
{
string[] ws = line.Split(' ');
if (ws.Length > 2)
{
AddConToolTip(ws[1], ws[2]);
}
}
}
}
}
public void AddStrings()
{
AddStrings(confstring);
}
#endregion
#region function
void AddFunction(string funtxt)
{
if (File.Exists(funtxt))
{
string[] lines = File.ReadAllLines(funtxt);
bool isFind = false;
string name = "";
string desc = "";
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line)
|| line.StartsWith("==")
|| line.StartsWith("#"))
continue;
if (line.StartsWith("●"))
{
//add
AddFuncTooltip(name, desc);
int w = line.IndexOf("(");
int t = line.IndexOf(" ");
if (t < w && t > 0)
{
name = line.Substring(t + 1, w - t - 1);
isFind = true;
desc = line;
}
}
else if (isFind)
{
desc += Environment.NewLine + line;
}
}
AddFuncTooltip(name, desc);
}
}
string GetFunName(string str)
{
int t = str.IndexOf(".");
if (t > 0)
return str.Substring(t + 1);
return str;
}
void AddFuncTooltip(string name, string desc)
{
if (!string.IsNullOrEmpty(name))
{
string fname = GetFunName(name);
AddAutoMenuItem(funList, fname, desc);
if (!tooltipDic.ContainsKey(fname))
{
tooltipDic.Add(fname, desc);
}
else
tooltipDic[fname] += Environment.NewLine
+ Environment.NewLine + desc;
}
}
#endregion
#region constant
void AddAutoMenuItem(List<AutocompleteItem> list, string key, string desc)
{
bool isExists = false;
foreach (AutocompleteItem ai in list)
{
if (ai.Text == key)
{
isExists = true;
ai.ToolTipText += Environment.NewLine
+ Environment.NewLine + desc;
}
}
if (!isExists)
{
AutocompleteItem aitem = new AutocompleteItem(key);
aitem.ToolTipTitle = key;
aitem.ToolTipText = desc;
list.Add(aitem);
}
}
void AddConToolTip(string key, string desc)
{
AddAutoMenuItem(conList, key, desc);
if (tooltipDic.ContainsKey(key))
tooltipDic[key] += Environment.NewLine
+ Environment.NewLine + desc;
else
{
tooltipDic.Add(key, desc);
}
}
void AddConstant(string conlua)
{
//conList.Add("con");
if (File.Exists(conlua))
{
string[] lines = File.ReadAllLines(conlua);
foreach (string line in lines)
{
if (line.StartsWith("--"))
continue;
string k = line, desc = line;
int t = line.IndexOf("=");
int t2 = line.IndexOf("--");
k = (t > 0) ? line.Substring(0, t).TrimEnd(new char[] { ' ', '\t' })
: line;
desc = (t > 0) ? line.Substring(t + 1).Replace("--", "\n")
: line;
if (!tooltipDic.ContainsKey(k))
{
AddConToolTip(k, desc);
}
else
tooltipDic[k] += Environment.NewLine
+ Environment.NewLine + desc;
}
}
}
#endregion
}
}
......@@ -122,8 +122,6 @@ public static int Command(string DB, params string[] SQLs)
}
#endregion
#region 数据读取
#region 根据SQL读取
static Card ReadCard(SQLiteDataReader reader,bool reNewLine)
{
......@@ -161,7 +159,17 @@ static string Retext(string text)
sr.Remove(0, sr.Length);
return text;
}
/// <summary>
public static Card[] Read(string DB, bool reNewLine, params long[] ids)
{
List<string> idlist = new List<string>();
foreach (long id in ids)
{
idlist.Add(id.ToString());
}
return Read(DB, reNewLine, idlist.ToArray());
}
/// <summary>
/// 根据密码集合,读取数据
/// </summary>
/// <param name="DB">数据库</param>
......@@ -221,70 +229,6 @@ public static Card[] Read(string DB,bool reNewLine, params string[] SQLs)
return list.ToArray();
}
#endregion
#region 根据文件读取数据库
public static Card[] ReadYdk(string dbfile, string ydkfile)
{
if ( File.Exists(dbfile) )
{
string[] ids = ReadYDK(ydkfile);
if(ids!=null)
return DataBase.Read(dbfile, true, ids);
}
return null;
}
/// <summary>
/// 读取ydk文件为密码数组
/// </summary>
/// <param name="file">ydk文件</param>
/// <returns>密码数组</returns>
static string[] ReadYDK(string ydkfile)
{
string str;
List<string> IDs = new List<string>();
if ( File.Exists(ydkfile) )
{
using ( FileStream f = new FileStream(ydkfile, FileMode.Open, FileAccess.Read) )
{
StreamReader sr = new StreamReader(f, Encoding.Default);
str = sr.ReadLine();
while ( str != null )
{
if ( !str.StartsWith("!") && !str.StartsWith("#") &&str.Length>0)
{
if ( IDs.IndexOf(str) < 0 )
IDs.Add(str);
}
str = sr.ReadLine();
}
sr.Close();
f.Close();
}
}
if(IDs.Count==0)
return null;
return IDs.ToArray();
}
#endregion
#region 根据图像读取数据库
public static Card[] ReadImage(string dbfile, string path)
{
if ( File.Exists(dbfile) )
{
string[] files = Directory.GetFiles(path, "*.jpg");
int n = files.Length;
for ( int i = 0; i < n; i++ )
{
files[i] = Path.GetFileNameWithoutExtension(files[i]);
}
return DataBase.Read(dbfile, true,files);
}
return null;
}
#endregion
#endregion
#region 复制数据库
/// <summary>
......
......@@ -18,22 +18,23 @@ public class DataConfig
{
public DataConfig()
{
InitMember();
InitMember(System.Windows.Forms.Application.StartupPath);
}
public DataConfig(string datapath)
{
confrule=Path.Combine(datapath, "card-rule.txt");
confattribute=Path.Combine(datapath, "card-attribute.txt");
confrace=Path.Combine(datapath, "card-race.txt");
conflevel=Path.Combine(datapath, "card-level.txt");
confsetname=Path.Combine(datapath, "card-setname.txt");
conftype=Path.Combine(datapath, "card-type.txt");
confcategory=Path.Combine(datapath, "card-category.txt");
InitMember();
InitMember(datapath);
}
void InitMember()
{
void InitMember(string datapath)
{
this.datapath = datapath;
confrule = Path.Combine(datapath, "card-rule.txt");
confattribute = Path.Combine(datapath, "card-attribute.txt");
confrace = Path.Combine(datapath, "card-race.txt");
conflevel = Path.Combine(datapath, "card-level.txt");
confsetname = Path.Combine(datapath, "card-setname.txt");
conftype = Path.Combine(datapath, "card-type.txt");
confcategory = Path.Combine(datapath, "card-category.txt");
dicCardRules=new Dictionary<long, string>();
dicSetnames=new Dictionary<long, string>();
dicCardTypes=new Dictionary<long, string>();
......@@ -42,26 +43,6 @@ void InitMember()
dicCardRaces=new Dictionary<long, string>();
dicCardLevels=new Dictionary<long, string>();
}
public DataConfig Clone()
{
DataConfig datacfg=new DataConfig();
datacfg.confrule = confrule;
datacfg.confattribute = confattribute;
datacfg.confrace = confrace;
datacfg.conflevel = conflevel;
datacfg.confsetname = confsetname;
datacfg.conftype = conftype;
datacfg.confcategory = confcategory;
datacfg.dicCardRules = CopyDic(dicCardRules);
datacfg.dicSetnames = CopyDic(dicSetnames);
datacfg.dicCardTypes = CopyDic(dicCardTypes);
datacfg.dicCardcategorys = CopyDic(dicCardcategorys);
datacfg.dicCardAttributes = CopyDic(dicCardAttributes);
datacfg.dicCardRaces = CopyDic(dicCardRaces);
datacfg.dicCardLevels = CopyDic(dicCardLevels);
return datacfg;
}
Dictionary<long, string> CopyDic(Dictionary<long, string> dic)
{
Dictionary<long, string> ndic=new Dictionary<long, string>();
......@@ -81,8 +62,10 @@ public void Init()
dicCardRaces=DataManager.Read(confrace);
dicCardLevels=DataManager.Read(conflevel);
}
string datapath;
public string confrule, confattribute, confrace, conflevel;
public string confsetname, conftype, confcategory;
public Dictionary<long, string> dicCardRules=null;
public Dictionary<long, string> dicCardAttributes=null;
public Dictionary<long, string> dicCardRaces=null;
......
......@@ -86,7 +86,8 @@ long defaultKey
return lkey;
}
#endregion
#region value
public static string[] GetValues(Dictionary<long, string> dic)
{
int length=dic.Count;
......@@ -104,5 +105,6 @@ public static string[] GetValues(Dictionary<long, string> dic)
return dic[key];
return key.ToString("x");
}
#endregion
}
}
......@@ -13,6 +13,7 @@
using System.Text.RegularExpressions;
using System.IO.Compression;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace DataEditorX.Core
{
......@@ -24,7 +25,6 @@ namespace DataEditorX.Core
public class MSE
{
MSEConfig cfg;
MSEConvert conv;
public int MaxNum
{
......@@ -41,8 +41,61 @@ public string ImagePath
Dictionary<long,string> racedic)
{
cfg=new MSEConfig(path);
conv=new MSEConvert(typedic, racedic, cfg);
}
public string reItalic(string str)
{
str = cn2tw(str);
foreach (RegStr rs in cfg.replaces)
{
str = Regex.Replace(str, rs.pstr, rs.rstr);
}
return str;
}
public string cn2tw(string str)
{
if (cfg.Iscn2tw)
{
str = Strings.StrConv(str, VbStrConv.TraditionalChinese, 0);
str = str.Replace("巖", "岩");
}
return str;
}
public string ReDesc(string desc)
{
desc = cn2tw(desc);
StringBuilder sb = new StringBuilder(reItalic(desc));
sb.Replace(Environment.NewLine, "\n");
sb.Replace("\n\n", "\n");
sb.Replace("\n", "\n\t\t");
return sb.ToString();
}
public string GetST(Card c, bool isSpell)
{
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 if (cfg.st_is_symbol)
level = "^";
else
level = "";
if (isSpell)
level = cfg.str_spell.Replace("%%", level);
else
level = cfg.str_trap.Replace("%%", level);
return level;
}
public string[] WriteSet(string file,Card[] cards)
{
List<string> list=new List<string>();
......@@ -54,48 +107,12 @@ public string[] WriteSet(string file,Card[] cards)
sw.WriteLine(cfg.head);
foreach(Card c in cards)
{
string jpg=MyPath.Combine(pic,c.id+".jpg");
string jpg2=MyPath.Combine(pic,c.idString+".jpg");
string jpg3=MyPath.Combine(pic,c.name+".jpg");
string png=MyPath.Combine(pic,c.id+".png");
string png2=MyPath.Combine(pic,c.idString+".png");
string png3=MyPath.Combine(pic,c.name+".png");
if(File.Exists(jpg)){
list.Add(jpg);
jpg=Path.GetFileName(jpg);
}
else if(File.Exists(jpg2)){
list.Add(jpg2);
jpg=Path.GetFileName(jpg2);
}
else if(File.Exists(jpg3)){
File.Copy(jpg3, jpg, true);
if(File.Exists(jpg)){//复制失败
list.Add(jpg);
jpg=Path.GetFileName(jpg);
}
else
jpg="";
}
else if(File.Exists(png)){
list.Add(png);
jpg=Path.GetFileName(png);
}
else if(File.Exists(png2)){
list.Add(png2);
jpg=Path.GetFileName(png2);
}
else if(File.Exists(png3)){
File.Copy(png3, png, true);
if(File.Exists(png)){//复制失败
list.Add(png);
jpg=Path.GetFileName(png);
}
else
jpg="";
}
else
jpg="";
string jpg = YGOUtil.GetCardImagePath(pic, c);
if (!string.IsNullOrEmpty(jpg))
{
list.Add(jpg);
jpg = Path.GetFileName(jpg);
}
if(c.IsType(CardType.TYPE_SPELL)||c.IsType(CardType.TYPE_TRAP))
sw.WriteLine(getSpellTrap(c, jpg, c.IsType(CardType.TYPE_SPELL)));
else
......@@ -114,30 +131,30 @@ string getMonster(Card c,string img,bool isPendulum)
sb.Append(cfg.pendulum);
else
sb.Append(cfg.monster);
string[] types = conv.GetTypes(c);
string race = conv.GetRace(c.race);
string[] types = YGOUtil.GetTypes(c);
string race = YGOUtil.GetRace(c.race);
sb.Replace("%type%", types[0]);
sb.Replace("%name%", conv.reItalic(c.name));
sb.Replace("%attribute%", conv.GetAttribute(c.attribute));
sb.Replace("%level%", conv.GetStar(c.level));
sb.Replace("%name%", reItalic(c.name));
sb.Replace("%attribute%", YGOUtil.GetAttribute(c.attribute));
sb.Replace("%level%", YGOUtil.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("%race%", cn2tw(race));
sb.Replace("%type1%",cn2tw(types[1]));
sb.Replace("%type2%",cn2tw(types[2]));
sb.Replace("%type3%",cn2tw(types[3]));
if(isPendulum){
string text= conv.GetDesc(c.desc, cfg.regx_monster);
string text = YGOUtil.GetDesc(c.desc, cfg.regx_monster);
if(string.IsNullOrEmpty(text))
text=c.desc;
sb.Replace("%desc%", conv.ReDesc(text));
sb.Replace("%desc%", ReDesc(text));
sb.Replace("%pl%", ((c.level >> 0x18) & 0xff).ToString());
sb.Replace("%pr%", ((c.level >> 0x10) & 0xff).ToString());
sb.Replace("%pdesc%", conv.ReDesc(
conv.GetDesc(c.desc, cfg.regx_pendulum)));
sb.Replace("%pdesc%", ReDesc(
YGOUtil.GetDesc(c.desc, cfg.regx_pendulum)));
}
else
sb.Replace("%desc%", conv.ReDesc(c.desc));
sb.Replace("%desc%", ReDesc(c.desc));
sb.Replace("%atk%", (c.atk<0)?"?":c.atk.ToString());
sb.Replace("%def%", (c.def<0)?"?":c.def.ToString());
......@@ -148,11 +165,11 @@ string getSpellTrap(Card c,string img,bool isSpell)
{
StringBuilder sb=new StringBuilder(cfg.spelltrap);
sb.Replace("%type%", isSpell?"spell card":"trap card");
sb.Replace("%name%", conv.reItalic(c.name));
sb.Replace("%name%", reItalic(c.name));
sb.Replace("%attribute%", isSpell?"spell":"trap");
sb.Replace("%level%", conv.GetST(c, isSpell));
sb.Replace("%level%", GetST(c, isSpell));
sb.Replace("%image%", img);
sb.Replace("%desc%", conv.ReDesc(c.desc));
sb.Replace("%desc%", ReDesc(c.desc));
sb.Replace("%code%", c.idString);
return sb.ToString();
}
......
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 2014-10-15
* 时间: 15:46
*
*/
using System;
using System.Text;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.VisualBasic;
using System.Configuration;
namespace DataEditorX.Core
{
/// <summary>
/// Description of MSEConvert.
/// </summary>
public class MSEConvert
{
/*
*
normal monster 通常怪兽
effect monster 效果怪兽
fusion monster 融合怪兽
ritual monster 仪式怪兽
synchro monster 同调怪兽
token monster 衍生物
xyz monster 超量怪兽
spell card 魔法
trap card 陷阱
*/
MSEConfig cfg;
Dictionary<long,string> mTypedic=null;
Dictionary<long,string> mRacedic=null;
public MSEConvert(Dictionary<long,string> typedic,
Dictionary<long,string> racedic,
MSEConfig _cfg)
{
mTypedic = typedic;
mRacedic = racedic;
cfg=_cfg;
}
public string GetST(Card c,bool isSpell)
{
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 if(cfg.st_is_symbol)
level="^";
else
level="";
if(isSpell)
level=cfg.str_spell.Replace("%%",level);
else
level=cfg.str_trap.Replace("%%",level);
return level;
}
public string reItalic(string str)
{
str=cn2tw(str);
foreach(RegStr rs in cfg.replaces)
{
str= Regex.Replace(str, rs.pstr, rs.rstr);
}
return str;
}
public string cn2tw(string str)
{
if(cfg.Iscn2tw){
str= Strings.StrConv(str,VbStrConv.TraditionalChinese,0);
str=str.Replace("巖","岩");
}
return str;
}
public string ReDesc(string desc)
{
desc=cn2tw(desc);
StringBuilder sb=new StringBuilder(reItalic(desc));
sb.Replace(Environment.NewLine, "\n");
sb.Replace("\n\n","\n");
sb.Replace("\n","\n\t\t");
return sb.ToString();
}
public string[] GetTypes(Card c)
{
string[] types=new string[]{"normal monster","","",""};
if(c.IsType(CardType.TYPE_MONSTER))
{//卡片类型和第1效果
if(c.IsType(CardType.TYPE_XYZ)){
types[0]="xyz monster";
types[1]=GetType(CardType.TYPE_XYZ);
}
else if(c.IsType(CardType.TYPE_TOKEN)){
if(c.race==0)
types[0]="token card";
else
types[0]="token monster";
types[1]=GetType(CardType.TYPE_TOKEN);
}
else if(c.IsType(CardType.TYPE_RITUAL)){
types[0]="ritual monster";
types[1]=GetType(CardType.TYPE_RITUAL);
}
else if(c.IsType(CardType.TYPE_FUSION)){
types[0]="fusion monster";
types[1]=GetType(CardType.TYPE_FUSION);
}
else if(c.IsType(CardType.TYPE_SYNCHRO)){
types[0]="synchro monster";
types[1]=GetType(CardType.TYPE_SYNCHRO);
}
else if(c.IsType(CardType.TYPE_EFFECT)){
types[0]="effect monster";
}
else
types[0]="normal monster";
//同调
if(types[0]=="synchro monster" || types[0]=="token monster")
{
if(c.IsType(CardType.TYPE_TUNER)
&& c.IsType(CardType.TYPE_EFFECT))
{//调整效果
types[2]=GetType(CardType.TYPE_TUNER);
types[3]=GetType(CardType.TYPE_EFFECT);
}
else if(c.IsType(CardType.TYPE_TUNER))
{
types[2]=GetType(CardType.TYPE_TUNER);
}
else if(c.IsType(CardType.TYPE_EFFECT))
{
types[2]=GetType(CardType.TYPE_EFFECT);
}
}
else if(types[0] == "normal monster")
{
if(c.IsType(CardType.TYPE_PENDULUM))//灵摆
types[1]=GetType(CardType.TYPE_PENDULUM);
else if(c.IsType(CardType.TYPE_TUNER))//调整
types[1]=GetType(CardType.TYPE_TUNER);
}
else if(types[0] != "effect monster")
{//效果
if(c.IsType(CardType.TYPE_EFFECT))
types[2]=GetType(CardType.TYPE_EFFECT);
}
else
{//效果怪兽
types[2]=GetType(CardType.TYPE_EFFECT);
if(c.IsType(CardType.TYPE_PENDULUM))
types[1]=GetType(CardType.TYPE_PENDULUM);
else if(c.IsType(CardType.TYPE_TUNER))
types[1]=GetType(CardType.TYPE_TUNER);
else if(c.IsType(CardType.TYPE_SPIRIT))
types[1]=GetType(CardType.TYPE_SPIRIT);
else if(c.IsType(CardType.TYPE_TOON))
types[1]=GetType(CardType.TYPE_TOON);
else if(c.IsType(CardType.TYPE_UNION))
types[1]=GetType(CardType.TYPE_UNION);
else if(c.IsType(CardType.TYPE_DUAL))
types[1]=GetType(CardType.TYPE_DUAL);
else if(c.IsType(CardType.TYPE_FLIP))
types[1]=GetType(CardType.TYPE_FLIP);
else{
types[1]=GetType(CardType.TYPE_EFFECT);
types[2]="";
}
}
}
if(c.race==0)
{
types[0]="";
types[1]="";
types[2]="";
}
return types;
}
string GetType(CardType type)
{
long key=(long)type;
if(mTypedic==null)
return "";
if(mTypedic.ContainsKey(key))
return cn2tw(mTypedic[key].Trim());
return "";
}
public string GetStar(long level)
{
long j=level&0xff;
string star="";
for(int i=0;i<j;i++)
{
star+="*";
}
return star;
}
public string GetRace(long race)
{
if(race==0)
return "";
if(mRacedic==null)
return "";
if(mRacedic.ContainsKey(race))
return cn2tw(mRacedic[race]);
return "";
}
public string GetDesc(string desc,string regx)
{
desc=desc.Replace(Environment.NewLine,"\n");
Regex regex=new Regex(regx);
Match mc=regex.Match(desc);
if(mc.Success)
return (mc.Groups.Count>1)?
mc.Groups[1].Value:mc.Groups[0].Value;
return "";
}
public string GetAttribute(int attr)
{
CardAttribute cattr= (CardAttribute)attr;
string sattr="none";
switch(cattr)
{
case CardAttribute.ATTRIBUTE_DARK:
sattr="dark";
break;
case CardAttribute.ATTRIBUTE_DEVINE:
sattr="divine";
break;
case CardAttribute.ATTRIBUTE_EARTH:
sattr="earth";
break;
case CardAttribute.ATTRIBUTE_FIRE:
sattr="fire";
break;
case CardAttribute.ATTRIBUTE_LIGHT:
sattr="light";
break;
case CardAttribute.ATTRIBUTE_WATER:
sattr="water";
break;
case CardAttribute.ATTRIBUTE_WIND:
sattr="wind";
break;
}
return sattr;
}
}
}
......@@ -279,6 +279,7 @@ public void ExportData(string zipname)
zips.AddFile(lua,"script/c"+c.id.ToString()+".lua","");
}
}
File.Delete(cdbfile);
}
public void Run(){
......
This diff is collapsed.
This diff is collapsed.
......@@ -61,13 +61,19 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CodeEditForm.cs" />
<Compile Include="CodeEditForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CodeEditForm.Designer.cs">
<DependentUpon>CodeEditForm.cs</DependentUpon>
</Compile>
<Compile Include="Common\CheckUpdate.cs" />
<Compile Include="Common\DoubleContorl.cs" />
<Compile Include="Common\FastColoredTextBoxEx.cs" />
<Compile Include="Common\DoubleContorl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Common\FastColoredTextBoxEx.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Common\MyPath.cs" />
<Compile Include="Common\MySyntaxHighlighter.cs" />
<Compile Include="Common\MyBitmap.cs" />
......@@ -77,6 +83,7 @@
<Compile Include="Core\CardAttribute.cs" />
<Compile Include="Core\CardRace.cs" />
<Compile Include="Core\CardType.cs" />
<Compile Include="Core\CodeConfig.cs" />
<Compile Include="Core\DataBase.cs" />
<Compile Include="Core\DataConfig.cs" />
<Compile Include="Core\DataManager.cs" />
......@@ -84,16 +91,20 @@
<Compile Include="Core\LuaFunction.cs" />
<Compile Include="Core\MSE.cs" />
<Compile Include="Core\MSEConfig.cs" />
<Compile Include="Core\MSEConvert.cs" />
<Compile Include="Core\TaskHelper.cs" />
<Compile Include="DataEditForm.cs" />
<Compile Include="Core\YGOUtil.cs" />
<Compile Include="DataEditForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DataEditForm.Designer.cs">
<DependentUpon>DataEditForm.cs</DependentUpon>
</Compile>
<Compile Include="Language\LanguageHelper.cs" />
<Compile Include="Language\LMsg.cs" />
<Compile Include="Language\MyMsg.cs" />
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
......@@ -111,15 +122,7 @@
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="chinese" />
<Folder Include="Core" />
<Folder Include="english" />
<Folder Include="Common" />
<Folder Include="Language" />
<Folder Include="Magic Set Editor 2" />
<Folder Include="Magic Set Editor 2\update" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="app.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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("2.2.6.4")]
[assembly: AssemblyVersion("2.2.7.0")]
[DataEditorX]2.2.6.4[DataEditorX]
[DataEditorX]2.2.7.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
......@@ -58,6 +58,10 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字
★更新历史
2.2.7.0
修复导入图片
整理代码
图片搜索支持png,bmp
2.2.6.4
修复lua编辑器的自动完成
2.2.6.3
......
No preview for this file type
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<!-- Example connection to a SQL Server Database on localhost. -->
<!-- <add name="ExampleConnectionString"
connectionString="Data Source=.;Initial Catalog=DBName;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>
<appSettings>
<!-- access these values via the property:
System.Configuration.ConfigurationManager.AppSettings[key]
-->
<!-- language directory -->
<add key="language" value="chinese" />
<!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- Cut Images Setting -->
<add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" />
<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" />
<!-- CodeEdiotr Setting
IME = true 使用輸入法,正常顯示文字,反應變慢
IME = false English
-->
<add key="IME" value="false" />
<add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" />
</appSettings>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
# history
F:\games\ygopro\script\c33396948.lua
F:\games\ygopro\script\c242146.lua
F:\games\ygopro\cards.cdb
F:\games\ygopro\script\c255998.lua
\ No newline at end of file
F:\games\ygopro\script\c126218.lua
F:\games\ygopro\script\c131182.lua
F:\games\ygocore\script\c135598.lua
F:\games\ygocore\script\c126218.lua
F:\games\ygocore\script\c114932.lua
F:\games\ygocore\single\[sample]BerserkDragon.lua
F:\games\ygopro\script\c57774843.lua
F:\games\ygopro\script\c33396948.lua
F:\games\ygopro\script\c255998.lua
F:\games\ygopro\script\utility.lua
\ No newline at end of file
[DataEditorX]2.2.6.4[DataEditorX]
[DataEditorX]2.2.7.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
......@@ -58,6 +58,10 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字
★更新历史
2.2.7.0
修复导入图片
整理代码
图片搜索支持png,bmp
2.2.6.4
修复lua编辑器的自动完成
2.2.6.3
......
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