Commit 7d1cf42f authored by keyongyu's avatar keyongyu

1229

parent 981f8645
......@@ -16,14 +16,16 @@
using DataEditorX.Language;
using System.Text.RegularExpressions;
using DataEditorX.Core;
using DataEditorX.Config;
using System.Configuration;
using DataEditorX.Controls;
namespace DataEditorX
{
/// <summary>
/// Description of CodeEditForm.
/// </summary>
public partial class CodeEditForm : DockContent
public partial class CodeEditForm : DockContent, IEditForm
{
#region Style
SortedDictionary<long,string> cardlist;
......@@ -36,7 +38,6 @@ public partial class CodeEditForm : DockContent
AutocompleteMenu popupMenu_con;
AutocompleteMenu popupMenu_find;
string nowFile;
public string NowFile { get { return nowFile; } }
string title;
string oldtext;
Dictionary<string,string> tooltipDic;
......@@ -76,32 +77,22 @@ void InitForm()
popupMenu_find.Items.MaximumSize = new System.Drawing.Size(200, 400);
popupMenu_find.Items.Width = 300;
title=this.Text;
fctb.SyntaxHighlighter=new MySyntaxHighlighter();
string fontname=ConfigurationManager.AppSettings["fontname"];
float fontsize=0;
if(float.TryParse(ConfigurationManager.AppSettings["fontsize"]
, out fontsize))
string fontname = MyConfig.readString(MyConfig.TAG_FONT_NAME);
float fontsize = MyConfig.readFloat(MyConfig.TAG_FONT_SIZE, 14);
fctb.Font=new Font(fontname,fontsize);
if(ReadConfig("IME").ToLower()=="true")
if(MyConfig.readBoolean(MyConfig.TAG_IME))
fctb.ImeMode=ImeMode.On;
if (ReadConfig("wordwrap").ToLower() == "true")
if (MyConfig.readBoolean(MyConfig.TAG_WORDWRAP))
fctb.WordWrap = true;
else
fctb.WordWrap = false;
if (ReadConfig("tabisspace").ToLower() == "true")
if (MyConfig.readBoolean(MyConfig.TAG_TAB2SPACES))
tabisspaces = true;
else
tabisspaces = false;
}
string ReadConfig(string key)
{
string v = ConfigurationManager.AppSettings[key];
if (string.IsNullOrEmpty(v))
return "";
else
return v;
}
public void LoadXml(string xmlfile)
{
fctb.DescriptionFile=xmlfile;
......@@ -110,7 +101,23 @@ public void LoadXml(string xmlfile)
#endregion
#region Open
public void Open(string file)
public void SetActived()
{
this.Activate();
}
public bool CanOpen(string file)
{
return YGOUtil.isScript(file);
}
public string GetOpenFile()
{
return nowFile;
}
public bool Create(string file)
{
return Open(file);
}
public bool Open(string file)
{
if(!string.IsNullOrEmpty(file))
{
......@@ -126,7 +133,9 @@ public void Open(string file)
fctb.OpenFile(nowFile, new UTF8Encoding(false));
oldtext=fctb.Text;
SetTitle();
return true;
}
return false;
}
void HideMenu()
......@@ -323,7 +332,7 @@ bool savefile(bool saveas)
{
using (SaveFileDialog sfdlg = new SaveFileDialog())
{
sfdlg.Filter = "Script(*.lua)|*.lua|All Files(*.*)|*.*";
sfdlg.Filter = LANG.GetMsg(LMSG.ScriptFilter);
if (sfdlg.ShowDialog() == DialogResult.OK)
{
nowFile = sfdlg.FileName;
......
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DataEditorX.Common
{
class CodeEdit : RichTextBox
public class Area
{
public CodeEdit()
: base()
public Area()
{
left = 0;
top = 0;
width = 0;
height = 0;
}
public int left;
public int top;
public int width;
public int height;
}
}
......@@ -7,8 +7,9 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using DataEditorX.Common;
namespace DataEditorX
namespace DataEditorX.Common
{
/// <summary>
/// Description of ImageHelper.
......@@ -44,6 +45,10 @@ public static Bitmap Zoom(Bitmap sourceBitmap, int newWidth, int newHeight)
#endregion
#region 裁剪
public static Bitmap Cut(Bitmap sourceBitmap, Area area)
{
return Cut(sourceBitmap, area.left, area.top, area.width, area.height);
}
/// <summary>
/// 裁剪图像
/// </summary>
......
/*
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 2014-10-25
......
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using DataEditorX.Common;
namespace DataEditorX.Config
{
class MyConfig
{
public const int WM_OPEN = 0x0401;
public const int MAX_HISTORY = 0x10;
public const string TAG_DATA = "data";
public const string TAG_LANGUAGE = "language";
public const string TAG_IMAGE_OTHER = "image_other";
public const string TAG_IMAGE_XYZ = "image_xyz";
public const string TAG_IMAGE_PENDULUM = "image_pendulum";
public const string TAG_IMAGE_SIZE = "image";
public const string TAG_IMAGE_QUILTY = "image_quilty";
public const string TAG_FONT_NAME = "fontname";
public const string TAG_FONT_SIZE = "fontsize";
public const string TAG_IME = "IME";
public const string TAG_WORDWRAP = "wordwrap";
public const string TAG_TAB2SPACES = "tabisspace";
public const string TAG_SOURCE_URL = "sourceURL";
public const string TAG_UPDATE_URL = "updateURL";
public const string FILE_LANGUAGE = "language.txt";
public const string FILE_TEMP = "open.tmp";
public const string FILE_MESSAGE = "message.txt";
public const string FILE_HISTORY = "history.txt";
public static string readString(string key)
{
return ConfigurationManager.AppSettings[key];
}
public static int readInteger(string key,int def)
{
int i;
if (int.TryParse(readString(key), out i))
return i;
return def;
}
public static float readFloat(string key, float def)
{
float i;
if (float.TryParse(readString(key), out i))
return i;
return def;
}
public static int[] readIntegers(string key, int length)
{
string temp = readString(key);
int[] ints = new int[length];
string[] ws = string.IsNullOrEmpty(temp) ? null : temp.Split(',');
if (ws != null && ws.Length > 0 && ws.Length <= length)
{
for (int i = 0; i < ws.Length; i++)
{
int.TryParse(ws[i], out ints[i]);
}
}
return ints;
}
public static Area readArea(string key)
{
int[] ints = readIntegers(key, 4);
Area a = new Area();
if (ints != null)
{
a.left = ints[0];
a.top = ints[1];
a.width = ints[2];
a.height = ints[3];
}
return a;
}
public static bool readBoolean(string key)
{
if (readString(key).ToLower() == "true")
return true;
else
return false;
}
}
}
......@@ -13,14 +13,13 @@
namespace FastColoredTextBoxNS
{
/// <summary>
/// Description of FastColoredTextBoxEx.
/// </summary>
public class FastColoredTextBoxEx : FastColoredTextBox
{
Point lastMouseCoord;
string mFile;
public FastColoredTextBoxEx() : base()
{
this.SyntaxHighlighter = new MySyntaxHighlighter();
}
public new event EventHandler<ToolTipNeededEventArgs> ToolTipNeeded;
protected override void OnMouseMove(MouseEventArgs e)
......
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using DataEditorX.Core;
using DataEditorX.Config;
using System.Windows.Forms;
using DataEditorX.Language;
namespace DataEditorX.Controls
{
interface IMainForm
{
void CdbMenuClear();
void LuaMenuClear();
void AddCdbMenu(ToolStripItem item);
void AddLuaMenu(ToolStripItem item);
void Open(string file);
}
class History
{
IMainForm mainForm;
string historyFile;
List<string> cdbhistory;
List<string> luahistory;
public string[] GetcdbHistory()
{
return cdbhistory.ToArray();
}
public string[] GetluaHistory()
{
return luahistory.ToArray();
}
public History(IMainForm mainForm)
{
this.mainForm = mainForm;
cdbhistory = new List<string>();
luahistory = new List<string>();
}
public void ReadHistory(string historyFile)
{
if (!File.Exists(historyFile))
return;
this.historyFile = historyFile;
string[] lines = File.ReadAllLines(historyFile);
AddHistorys(lines);
}
void AddHistorys(string[] lines)
{
luahistory.Clear();
cdbhistory.Clear();
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if (File.Exists(line))
{
if (YGOUtil.isScript(line))
{
if (luahistory.Count < MyConfig.MAX_HISTORY
&& luahistory.IndexOf(line) < 0)
luahistory.Add(line);
}
else
{
if (cdbhistory.Count < MyConfig.MAX_HISTORY
&& cdbhistory.IndexOf(line) < 0)
cdbhistory.Add(line);
}
}
}
}
public void AddHistory(string file)
{
List<string> tmplist = new List<string>();
//添加到开始
tmplist.Add(file);
//添加旧记录
tmplist.AddRange(cdbhistory.ToArray());
tmplist.AddRange(luahistory.ToArray());
//
AddHistorys(tmplist.ToArray());
SaveHistory();
MenuHistory();
}
void SaveHistory()
{
string texts = "# database history";
foreach (string str in cdbhistory)
{
if (File.Exists(str))
texts += Environment.NewLine + str;
}
texts += Environment.NewLine + "# script history";
foreach (string str in luahistory)
{
if (File.Exists(str))
texts += Environment.NewLine + str;
}
File.Delete(historyFile);
File.WriteAllText(historyFile, texts);
}
public void MenuHistory()
{
//cdb历史
mainForm.CdbMenuClear();
foreach (string str in cdbhistory)
{
ToolStripMenuItem tsmi = new ToolStripMenuItem(str);
tsmi.Click += MenuHistoryItem_Click;
mainForm.AddCdbMenu(tsmi);
}
mainForm.AddCdbMenu(new ToolStripSeparator());
ToolStripMenuItem tsmiclear = new ToolStripMenuItem(LANG.GetMsg(LMSG.ClearHistory));
tsmiclear.Click += MenuHistoryClear_Click;
mainForm.AddCdbMenu(tsmiclear);
//lua历史
mainForm.LuaMenuClear();
foreach (string str in luahistory)
{
ToolStripMenuItem tsmi = new ToolStripMenuItem(str);
tsmi.Click += MenuHistoryItem_Click;
mainForm.AddLuaMenu(tsmi);
}
mainForm.AddLuaMenu(new ToolStripSeparator());
ToolStripMenuItem tsmiclear2 = new ToolStripMenuItem(LANG.GetMsg(LMSG.ClearHistory));
tsmiclear2.Click += MenuHistoryClear2_Click;
mainForm.AddLuaMenu(tsmiclear2);
}
void MenuHistoryClear2_Click(object sender, EventArgs e)
{
luahistory.Clear();
MenuHistory();
SaveHistory();
}
void MenuHistoryClear_Click(object sender, EventArgs e)
{
cdbhistory.Clear();
MenuHistory();
SaveHistory();
}
void MenuHistoryItem_Click(object sender, EventArgs e)
{
ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
if (tsmi != null)
{
string file = tsmi.Text;
mainForm.Open(file);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace DataEditorX.Controls
{
interface IEditForm
{
string GetOpenFile();
bool Create(string file);
bool Open(string file);
bool CanOpen(string file);
bool Save();
void SetActived();
}
}
......@@ -7,12 +7,12 @@
*/
using System;
using System.Configuration;
using DataEditorX.Config;
using DataEditorX.Common;
namespace DataEditorX.Core
{
/// <summary>
/// Description of ImageSet.
/// </summary>
public class ImageSet
{
bool isInit;
......@@ -24,55 +24,25 @@ public void Init()
if(isInit)
return;
isInit=true;
string temp=ConfigurationManager.AppSettings["image_other"];
string[] ws=string.IsNullOrEmpty(temp)?null:temp.Split(',');
if(ws!=null && ws.Length==4){
int.TryParse(ws[0],out this.other_x);
int.TryParse(ws[1],out this.other_y);
int.TryParse(ws[2],out this.other_w);
int.TryParse(ws[3],out this.other_h);
}
//MyMsg.Show(string.Format("other:{0},{1},{2},{3}",other_x,other_y,other_w,other_h));
temp=ConfigurationManager.AppSettings["image_xyz"];
ws=string.IsNullOrEmpty(temp)?null:temp.Split(',');
if(ws!=null && ws.Length==4){
int.TryParse(ws[0],out this.xyz_x);
int.TryParse(ws[1],out this.xyz_y);
int.TryParse(ws[2],out this.xyz_w);
int.TryParse(ws[3],out this.xyz_h);
}
//MyMsg.Show(string.Format("xyz:{0},{1},{2},{3}",xyz_x,xyz_y,xyz_w,xyz_h));
temp=ConfigurationManager.AppSettings["image_pendulum"];
ws=string.IsNullOrEmpty(temp)?null:temp.Split(',');
if(ws!=null && ws.Length==4){
int.TryParse(ws[0],out this.pendulum_x);
int.TryParse(ws[1],out this.pendulum_y);
int.TryParse(ws[2],out this.pendulum_w);
int.TryParse(ws[3],out this.pendulum_h);
}
//MyMsg.Show(string.Format("pendulum:{0},{1},{2},{3}",pendulum_x,pendulum_y,pendulum_w,pendulum_h));
temp=ConfigurationManager.AppSettings["image"];
ws=string.IsNullOrEmpty(temp)?null:temp.Split(',');
if(ws!=null && ws.Length==4){
int.TryParse(ws[0],out this.w);
int.TryParse(ws[1],out this.h);
int.TryParse(ws[2],out this.W);
int.TryParse(ws[3],out this.H);
}
//MyMsg.Show(string.Format("image:{0},{1},{2},{3}",w,h,W,H));
temp=ConfigurationManager.AppSettings["image_quilty"];
if(!string.IsNullOrEmpty(temp)){
int.TryParse(temp, out this.quilty);
}
//MyMsg.Show(string.Format("quilty:{0}",quilty));
this.normalArea = MyConfig.readArea(MyConfig.TAG_IMAGE_OTHER);
this.xyzArea = MyConfig.readArea(MyConfig.TAG_IMAGE_XYZ);
this.pendulumArea = MyConfig.readArea(MyConfig.TAG_IMAGE_PENDULUM);
int[] ints = MyConfig.readIntegers(MyConfig.TAG_IMAGE_SIZE, 4);
this.w = ints[0];
this.h = ints[1];
this.W = ints[2];
this.H = ints[3];
this.quilty = MyConfig.readInteger(MyConfig.TAG_IMAGE_QUILTY, 95);
}
public int quilty;
public int w,h,W,H;
public int other_x,other_y;
public int other_w,other_h;
public int xyz_x,xyz_y;
public int xyz_w,xyz_h;
public int pendulum_x,pendulum_y;
public int pendulum_w,pendulum_h;
public Area normalArea;
public Area xyzArea;
public Area pendulumArea;
}
}
......@@ -16,6 +16,8 @@
using System.ComponentModel;
using DataEditorX.Language;
using DataEditorX.Common;
using DataEditorX.Config;
namespace DataEditorX.Core
{
......@@ -72,8 +74,7 @@ public void Cancel()
}
public static void CheckVersion(bool showNew)
{
string newver = CheckUpdate.Check(
ConfigurationManager.AppSettings["updateURL"]);
string newver = CheckUpdate.Check(MyConfig.readString(MyConfig.TAG_UPDATE_URL));
int iver, iver2;
int.TryParse(Application.ProductVersion.Replace(".", ""), out iver);
int.TryParse(newver.Replace(".", ""), out iver2);
......@@ -121,19 +122,13 @@ public void CutImages(string imgpath,bool isreplace)
Bitmap bp=new Bitmap(jpg);
Bitmap bmp=null;
if(c.IsType(CardType.TYPE_XYZ)){
bmp = MyBitmap.Cut(bp,
imgSet.xyz_x,imgSet.xyz_y,
imgSet.xyz_w,imgSet.xyz_h);
bmp = MyBitmap.Cut(bp, imgSet.xyzArea);
}
else if(c.IsType(CardType.TYPE_PENDULUM)){
bmp = MyBitmap.Cut(bp,
imgSet.pendulum_x,imgSet.pendulum_y,
imgSet.pendulum_w,imgSet.pendulum_h);
bmp = MyBitmap.Cut(bp, imgSet.pendulumArea);
}
else{
bmp = MyBitmap.Cut(bp,
imgSet.other_x,imgSet.other_y,
imgSet.other_w,imgSet.other_h);
bmp = MyBitmap.Cut(bp, imgSet.normalArea);
}
MyBitmap.SaveAsJPEG(bmp, savejpg, imgSet.quilty);
//bmp.Save(savejpg, ImageFormat.Png);
......
......@@ -20,7 +20,18 @@ public static void SetConfig(DataConfig dcfg)
{
datacfg = dcfg;
}
public static bool isScript(string file)
{
if (file != null && file.EndsWith(".lua", StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
public static bool isDataBase(string file)
{
if (file != null && file.EndsWith(".cdb", StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
public static string GetCardImagePath(string picpath,Card c)
{
string jpg = MyPath.Combine(picpath, c.id + ".jpg");
......
......@@ -17,43 +17,42 @@
using DataEditorX.Core;
using DataEditorX.Language;
using WeifenLuo.WinFormsUI.Docking;
using DataEditorX.Controls;
using DataEditorX.Config;
namespace DataEditorX
{
public partial class DataEditForm : DockContent
public partial class DataEditForm : DockContent, IEditForm
{
#region 成员变量
TaskHelper tasker=null;
TaskHelper tasker = null;
string taskname;
string GAMEPATH="",PICPATH="",PICPATH2="",LUAPTH="";
string GAMEPATH = "", PICPATH = "", PICPATH2 = "", LUAPTH = "";
/// <summary>当前卡片</summary>
Card oldCard=new Card(0);
Card oldCard = new Card(0);
/// <summary>搜索条件</summary>
Card srcCard=new Card(0);
string[] strs=null;
Card srcCard = new Card(0);
string[] strs = null;
List<string> tmpCodes;
string title;
string nowCdbFile="";
int MaxRow=20;
int page=1,pageNum=1;
string nowCdbFile = "";
int MaxRow = 20;
int page = 1, pageNum = 1;
int cardcount;
string undoString;
List<Card> cardlist=new List<Card>();
List<Card> cardlist = new List<Card>();
bool[] setcodeIsedit = new bool[5];
Image m_cover;
DataConfig datacfg;
string datapath, confcover;
public string getNowCDB()
{
return nowCdbFile;
}
public DataEditForm(string datapath,string cdbfile)
public DataEditForm(string datapath, string cdbfile)
{
InitPath(datapath);
Initialize();
nowCdbFile=cdbfile;
nowCdbFile = cdbfile;
}
public DataEditForm(string datapath)
......@@ -63,26 +62,45 @@ public DataEditForm(string datapath)
}
public DataEditForm()
{
string dir=ConfigurationManager.AppSettings["language"];
if(string.IsNullOrEmpty(dir))
string dir = MyConfig.readString(MyConfig.TAG_LANGUAGE);
if (string.IsNullOrEmpty(dir))
{
Application.Exit();
}
datapath=MyPath.Combine(Application.StartupPath, dir);
datapath = MyPath.Combine(Application.StartupPath, dir);
InitPath(datapath);
Initialize();
}
void Initialize()
{
datacfg=null;
datacfg = null;
tmpCodes = new List<string>();
InitializeComponent();
title=this.Text;
nowCdbFile="";
title = this.Text;
nowCdbFile = "";
}
#endregion
public void SetActived()
{
this.Activate();
}
public string GetOpenFile()
{
return nowCdbFile;
}
public bool CanOpen(string file)
{
return YGOUtil.isDataBase(file);
}
public bool Create(string file)
{
return Open(file);
}
public bool Save()
{
return true;
}
#region 窗体
//窗体第一次加载
void DataEditFormLoad(object sender, EventArgs e)
......@@ -91,29 +109,30 @@ void DataEditFormLoad(object sender, EventArgs e)
HideMenu();//是否需要隐藏菜单
SetTitle();
if(datacfg==null){
datacfg=new DataConfig(datapath);
if (datacfg == null)
{
datacfg = new DataConfig(datapath);
datacfg.Init();
}
tasker=new TaskHelper(datapath, bgWorker1,
tasker = new TaskHelper(datapath, bgWorker1,
datacfg.dicCardTypes,
datacfg.dicCardRaces);
//设置空白卡片
oldCard=new Card(0);
oldCard = new Card(0);
SetCard(oldCard);
if (nowCdbFile !=null && File.Exists(nowCdbFile))
if (nowCdbFile != null && File.Exists(nowCdbFile))
Open(nowCdbFile);
// CheckUpdate(false);//检查更新
}
//窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
{
if(tasker!=null && tasker.IsRuning())
if (tasker != null && tasker.IsRuning())
{
if(!CancelTask())
if (!CancelTask())
{
e.Cancel=true;
e.Cancel = true;
return;
}
......@@ -130,19 +149,19 @@ void DataEditFormEnter(object sender, EventArgs e)
//隐藏菜单
void HideMenu()
{
if(this.MdiParent ==null)
if (this.MdiParent == null)
return;
menuStrip1.Visible=false;
menuitem_file.Visible=false;
menuitem_file.Enabled=false;
menuStrip1.Visible = false;
menuitem_file.Visible = false;
menuitem_file.Enabled = false;
//this.SuspendLayout();
this.ResumeLayout(true);
foreach(Control c in this.Controls)
foreach (Control c in this.Controls)
{
if(c.GetType()==typeof(MenuStrip))
if (c.GetType() == typeof(MenuStrip))
continue;
Point p=c.Location;
c.Location=new Point(p.X, p.Y-25);
Point p = c.Location;
c.Location = new Point(p.X, p.Y - 25);
}
this.ResumeLayout(false);
//this.PerformLayout();
......@@ -150,72 +169,74 @@ void HideMenu()
//移除Tag
string RemoveTag(string text)
{
int t=text.LastIndexOf(" (");
if(t>0)
int t = text.LastIndexOf(" (");
if (t > 0)
{
return text.Substring(0,t);
return text.Substring(0, t);
}
return text;
}
//设置标题
void SetTitle()
{
string str=title;
string str2=RemoveTag(title);
if(!string.IsNullOrEmpty(nowCdbFile)){
str=nowCdbFile+"-"+str;
str2=Path.GetFileName(nowCdbFile);
string str = title;
string str2 = RemoveTag(title);
if (!string.IsNullOrEmpty(nowCdbFile))
{
str = nowCdbFile + "-" + str;
str2 = Path.GetFileName(nowCdbFile);
}
if(this.MdiParent !=null)
if (this.MdiParent != null)
{
this.Text = str2;
if (tasker != null && tasker.IsRuning())
{
this.Text=str2;
if(tasker!=null && tasker.IsRuning()){
if(DockPanel.ActiveContent == this)
this.MdiParent.Text=str;
if (DockPanel.ActiveContent == this)
this.MdiParent.Text = str;
}
else
this.MdiParent.Text=str;
this.MdiParent.Text = str;
}
else
this.Text=str;
this.Text = str;
}
//按cdb路径设置目录
void SetCDB(string cdb)
{
this.nowCdbFile=cdb;
this.nowCdbFile = cdb;
SetTitle();
if(cdb.Length>0)
if (cdb.Length > 0)
{
char SEP=Path.DirectorySeparatorChar;
int l=nowCdbFile.LastIndexOf(SEP);
GAMEPATH=(l>0)?nowCdbFile.Substring(0,l+1):cdb;
char SEP = Path.DirectorySeparatorChar;
int l = nowCdbFile.LastIndexOf(SEP);
GAMEPATH = (l > 0) ? nowCdbFile.Substring(0, l + 1) : cdb;
}
else
GAMEPATH=Application.StartupPath;
PICPATH=MyPath.Combine(GAMEPATH,"pics");
PICPATH2=MyPath.Combine(PICPATH,"thumbnail");
LUAPTH=MyPath.Combine(GAMEPATH,"script");
GAMEPATH = Application.StartupPath;
PICPATH = MyPath.Combine(GAMEPATH, "pics");
PICPATH2 = MyPath.Combine(PICPATH, "thumbnail");
LUAPTH = MyPath.Combine(GAMEPATH, "script");
}
//初始化文件路径
void InitPath(string datapath)
{
this.datapath=datapath;
confcover= MyPath.Combine(datapath, "cover.jpg");
if(File.Exists(confcover))
m_cover=Image.FromFile(confcover);
this.datapath = datapath;
confcover = MyPath.Combine(datapath, "cover.jpg");
if (File.Exists(confcover))
m_cover = Image.FromFile(confcover);
else
m_cover=null;
m_cover = null;
}
//保存dic
void SaveDic(string file, Dictionary<long, string> dic)
{
using(FileStream fs=new FileStream(file,FileMode.OpenOrCreate,FileAccess.Write))
using (FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs,Encoding.UTF8);
foreach(long k in dic.Keys)
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
foreach (long k in dic.Keys)
{
sw.WriteLine("0x"+k.ToString("x")+" "+dic[k]);
sw.WriteLine("0x" + k.ToString("x") + " " + dic[k]);
}
sw.Close();
fs.Close();
......@@ -243,7 +264,7 @@ void InitControl()
//card categorys
InitCheckPanel(pl_category, datacfg.dicCardcategorys);
//setname
string[] setnames=DataManager.GetValues(datacfg.dicSetnames);
string[] setnames = DataManager.GetValues(datacfg.dicSetnames);
cb_setname1.Items.AddRange(setnames);
cb_setname2.Items.AddRange(setnames);
cb_setname3.Items.AddRange(setnames);
......@@ -255,14 +276,14 @@ void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic)
{
fpanel.SuspendLayout();
fpanel.Controls.Clear();
foreach(long key in dic.Keys)
{
CheckBox _cbox=new CheckBox();
_cbox.Name=fpanel.Name+key.ToString();
_cbox.Text=dic[key];
_cbox.AutoSize=true;
_cbox.Margin=fpanel.Margin;
_cbox.Click+= PanelOnCheckClick;
foreach (long key in dic.Keys)
{
CheckBox _cbox = new CheckBox();
_cbox.Name = fpanel.Name + key.ToString();
_cbox.Text = dic[key];
_cbox.AutoSize = true;
_cbox.Margin = fpanel.Margin;
_cbox.Click += PanelOnCheckClick;
fpanel.Controls.Add(_cbox);
}
fpanel.ResumeLayout(false);
......@@ -278,28 +299,28 @@ void InitComboBox(ComboBox cb, Dictionary<long, string> tempdic)
{
cb.Items.Clear();
cb.Items.AddRange(DataManager.GetValues(tempdic));
cb.SelectedIndex=0;
cb.SelectedIndex = 0;
}
//计算list最大行数
void InitListRows()
{
if ( lv_cardlist.Items.Count==0 )
if (lv_cardlist.Items.Count == 0)
{
ListViewItem item=new ListViewItem();
item.Text="Test";
ListViewItem item = new ListViewItem();
item.Text = "Test";
lv_cardlist.Items.Add(item);
}
int headH=lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Y;
int itemH=lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height;
if ( itemH>0 )
int headH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Y;
int itemH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height;
if (itemH > 0)
{
int n=( lv_cardlist.Height-headH-4 )/itemH;
if ( n>0 )
MaxRow=n;
int n = (lv_cardlist.Height - headH - 4) / itemH;
if (n > 0)
MaxRow = n;
}
lv_cardlist.Items.Clear();
if ( MaxRow<10 )
MaxRow=20;
if (MaxRow < 10)
MaxRow = 20;
}
//设置checkbox
string SetCheck(FlowLayoutPanel fpl, long number)
......@@ -448,43 +469,43 @@ void AddListView(int p)
#region 设置卡片
void SetCard(Card c)
{
oldCard=c;
tb_cardname.Text=c.name;
tb_cardtext.Text=c.desc;
oldCard = c;
tb_cardname.Text = c.name;
tb_cardtext.Text = c.desc;
strs=new string[c.str.Length];
Array.Copy(c.str,strs,c.str.Length);
strs = new string[c.str.Length];
Array.Copy(c.str, strs, c.str.Length);
lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(c.str);
tb_edittext.Text="";
tb_edittext.Text = "";
//data
SetSelect(datacfg.dicCardRules,cb_cardrule,(long)c.ot);
SetSelect(datacfg.dicCardAttributes,cb_cardattribute,(long)c.attribute);
SetSelect(datacfg.dicCardLevels,cb_cardlevel,(long)(c.level&0xff));
SetSelect(datacfg.dicCardRaces,cb_cardrace,c.race);
SetSelect(datacfg.dicCardRules, cb_cardrule, (long)c.ot);
SetSelect(datacfg.dicCardAttributes, cb_cardattribute, (long)c.attribute);
SetSelect(datacfg.dicCardLevels, cb_cardlevel, (long)(c.level & 0xff));
SetSelect(datacfg.dicCardRaces, cb_cardrace, c.race);
//setcode
long sc1=c.setcode&0xffff;
long sc2=(c.setcode>>0x10)&0xffff;
long sc3=(c.setcode>>0x20)&0xffff;
long sc4=(c.setcode>>0x30)&0xffff;
tb_setcode1.Text=sc1.ToString("x");
tb_setcode2.Text=sc2.ToString("x");
tb_setcode3.Text=sc3.ToString("x");
tb_setcode4.Text=sc4.ToString("x");
long sc1 = c.setcode & 0xffff;
long sc2 = (c.setcode >> 0x10) & 0xffff;
long sc3 = (c.setcode >> 0x20) & 0xffff;
long sc4 = (c.setcode >> 0x30) & 0xffff;
tb_setcode1.Text = sc1.ToString("x");
tb_setcode2.Text = sc2.ToString("x");
tb_setcode3.Text = sc3.ToString("x");
tb_setcode4.Text = sc4.ToString("x");
SetSelect(datacfg.dicSetnames, cb_setname1, sc1);
SetSelect(datacfg.dicSetnames, cb_setname2, sc2);
SetSelect(datacfg.dicSetnames, cb_setname3, sc3);
SetSelect(datacfg.dicSetnames, cb_setname4, sc4);
//type,category
SetCheck(pl_cardtype,c.type);
SetCheck(pl_category,c.category);
SetCheck(pl_cardtype, c.type);
SetCheck(pl_category, c.category);
//text
tb_pleft.Text=((c.level >> 0x18) & 0xff).ToString();
tb_pright.Text=((c.level >> 0x10) & 0xff).ToString();
tb_atk.Text=(c.atk<0)?"?":c.atk.ToString();
tb_def.Text=(c.def<0)?"?":c.def.ToString();
tb_cardcode.Text=c.id.ToString();
tb_cardalias.Text=c.alias.ToString();
tb_pleft.Text = ((c.level >> 0x18) & 0xff).ToString();
tb_pright.Text = ((c.level >> 0x10) & 0xff).ToString();
tb_atk.Text = (c.atk < 0) ? "?" : c.atk.ToString();
tb_def.Text = (c.def < 0) ? "?" : c.def.ToString();
tb_cardcode.Text = c.id.ToString();
tb_cardalias.Text = c.alias.ToString();
setImage(c.id.ToString());
}
#endregion
......@@ -493,47 +514,47 @@ void SetCard(Card c)
Card GetCard()
{
int temp;
Card c=new Card(0);
c.name=tb_cardname.Text;
c.desc=tb_cardtext.Text;
Array.Copy(strs,c.str, c.str.Length);
int.TryParse(GetSelect(datacfg.dicCardRules,cb_cardrule),out c.ot);
int.TryParse(GetSelect(datacfg.dicCardAttributes,cb_cardattribute),out c.attribute);
long.TryParse(GetSelect(datacfg.dicCardLevels,cb_cardlevel),out c.level);
long.TryParse(GetSelect(datacfg.dicCardRaces,cb_cardrace),out c.race);
Card c = new Card(0);
c.name = tb_cardname.Text;
c.desc = tb_cardtext.Text;
Array.Copy(strs, c.str, c.str.Length);
int.TryParse(GetSelect(datacfg.dicCardRules, cb_cardrule), out c.ot);
int.TryParse(GetSelect(datacfg.dicCardAttributes, cb_cardattribute), out c.attribute);
long.TryParse(GetSelect(datacfg.dicCardLevels, cb_cardlevel), out c.level);
long.TryParse(GetSelect(datacfg.dicCardRaces, cb_cardrace), out c.race);
//setcode
int.TryParse(tb_setcode1.Text, NumberStyles.HexNumber,null,out temp);
c.setcode =temp;
int.TryParse(tb_setcode2.Text, NumberStyles.HexNumber,null,out temp);
c.setcode +=((long)temp<<0x10);
int.TryParse(tb_setcode3.Text, NumberStyles.HexNumber,null,out temp);
c.setcode +=((long)temp<<0x20);
int.TryParse(tb_setcode4.Text, NumberStyles.HexNumber,null,out temp);
c.setcode +=((long)temp<<0x30);
int.TryParse(tb_setcode1.Text, NumberStyles.HexNumber, null, out temp);
c.setcode = temp;
int.TryParse(tb_setcode2.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x10);
int.TryParse(tb_setcode3.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x20);
int.TryParse(tb_setcode4.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x30);
//c.setcode = getSetcodeByText();
c.type=GetCheck(pl_cardtype);
c.category=GetCheck(pl_category);
int.TryParse(tb_pleft.Text,out temp);
c.level+=(temp << 0x18);
int.TryParse(tb_pright.Text,out temp);
c.level+=(temp << 0x10);
if(tb_atk.Text=="?"||tb_atk.Text=="?")
c.atk=-2;
else if(tb_atk.Text==".")
c.atk=-1;
c.type = GetCheck(pl_cardtype);
c.category = GetCheck(pl_category);
int.TryParse(tb_pleft.Text, out temp);
c.level += (temp << 0x18);
int.TryParse(tb_pright.Text, out temp);
c.level += (temp << 0x10);
if (tb_atk.Text == "?" || tb_atk.Text == "?")
c.atk = -2;
else if (tb_atk.Text == ".")
c.atk = -1;
else
int.TryParse( tb_atk.Text,out c.atk);
if(tb_def.Text=="?"||tb_def.Text=="?")
c.def=-2;
else if(tb_def.Text==".")
c.def=-1;
int.TryParse(tb_atk.Text, out c.atk);
if (tb_def.Text == "?" || tb_def.Text == "?")
c.def = -2;
else if (tb_def.Text == ".")
c.def = -1;
else
int.TryParse( tb_def.Text,out c.def);
long.TryParse( tb_cardcode.Text,out c.id);
long.TryParse( tb_cardalias.Text,out c.alias);
int.TryParse(tb_def.Text, out c.def);
long.TryParse(tb_cardcode.Text, out c.id);
long.TryParse(tb_cardalias.Text, out c.alias);
return c;
}
......@@ -543,13 +564,13 @@ Card GetCard()
//列表选择
void Lv_cardlistSelectedIndexChanged(object sender, EventArgs e)
{
if(lv_cardlist.SelectedItems.Count>0)
if (lv_cardlist.SelectedItems.Count > 0)
{
int sel=lv_cardlist.SelectedItems[0].Index;
int index=(page-1)*MaxRow+sel;
if(index<cardlist.Count)
int sel = lv_cardlist.SelectedItems[0].Index;
int index = (page - 1) * MaxRow + sel;
if (index < cardlist.Count)
{
Card c=cardlist[index];
Card c = cardlist[index];
SetCard(c);
}
}
......@@ -557,17 +578,17 @@ void Lv_cardlistSelectedIndexChanged(object sender, EventArgs e)
//列表按键
void Lv_cardlistKeyDown(object sender, KeyEventArgs e)
{
switch(e.KeyCode)
switch (e.KeyCode)
{
case Keys.Delete:DelCards();break;
case Keys.Right:Btn_PageDownClick(null,null);break;
case Keys.Left:Btn_PageUpClick(null,null);break;
case Keys.Delete: DelCards(); break;
case Keys.Right: Btn_PageDownClick(null, null); break;
case Keys.Left: Btn_PageUpClick(null, null); break;
}
}
//上一页
void Btn_PageUpClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
page--;
AddListView(page);
......@@ -575,7 +596,7 @@ void Btn_PageUpClick(object sender, EventArgs e)
//下一页
void Btn_PageDownClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
page++;
AddListView(page);
......@@ -583,11 +604,11 @@ void Btn_PageDownClick(object sender, EventArgs e)
//跳转到指定页数
void Tb_pageKeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar==(char)Keys.Enter)
if (e.KeyChar == (char)Keys.Enter)
{
int p;
int.TryParse(tb_page.Text,out p);
if(p>0)
int.TryParse(tb_page.Text, out p);
if (p > 0)
AddListView(p);
}
}
......@@ -597,9 +618,9 @@ void Tb_pageKeyPress(object sender, KeyPressEventArgs e)
//检查是否打开数据库
public bool Check()
{
if(datacfg == null)
if (datacfg == null)
return false;
if(File.Exists(nowCdbFile))
if (File.Exists(nowCdbFile))
return true;
else
{
......@@ -608,10 +629,10 @@ public bool Check()
}
}
//打开数据库
public bool Open(string cdbFile)
public bool Open(string file)
{
SetCDB(cdbFile);
if(!File.Exists(cdbFile))
SetCDB(file);
if (!File.Exists(file))
{
MyMsg.Error(LMSG.FileIsNotExists);
return false;
......@@ -620,44 +641,45 @@ public bool Open(string cdbFile)
tmpCodes.Clear();
cardlist.Clear();
//检查表是否存在
DataBase.CheckTable(cdbFile);
srcCard=new Card();
SetCards(DataBase.Read(cdbFile,true,""),false);
DataBase.CheckTable(file);
srcCard = new Card();
SetCards(DataBase.Read(file, true, ""), false);
return true;
}
//设置卡片组
public void SetCards(Card[] cards, bool isfresh)
{
if(cards!=null)
if (cards != null)
{
cardlist.Clear();
foreach(Card c in cards){
if(srcCard.setcode==0)
foreach (Card c in cards)
{
if (srcCard.setcode == 0)
cardlist.Add(c);
else if(c.IsSetCode(srcCard.setcode&0xffff))
else if (c.IsSetCode(srcCard.setcode & 0xffff))
cardlist.Add(c);
}
cardcount=cardlist.Count;
pageNum=cardcount/MaxRow;
if(cardcount%MaxRow > 0)
cardcount = cardlist.Count;
pageNum = cardcount / MaxRow;
if (cardcount % MaxRow > 0)
pageNum++;
else if(cardcount==0)
pageNum=1;
tb_pagenum.Text=pageNum.ToString();
else if (cardcount == 0)
pageNum = 1;
tb_pagenum.Text = pageNum.ToString();
if(isfresh)
if (isfresh)
AddListView(page);
else
AddListView(1);
}
else
{
cardcount=0;
page=1;
pageNum=1;
tb_page.Text=page.ToString();
tb_pagenum.Text=pageNum.ToString();
cardcount = 0;
page = 1;
pageNum = 1;
tb_page.Text = page.ToString();
tb_pagenum.Text = pageNum.ToString();
cardlist.Clear();
lv_cardlist.Items.Clear();
SetCard(new Card(0));
......@@ -666,27 +688,28 @@ public void SetCards(Card[] cards, bool isfresh)
//搜索卡片
public void Search(Card c, bool isfresh)
{
if(!Check())
if (!Check())
return;
if (tmpCodes.Count>0)
if (tmpCodes.Count > 0)
{
Card[] mcards = DataBase.Read(nowCdbFile,
true, tmpCodes.ToArray());
SetCards(getCompCards(), true);
}
else{
srcCard=c;
string sql=DataBase.GetSelectSQL(c);
#if DEBUG
else
{
srcCard = c;
string sql = DataBase.GetSelectSQL(c);
#if DEBUG
MyMsg.Show(sql);
#endif
SetCards(DataBase.Read(nowCdbFile, true, sql),isfresh);
#endif
SetCards(DataBase.Read(nowCdbFile, true, sql), isfresh);
}
}
//更新临时卡片
public void Reset()
{
oldCard=new Card(0);
oldCard = new Card(0);
SetCard(oldCard);
}
#endregion
......@@ -695,26 +718,26 @@ public void Reset()
//添加
public bool AddCard()
{
if(!Check())
if (!Check())
return false;
Card c=GetCard();
if(c.id<=0)
Card c = GetCard();
if (c.id <= 0)
{
MyMsg.Error(LMSG.CodeCanNotIsZero);
return false;
}
foreach(Card ckey in cardlist)
foreach (Card ckey in cardlist)
{
if(c.id==ckey.id)
if (c.id == ckey.id)
{
MyMsg.Warning(LMSG.ItIsExists);
return false;
}
}
if(DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c,true))>=2)
if (DataBase.Command(nowCdbFile, DataBase.GetInsertSQL(c, true)) >= 2)
{
MyMsg.Show(LMSG.AddSucceed);
undoString=DataBase.GetDeleteSQL(c);
undoString = DataBase.GetDeleteSQL(c);
Search(srcCard, true);
return true;
}
......@@ -724,40 +747,40 @@ public bool AddCard()
//修改
public bool ModCard()
{
if(!Check())
if (!Check())
return false;
Card c=GetCard();
Card c = GetCard();
if(c.Equals(oldCard))
if (c.Equals(oldCard))
{
MyMsg.Show(LMSG.ItIsNotChanged);
return false;
}
if(c.id<=0)
if (c.id <= 0)
{
MyMsg.Error(LMSG.CodeCanNotIsZero);
return false;
}
string sql;
if(c.id!=oldCard.id)
if (c.id != oldCard.id)
{
if(MyMsg.Question(LMSG.IfDeleteCard))
if (MyMsg.Question(LMSG.IfDeleteCard))
{
if(DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard))<2)
if (DataBase.Command(nowCdbFile, DataBase.GetDeleteSQL(oldCard)) < 2)
{
MyMsg.Error(LMSG.DeleteFail);
return false;
}
}
sql=DataBase.GetInsertSQL(c,false);
sql = DataBase.GetInsertSQL(c, false);
}
else
sql=DataBase.GetUpdateSQL(c);
if(DataBase.Command(nowCdbFile, sql)>0)
sql = DataBase.GetUpdateSQL(c);
if (DataBase.Command(nowCdbFile, sql) > 0)
{
MyMsg.Show(LMSG.ModifySucceed);
undoString=DataBase.GetDeleteSQL(c);
undoString+=DataBase.GetInsertSQL(oldCard,false);
undoString = DataBase.GetDeleteSQL(c);
undoString += DataBase.GetInsertSQL(oldCard, false);
Search(srcCard, true);
SetCard(c);
}
......@@ -768,25 +791,25 @@ public bool ModCard()
//删除
public bool DelCards()
{
if(!Check())
if (!Check())
return false;
int ic=lv_cardlist.SelectedItems.Count;
if(ic==0)
int ic = lv_cardlist.SelectedItems.Count;
if (ic == 0)
return false;
if(!MyMsg.Question(LMSG.IfDeleteCard))
if (!MyMsg.Question(LMSG.IfDeleteCard))
return false;
List<string> sql=new List<string>();
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
List<string> sql = new List<string>();
foreach (ListViewItem lvitem in lv_cardlist.SelectedItems)
{
int index=lvitem.Index+(page-1)*MaxRow;
if(index<cardlist.Count)
int index = lvitem.Index + (page - 1) * MaxRow;
if (index < cardlist.Count)
{
Card c=cardlist[index];
undoString+=DataBase.GetInsertSQL(c, true);
Card c = cardlist[index];
undoString += DataBase.GetInsertSQL(c, true);
sql.Add(DataBase.GetDeleteSQL(c));
}
}
if(DataBase.Command(nowCdbFile, sql.ToArray())>=(sql.Count*2))
if (DataBase.Command(nowCdbFile, sql.ToArray()) >= (sql.Count * 2))
{
MyMsg.Show(LMSG.DeleteSucceed);
Search(srcCard, true);
......@@ -803,30 +826,30 @@ public bool DelCards()
//打开脚本
public bool OpenScript()
{
if(!Check())
if (!Check())
return false;
string lua=MyPath.Combine(LUAPTH,"c"+tb_cardcode.Text+".lua");
if(!File.Exists(lua))
string lua = MyPath.Combine(LUAPTH, "c" + tb_cardcode.Text + ".lua");
if (!File.Exists(lua))
{
if(! Directory.Exists(LUAPTH))
if (!Directory.Exists(LUAPTH))
Directory.CreateDirectory(LUAPTH);
if(MyMsg.Question(LMSG.IfCreateScript))
if (MyMsg.Question(LMSG.IfCreateScript))
{
if(!Directory.Exists(LUAPTH))
if (!Directory.Exists(LUAPTH))
Directory.CreateDirectory(LUAPTH);
using(FileStream fs=new FileStream(
using (FileStream fs = new FileStream(
lua,
FileMode.OpenOrCreate,
FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs,new UTF8Encoding(false));
sw.WriteLine("--"+tb_cardname.Text);
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
sw.WriteLine("--" + tb_cardname.Text);
sw.Close();
fs.Close();
}
}
}
if(File.Exists(lua))
if (File.Exists(lua))
{
System.Diagnostics.Process.Start(lua);
}
......@@ -835,11 +858,11 @@ public bool OpenScript()
//撤销
public void Undo()
{
if(string.IsNullOrEmpty(undoString))
if (string.IsNullOrEmpty(undoString))
{
return;
}
DataBase.Command(nowCdbFile,undoString);
DataBase.Command(nowCdbFile, undoString);
Search(srcCard, true);
}
......@@ -883,14 +906,14 @@ void Btn_undoClick(object sender, EventArgs e)
}
void Btn_imgClick(object sender, EventArgs e)
{
string tid=tb_cardcode.Text;
if(tid=="0" || tid.Length==0)
string tid = tb_cardcode.Text;
if (tid == "0" || tid.Length == 0)
return;
using(OpenFileDialog dlg=new OpenFileDialog())
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.SelectImage)+"-"+tb_cardname.Text;
dlg.Filter=LANG.GetMsg(LMSG.ImageType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.SelectImage) + "-" + tb_cardname.Text;
dlg.Filter = LANG.GetMsg(LMSG.ImageType);
if (dlg.ShowDialog() == DialogResult.OK)
{
//dlg.FileName;
ImportImage(dlg.FileName, tid);
......@@ -903,11 +926,11 @@ void Btn_imgClick(object sender, EventArgs e)
//卡片密码搜索
void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar==(char)Keys.Enter)
if (e.KeyChar == (char)Keys.Enter)
{
Card c=new Card(0);
Card c = new Card(0);
long.TryParse(tb_cardcode.Text, out c.id);
if(c.id>0)
if (c.id > 0)
{
tmpCodes.Clear();
Search(c, false);
......@@ -917,11 +940,12 @@ void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs e)
//卡片名称搜索、编辑
void Tb_cardnameKeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
if (e.KeyCode == Keys.Enter)
{
Card c = new Card(0);
c.name = tb_cardname.Text;
if (c.name.Length > 0)
{
Card c=new Card(0);
c.name=tb_cardname.Text;
if(c.name.Length>0){
tmpCodes.Clear();
Search(c, false);
}
......@@ -930,35 +954,39 @@ void Tb_cardnameKeyDown(object sender, KeyEventArgs e)
//卡片描述编辑
void Setscripttext(string str)
{
int index=-1;
try{
index=lb_scripttext.SelectedIndex;
int index = -1;
try
{
index = lb_scripttext.SelectedIndex;
}
catch{
index=-1;
catch
{
index = -1;
MyMsg.Error(LMSG.NotSelectScriptText);
}
if(index>=0)
if (index >= 0)
{
strs[index]=str;
strs[index] = str;
lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(strs);
lb_scripttext.SelectedIndex=index;
lb_scripttext.SelectedIndex = index;
}
}
string Getscripttext()
{
int index=-1;
try{
index=lb_scripttext.SelectedIndex;
int index = -1;
try
{
index = lb_scripttext.SelectedIndex;
}
catch{
index=-1;
catch
{
index = -1;
MyMsg.Error(LMSG.NotSelectScriptText);
}
if(index>=0)
if (index >= 0)
return strs[index];
else
return "";
......@@ -966,7 +994,7 @@ string Getscripttext()
//脚本文本
void Lb_scripttextSelectedIndexChanged(object sender, EventArgs e)
{
tb_edittext.Text=Getscripttext();
tb_edittext.Text = Getscripttext();
}
//脚本文本
......@@ -980,8 +1008,8 @@ void Tb_edittextTextChanged(object sender, EventArgs e)
void Menuitem_aboutClick(object sender, EventArgs e)
{
MyMsg.Show(
LANG.GetMsg(LMSG.About)+"\t"+Application.ProductName+"\n"
+LANG.GetMsg(LMSG.Version)+"\t"+Application.ProductVersion+"\n"
LANG.GetMsg(LMSG.About) + "\t" + Application.ProductName + "\n"
+ LANG.GetMsg(LMSG.Version) + "\t" + Application.ProductVersion + "\n"
+ LANG.GetMsg(LMSG.Author) + "\t柯永裕\n"
+ "Email:\t247321453@qq.com");
}
......@@ -992,21 +1020,23 @@ void Menuitem_checkupdateClick(object sender, EventArgs e)
}
public void CheckUpdate(bool showNew)
{
if(!isRun())
if (!isRun())
{
tasker.SetTask(MyTask.CheckUpdate,null,showNew.ToString());
tasker.SetTask(MyTask.CheckUpdate, null, showNew.ToString());
Run(LANG.GetMsg(LMSG.checkUpdate));
}
}
bool CancelTask()
{
bool bl=false;
if(tasker !=null && tasker.IsRuning()){
bl=MyMsg.Question(LMSG.IfCancelTask);
if(bl){
if(tasker!=null)
bool bl = false;
if (tasker != null && tasker.IsRuning())
{
bl = MyMsg.Question(LMSG.IfCancelTask);
if (bl)
{
if (tasker != null)
tasker.Cancel();
if(bgWorker1.IsBusy)
if (bgWorker1.IsBusy)
bgWorker1.CancelAsync();
}
}
......@@ -1018,18 +1048,18 @@ void Menuitem_cancelTaskClick(object sender, EventArgs e)
}
void Menuitem_githubClick(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(ConfigurationManager.AppSettings["sourceURL"]);
System.Diagnostics.Process.Start(MyConfig.readString(MyConfig.TAG_SOURCE_URL));
}
#endregion
#region 文件菜单
void Menuitem_openClick(object sender, EventArgs e)
{
using(OpenFileDialog dlg=new OpenFileDialog())
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=LANG.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LANG.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK)
{
Open(dlg.FileName);
}
......@@ -1037,15 +1067,15 @@ void Menuitem_openClick(object sender, EventArgs e)
}
void Menuitem_newClick(object sender, EventArgs e)
{
using(SaveFileDialog dlg=new SaveFileDialog())
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=LANG.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LANG.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK)
{
if(DataBase.Create(dlg.FileName))
if (DataBase.Create(dlg.FileName))
{
if(MyMsg.Question(LMSG.IfOpenDataBase))
if (MyMsg.Question(LMSG.IfOpenDataBase))
Open(dlg.FileName);
}
}
......@@ -1054,13 +1084,13 @@ void Menuitem_newClick(object sender, EventArgs e)
void Menuitem_readydkClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
using(OpenFileDialog dlg=new OpenFileDialog())
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.SelectYdkPath);
dlg.Filter=LANG.GetMsg(LMSG.ydkType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.SelectYdkPath);
dlg.Filter = LANG.GetMsg(LMSG.ydkType);
if (dlg.ShowDialog() == DialogResult.OK)
{
tmpCodes.Clear();
string[] ids = YGOUtil.ReadYDK(dlg.FileName);
......@@ -1073,12 +1103,12 @@ void Menuitem_readydkClick(object sender, EventArgs e)
void Menuitem_readimagesClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
using(FolderBrowserDialog fdlg=new FolderBrowserDialog())
using (FolderBrowserDialog fdlg = new FolderBrowserDialog())
{
fdlg.Description= LANG.GetMsg(LMSG.SelectImagePath);
if(fdlg.ShowDialog()==DialogResult.OK)
fdlg.Description = LANG.GetMsg(LMSG.SelectImagePath);
if (fdlg.ShowDialog() == DialogResult.OK)
{
tmpCodes.Clear();
string[] ids = YGOUtil.ReadImage(fdlg.SelectedPath);
......@@ -1096,19 +1126,22 @@ void Menuitem_quitClick(object sender, EventArgs e)
#endregion
#region 线程
bool isRun(){
if(tasker !=null && tasker.IsRuning()){
bool isRun()
{
if (tasker != null && tasker.IsRuning())
{
MyMsg.Warning(LMSG.RunError);
return true;
}
return false;
}
void Run(string name){
if(isRun())
void Run(string name)
{
if (isRun())
return;
taskname=name;
title=title+" ("+taskname+")";
taskname = name;
title = title + " (" + taskname + ")";
SetTitle();
bgWorker1.RunWorkerAsync();
}
......@@ -1119,7 +1152,7 @@ void BgWorker1DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
}
void BgWorker1ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
title=string.Format("{0} ({1}-{2})",
title = string.Format("{0} ({1}-{2})",
RemoveTag(title),
taskname,
// e.ProgressPercentage,
......@@ -1130,23 +1163,26 @@ void BgWorker1ProgressChanged(object sender, System.ComponentModel.ProgressChang
void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
//
int t=title.LastIndexOf(" (");
if(t>0)
int t = title.LastIndexOf(" (");
if (t > 0)
{
title=title.Substring(0,t);
title = title.Substring(0, t);
SetTitle();
}
if ( e.Error != null){
if (e.Error != null)
{
MyMsg.Show(LANG.GetMsg(LMSG.TaskError)+"\n"+e.Error);
MyMsg.Show(LANG.GetMsg(LMSG.TaskError) + "\n" + e.Error);
}
else if(tasker.IsCancel() || e.Cancelled){
else if (tasker.IsCancel() || e.Cancelled)
{
MyMsg.Show(LMSG.CancelTask);
}
else
{
MyTask mt=tasker.getLastTask();
switch(mt){
MyTask mt = tasker.getLastTask();
switch (mt)
{
case MyTask.CheckUpdate:
break;
case MyTask.ExportData:
......@@ -1169,105 +1205,107 @@ void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerC
#region setcode
void Cb_setname2SelectedIndexChanged(object sender, EventArgs e)
{
if(setcodeIsedit[2])
if (setcodeIsedit[2])
return;
setcodeIsedit[2]=true;
tb_setcode2.Text=GetSelectHex(datacfg.dicSetnames, cb_setname2);
setcodeIsedit[2]=false;
setcodeIsedit[2] = true;
tb_setcode2.Text = GetSelectHex(datacfg.dicSetnames, cb_setname2);
setcodeIsedit[2] = false;
}
void Cb_setname1SelectedIndexChanged(object sender, EventArgs e)
{
if(setcodeIsedit[1])
if (setcodeIsedit[1])
return;
setcodeIsedit[1]=true;
tb_setcode1.Text=GetSelectHex(datacfg.dicSetnames, cb_setname1);
setcodeIsedit[1]=false;
setcodeIsedit[1] = true;
tb_setcode1.Text = GetSelectHex(datacfg.dicSetnames, cb_setname1);
setcodeIsedit[1] = false;
}
void Cb_setname3SelectedIndexChanged(object sender, EventArgs e)
{
if(setcodeIsedit[3])
if (setcodeIsedit[3])
return;
setcodeIsedit[3]=true;
tb_setcode3.Text=GetSelectHex(datacfg.dicSetnames, cb_setname3);
setcodeIsedit[3]=false;
setcodeIsedit[3] = true;
tb_setcode3.Text = GetSelectHex(datacfg.dicSetnames, cb_setname3);
setcodeIsedit[3] = false;
}
void Cb_setname4SelectedIndexChanged(object sender, EventArgs e)
{
if(setcodeIsedit[4])
if (setcodeIsedit[4])
return;
setcodeIsedit[4]=true;
tb_setcode4.Text=GetSelectHex(datacfg.dicSetnames, cb_setname4);
setcodeIsedit[4]=false;
setcodeIsedit[4] = true;
tb_setcode4.Text = GetSelectHex(datacfg.dicSetnames, cb_setname4);
setcodeIsedit[4] = false;
}
void Tb_setcode4TextChanged(object sender, EventArgs e)
{
if(setcodeIsedit[4])
if (setcodeIsedit[4])
return;
setcodeIsedit[4]=true;
setcodeIsedit[4] = true;
long temp;
long.TryParse(tb_setcode4.Text,NumberStyles.HexNumber, null ,out temp);
long.TryParse(tb_setcode4.Text, NumberStyles.HexNumber, null, out temp);
SetSelect(datacfg.dicSetnames, cb_setname4, temp);
setcodeIsedit[4]=false;
setcodeIsedit[4] = false;
}
void Tb_setcode3TextChanged(object sender, EventArgs e)
{
if(setcodeIsedit[3])
if (setcodeIsedit[3])
return;
setcodeIsedit[3]=true;
setcodeIsedit[3] = true;
long temp;
long.TryParse(tb_setcode3.Text,NumberStyles.HexNumber, null ,out temp);
long.TryParse(tb_setcode3.Text, NumberStyles.HexNumber, null, out temp);
SetSelect(datacfg.dicSetnames, cb_setname3, temp);
setcodeIsedit[3]=false;
setcodeIsedit[3] = false;
}
void Tb_setcode2TextChanged(object sender, EventArgs e)
{
if(setcodeIsedit[2])
if (setcodeIsedit[2])
return;
setcodeIsedit[2]=true;
setcodeIsedit[2] = true;
long temp;
long.TryParse(tb_setcode2.Text,NumberStyles.HexNumber, null ,out temp);
long.TryParse(tb_setcode2.Text, NumberStyles.HexNumber, null, out temp);
SetSelect(datacfg.dicSetnames, cb_setname2, temp);
setcodeIsedit[2]=false;
setcodeIsedit[2] = false;
}
void Tb_setcode1TextChanged(object sender, EventArgs e)
{
if(setcodeIsedit[1])
if (setcodeIsedit[1])
return;
setcodeIsedit[1]=true;
setcodeIsedit[1] = true;
long temp;
long.TryParse(tb_setcode1.Text,NumberStyles.HexNumber, null ,out temp);
long.TryParse(tb_setcode1.Text, NumberStyles.HexNumber, null, out temp);
SetSelect(datacfg.dicSetnames, cb_setname1, temp);
setcodeIsedit[1]=false;
setcodeIsedit[1] = false;
}
#endregion
#region 复制卡片
public Card[] getCardList(bool onlyselect){
if(!Check())
public Card[] getCardList(bool onlyselect)
{
if (!Check())
return null;
List<Card> cards=new List<Card>();
if(onlyselect)
List<Card> cards = new List<Card>();
if (onlyselect)
{
#if DEBUG
#if DEBUG
MessageBox.Show("select");
#endif
foreach(ListViewItem lvitem in lv_cardlist.SelectedItems)
#endif
foreach (ListViewItem lvitem in lv_cardlist.SelectedItems)
{
int index=lvitem.Index+(page-1)*MaxRow;
if(index<cardlist.Count)
int index = lvitem.Index + (page - 1) * MaxRow;
if (index < cardlist.Count)
cards.Add(cardlist[index]);
}
}
else
cards.AddRange(cardlist.ToArray());
if(cards.Count==0){
if (cards.Count == 0)
{
MyMsg.Show(LMSG.NoSelectCard);
return null;
}
......@@ -1284,33 +1322,34 @@ void Menuitem_copyselecttoClick(object sender, EventArgs e)
}
public void SaveCards(Card[] cards)
{
if(!Check())
if (!Check())
return;
bool replace=MyMsg.Question(LMSG.IfReplaceExistingCard);
bool replace = MyMsg.Question(LMSG.IfReplaceExistingCard);
DataBase.CopyDB(nowCdbFile, !replace, cards);
Search(srcCard, true);
}
void CopyTo(bool onlyselect)
{
if(!Check())
if (!Check())
return;
Card[] cards=getCardList(onlyselect);
if(cards==null)
Card[] cards = getCardList(onlyselect);
if (cards == null)
return;
//select file
bool replace=false;
string filename=null;
using(OpenFileDialog dlg=new OpenFileDialog())
bool replace = false;
string filename = null;
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter=LANG.GetMsg(LMSG.CdbType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LANG.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK)
{
filename=dlg.FileName;
replace=MyMsg.Question(LMSG.IfReplaceExistingCard);
filename = dlg.FileName;
replace = MyMsg.Question(LMSG.IfReplaceExistingCard);
}
}
if(!string.IsNullOrEmpty(filename)){
if (!string.IsNullOrEmpty(filename))
{
DataBase.CopyDB(filename, !replace, cards);
MyMsg.Show(LMSG.CopyCardsToDBIsOK);
}
......@@ -1321,11 +1360,11 @@ void CopyTo(bool onlyselect)
#region MSE存档
void Menuitem_cutimagesClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
if(isRun())
if (isRun())
return;
bool isreplace=MyMsg.Question(LMSG.IfReplaceExistingImage);
bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage);
tasker.SetTask(MyTask.CutImages, cardlist.ToArray(),
PICPATH, isreplace.ToString());
Run(LANG.GetMsg(LMSG.CutImage));
......@@ -1339,27 +1378,28 @@ void Menuitem_saveasmseClick(object sender, EventArgs e)
{
SaveAsMSE(false);
}
void SaveAsMSE(bool onlyselect){
if(!Check())
void SaveAsMSE(bool onlyselect)
{
if (!Check())
return;
if(isRun())
if (isRun())
return;
Card[] cards=getCardList(onlyselect);
if(cards==null)
Card[] cards = getCardList(onlyselect);
if (cards == null)
return;
//select save mse-set
using(SaveFileDialog dlg=new SaveFileDialog())
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.selectMseset);
dlg.Filter=LANG.GetMsg(LMSG.MseType);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Title = LANG.GetMsg(LMSG.selectMseset);
dlg.Filter = LANG.GetMsg(LMSG.MseType);
if (dlg.ShowDialog() == DialogResult.OK)
{
bool isUpdate=false;
#if DEBUG
bool isUpdate = false;
#if DEBUG
isUpdate=MyMsg.Question(LMSG.OnlySet);
#endif
tasker.SetTask(MyTask.SaveAsMSE,cards,
dlg.FileName,isUpdate.ToString());
#endif
tasker.SetTask(MyTask.SaveAsMSE, cards,
dlg.FileName, isUpdate.ToString());
Run(LANG.GetMsg(LMSG.SaveMse));
}
}
......@@ -1369,11 +1409,11 @@ void Menuitem_saveasmseClick(object sender, EventArgs e)
#region 导入卡图
void Pl_imageDragDrop(object sender, DragEventArgs e)
{
string[] files=e.Data.GetData(DataFormats.FileDrop) as string[];
#if DEBUG
string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];
#if DEBUG
MessageBox.Show(files[0]);
#endif
if(File.Exists(files[0]))
#endif
if (File.Exists(files[0]))
ImportImage(files[0], tb_cardcode.Text);
}
......@@ -1386,11 +1426,11 @@ void Pl_imageDragEnter(object sender, DragEventArgs e)
}
void Menuitem_importmseimgClick(object sender, EventArgs e)
{
string tid=tb_cardcode.Text;
menuitem_importmseimg.Checked=!menuitem_importmseimg.Checked;
string tid = tb_cardcode.Text;
menuitem_importmseimg.Checked = !menuitem_importmseimg.Checked;
setImage(tid);
}
void ImportImage(string file,string tid)
void ImportImage(string file, string tid)
{
string f;
if (pl_image.BackgroundImage != null
......@@ -1399,16 +1439,18 @@ void ImportImage(string file,string tid)
pl_image.BackgroundImage.Dispose();
pl_image.BackgroundImage = m_cover;
}
if(menuitem_importmseimg.Checked){
if(!Directory.Exists(tasker.MSEImage))
if (menuitem_importmseimg.Checked)
{
if (!Directory.Exists(tasker.MSEImage))
Directory.CreateDirectory(tasker.MSEImage);
f=MyPath.Combine(tasker.MSEImage, tid+".jpg");
f = MyPath.Combine(tasker.MSEImage, tid + ".jpg");
File.Copy(file, f, true);
}
else{
f=MyPath.Combine(PICPATH,tid+".jpg");
tasker.ToImg(file,f,
MyPath.Combine(PICPATH2,tid+".jpg"));
else
{
f = MyPath.Combine(PICPATH, tid + ".jpg");
tasker.ToImg(file, f,
MyPath.Combine(PICPATH2, tid + ".jpg"));
}
setImage(tid);
}
......@@ -1418,50 +1460,52 @@ void setImage(string id)
long.TryParse(id, out t);
setImage(t);
}
void setImage(long id){
if(pl_image.BackgroundImage != null
&& pl_image.BackgroundImage!=m_cover)
void setImage(long id)
{
if (pl_image.BackgroundImage != null
&& pl_image.BackgroundImage != m_cover)
pl_image.BackgroundImage.Dispose();
Bitmap temp;
string pic=MyPath.Combine(PICPATH, id+".jpg");
string pic2=MyPath.Combine(tasker.MSEImage, id+".jpg");
string pic3=MyPath.Combine(tasker.MSEImage, new Card(id).idString+".jpg");
if(menuitem_importmseimg.Checked && File.Exists(pic2))
string pic = MyPath.Combine(PICPATH, id + ".jpg");
string pic2 = MyPath.Combine(tasker.MSEImage, id + ".jpg");
string pic3 = MyPath.Combine(tasker.MSEImage, new Card(id).idString + ".jpg");
if (menuitem_importmseimg.Checked && File.Exists(pic2))
{
temp=new Bitmap(pic2);
pl_image.BackgroundImage=temp;
temp = new Bitmap(pic2);
pl_image.BackgroundImage = temp;
}
else if(menuitem_importmseimg.Checked && File.Exists(pic3))
else if (menuitem_importmseimg.Checked && File.Exists(pic3))
{
temp=new Bitmap(pic3);
pl_image.BackgroundImage=temp;
temp = new Bitmap(pic3);
pl_image.BackgroundImage = temp;
}
else if(File.Exists(pic)){
temp=new Bitmap(pic);
pl_image.BackgroundImage=temp;
else if (File.Exists(pic))
{
temp = new Bitmap(pic);
pl_image.BackgroundImage = temp;
}
else
pl_image.BackgroundImage=m_cover;
pl_image.BackgroundImage = m_cover;
}
void Menuitem_compdbClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
DataBase.Compression(nowCdbFile);
MyMsg.Show(LMSG.CompDBOK);
}
void Menuitem_convertimageClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
if(isRun())
if (isRun())
return;
using(FolderBrowserDialog fdlg=new FolderBrowserDialog())
using (FolderBrowserDialog fdlg = new FolderBrowserDialog())
{
fdlg.Description= LANG.GetMsg(LMSG.SelectImagePath);
if(fdlg.ShowDialog()==DialogResult.OK)
fdlg.Description = LANG.GetMsg(LMSG.SelectImagePath);
if (fdlg.ShowDialog() == DialogResult.OK)
{
bool isreplace=MyMsg.Question(LMSG.IfReplaceExistingImage);
bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage);
tasker.SetTask(MyTask.ConvertImages, null,
fdlg.SelectedPath, GAMEPATH, isreplace.ToString());
Run(LANG.GetMsg(LMSG.ConvertImage));
......@@ -1473,14 +1517,14 @@ void Menuitem_convertimageClick(object sender, EventArgs e)
#region 导出数据包
void Menuitem_exportdataClick(object sender, EventArgs e)
{
if(!Check())
if (!Check())
return;
if(isRun())
if (isRun())
return;
using(SaveFileDialog dlg=new SaveFileDialog())
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Filter="Zip|(*.zip|All Files(*.*)|*.*";
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Filter = "Zip|(*.zip|All Files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
tasker.SetTask(MyTask.ExportData, getCardList(false), dlg.FileName);
Run(LANG.GetMsg(LMSG.ExportData));
......@@ -1497,14 +1541,14 @@ void Menuitem_exportdataClick(object sender, EventArgs e)
/// <param name="cards"></param>
/// <param name="card"></param>
/// <returns></returns>
bool CheckCard(Card[] cards,Card card,bool checkinfo)
bool CheckCard(Card[] cards, Card card, bool checkinfo)
{
foreach(Card c in cards)
foreach (Card c in cards)
{
if(c.id!=card.id)
if (c.id != card.id)
continue;
//data数据不一样
if(checkinfo)
if (checkinfo)
return card.EqualsData(c);
else
return true;
......@@ -1519,15 +1563,15 @@ Card[] getCompCards()
return null;
return DataBase.Read(nowCdbFile, true, tmpCodes.ToArray());
}
public void CompareCards(string cdbfile,bool checktext)
public void CompareCards(string cdbfile, bool checktext)
{
if(!Check())
if (!Check())
return;
tmpCodes.Clear();
srcCard=new Card();
Card[] mcards=DataBase.Read(nowCdbFile,true,"");
Card[] cards=DataBase.Read(cdbfile,true,"");
foreach(Card card in mcards)
srcCard = new Card();
Card[] mcards = DataBase.Read(nowCdbFile, true, "");
Card[] cards = DataBase.Read(cdbfile, true, "");
foreach (Card card in mcards)
{
if (!CheckCard(cards, card, checktext))
tmpCodes.Add(card.id.ToString());
......
......@@ -48,7 +48,7 @@
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SQLite">
<HintPath>DLL\System.Data.SQLite.dll</HintPath>
......@@ -68,20 +68,21 @@
<DependentUpon>CodeEditForm.cs</DependentUpon>
</Compile>
<Compile Include="Common\CheckUpdate.cs" />
<Compile Include="Common\CodeEdit.cs">
<Compile Include="Controls\DoubleContorl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Common\DoubleContorl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Common\FastColoredTextBoxEx.cs">
<Compile Include="Controls\FastColoredTextBoxEx.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Common\MyPath.cs" />
<Compile Include="Common\MySyntaxHighlighter.cs" />
<Compile Include="Controls\History.cs" />
<Compile Include="Controls\IEditForm.cs" />
<Compile Include="Controls\MySyntaxHighlighter.cs" />
<Compile Include="Common\MyBitmap.cs" />
<Compile Include="Common\User32.cs" />
<Compile Include="Common\ZipStorer.cs" />
<Compile Include="Common\Area.cs" />
<Compile Include="Config\Config.cs" />
<Compile Include="Core\Card.cs" />
<Compile Include="Core\CardAttribute.cs" />
<Compile Include="Core\CardRace.cs" />
......@@ -213,13 +214,7 @@
<None Include="chinese\cover.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\language-codeeditor.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\language-dataeditor.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\language-mainform.txt">
<None Include="chinese\language.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="chinese\message.txt">
......@@ -343,5 +338,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -19,244 +19,226 @@ namespace DataEditorX.Language
/// </summary>
public static class LANG
{
static Dictionary<string, SortedList<string, string>> wordslist;
static SortedList<LMSG, string> msglist;
static string SEP="->";
static SortedList<string, string> mWordslist = new SortedList<string, string>();
static SortedList<LMSG, string> msglist = new SortedList<LMSG, string>();
static string SEP_CONTROL = ".";
static string SEP_LINE = " ";
static LANG()
{
wordslist=new Dictionary<string, SortedList<string, string>>();
msglist=new SortedList<LMSG, string>();
}
public static void InitForm(Form fm, string langfile)
{
if(!wordslist.ContainsKey(fm.Name))
{
wordslist.Add(fm.Name, LoadLanguage(langfile));
}
}
/// <summary>
/// 获取消息文字
/// </summary>
/// <param name="lMsg"></param>
/// <returns></returns>
#region 获取消息文字
public static string GetMsg(LMSG lMsg)
{
if(msglist.IndexOfKey(lMsg)>=0)
if (msglist.IndexOfKey(lMsg) >= 0)
return msglist[lMsg];
return lMsg.ToString();
else
return lMsg.ToString().Replace("_", " ");
}
#endregion
#region 设置控件信息
/// <summary>
/// 设置控件文字
/// </summary>
/// <param name="fm"></param>
public static bool SetLanguage(Form fm)
{
if(wordslist.ContainsKey(fm.Name))
public static void SetFormLabel(Form fm)
{
SortedList<string, string> list=wordslist[fm.Name];
if (fm == null)
return;
// fm.SuspendLayout();
fm.ResumeLayout(true);
SetText(fm, list);
SetControlLabel(fm, "", fm.Name);
fm.ResumeLayout(false);
//fm.PerformLayout();
}
static bool GetLabel(string key, out string title)
{
string v;
if (mWordslist.TryGetValue(key, out v))
{
title = v;
return true;
}
title = null;
return false;
}
static void SetText(Control c, SortedList<string, string> list)
static void SetControlLabel(Control c, string pName, string formName)
{
if ( c is ListView )
if (!string.IsNullOrEmpty(pName))
pName += SEP_CONTROL;
pName += c.Name;
string title;
if (c is ListView)
{
ListView lv = (ListView)c;
int i,count=lv.Columns.Count;
for(i=0;i<count;i++)
int i, count = lv.Columns.Count;
for (i = 0; i < count; i++)
{
ColumnHeader cn=lv.Columns[i];
string v;
list.TryGetValue(lv.Name+i.ToString(), out v);
if(!string.IsNullOrEmpty(v))
cn.Text = v;
ColumnHeader ch = lv.Columns[i];
if (GetLabel(pName + SEP_CONTROL + i.ToString(), out title))
ch.Text = title;
}
}
else if ( c is ToolStrip)
else if (c is ToolStrip)
{
ToolStrip ms = (ToolStrip)c;
foreach ( ToolStripItem tsi in ms.Items )
foreach (ToolStripItem tsi in ms.Items)
{
SetMenuItem(tsi, list);
SetMenuItem(formName, tsi);
}
}
else
{
string v;
list.TryGetValue(c.Name, out v);
if(!string.IsNullOrEmpty(v))
c.Text = v;
if (GetLabel(pName, out title))
c.Text = title;
}
if ( c.Controls.Count > 0 )
if (c.Controls.Count > 0)
{
foreach ( Control sc in c.Controls )
foreach (Control sc in c.Controls)
{
SetText(sc, list);
SetControlLabel(sc, pName, formName);
}
}
ContextMenuStrip conms=c.ContextMenuStrip;
if ( conms!=null )
ContextMenuStrip conms = c.ContextMenuStrip;
if (conms != null)
{
foreach ( ToolStripItem ts in conms.Items )
foreach (ToolStripItem ts in conms.Items)
{
SetMenuItem(ts, list);
SetMenuItem(formName, ts);
}
}
}
static void SetMenuItem(ToolStripItem tsi, SortedList<string, string> list)
static void SetMenuItem(string pName, ToolStripItem tsi)
{
if ( tsi is ToolStripMenuItem )
string tName = pName + SEP_CONTROL + tsi.Name;
string title;
if (tsi is ToolStripMenuItem)
{
ToolStripMenuItem tsmi = (ToolStripMenuItem)tsi;
string v;
list.TryGetValue(tsmi.Name, out v);
if(!string.IsNullOrEmpty(v))
tsmi.Text = v;
if(tsmi.HasDropDownItems)
{
foreach ( ToolStripItem subtsi in tsmi.DropDownItems )
if (GetLabel(tName, out title))
tsmi.Text = title;
if (tsmi.HasDropDownItems)
{
if ( subtsi is ToolStripMenuItem )
foreach (ToolStripItem subtsi in tsmi.DropDownItems)
{
ToolStripMenuItem ts2 = (ToolStripMenuItem)subtsi;
SetMenuItem(ts2, list);
}
SetMenuItem(tName, subtsi);
}
}
}
else if ( tsi is ToolStripLabel )
else if (tsi is ToolStripLabel)
{
ToolStripLabel tlbl=(ToolStripLabel)tsi;
string v;
list.TryGetValue(tlbl.Name, out v);
if(!string.IsNullOrEmpty(v))
tlbl.Text = v;
ToolStripLabel tlbl = (ToolStripLabel)tsi;
if (GetLabel(tName, out title))
tlbl.Text = title;
}
}
#endregion
#region 获取控件信息
/// <summary>
/// 获取控件名
/// </summary>
/// <param name="fm"></param>
public static void GetLanguage(Form fm)
public static void GetFormLabel(Form fm)
{
SortedList<string, string> list=new SortedList<string, string>();
GetText(fm, list);
if(wordslist.ContainsKey(fm.Name))
wordslist[fm.Name]=list;
else
wordslist.Add(fm.Name, list);
if (fm == null)
return;
// fm.SuspendLayout();
//fm.ResumeLayout(true);
GetControlLabel(fm, "", fm.Name);
//fm.ResumeLayout(false);
//fm.PerformLayout();
}
static void GetText(Control c, SortedList<string, string> list)
static void AddLabel(string key, string title)
{
if (!mWordslist.ContainsKey(key))
mWordslist.Add(key, title);
}
static void GetControlLabel(Control c, string pName,
string formName)
{
if ( c is ListView )
if (!string.IsNullOrEmpty(pName))
pName += SEP_CONTROL;
if (string.IsNullOrEmpty(c.Name))
return;
pName += c.Name;
if (c is ListView)
{
ListView lv = (ListView)c;
int i,count=lv.Columns.Count;
for(i=0;i<count;i++)
int i, count = lv.Columns.Count;
for (i = 0; i < count; i++)
{
ColumnHeader cn=lv.Columns[i];
if ( list.ContainsKey(lv.Name+i.ToString()) )
list[cn.Name]=cn.Text;
else
list.Add(lv.Name+i.ToString(), cn.Text);
AddLabel(pName + SEP_CONTROL + i.ToString(),
lv.Columns[i].Text);
}
}
else if ( c is ToolStrip)
else if (c is ToolStrip)
{
ToolStrip ms = (ToolStrip)c;
foreach ( ToolStripItem tsi in ms.Items )
foreach (ToolStripItem tsi in ms.Items)
{
GetMenuItem(tsi, list);
GetMenuItem(formName, tsi);
}
}
else
{
if(list.ContainsKey(c.Name))
list[c.Name]=c.Text;
else
list.Add(c.Name, c.Text);
AddLabel(pName, c.Text);
}
if ( c.Controls.Count > 0 )
if (c.Controls.Count > 0)
{
foreach ( Control sc in c.Controls )
foreach (Control sc in c.Controls)
{
GetText(sc, list);
GetControlLabel(sc, pName, formName);
}
}
ContextMenuStrip conms=c.ContextMenuStrip;
if ( conms!=null )
ContextMenuStrip conms = c.ContextMenuStrip;
if (conms != null)
{
foreach ( ToolStripItem ts in conms.Items )
foreach (ToolStripItem ts in conms.Items)
{
GetMenuItem(ts, list);
GetMenuItem(formName, ts);
}
}
}
static void GetMenuItem(ToolStripItem tsi, SortedList<string, string> list)
static void GetMenuItem(string pName, ToolStripItem tsi)
{
if ( tsi is ToolStripMenuItem )
string tName = pName + SEP_CONTROL + tsi.Name;
if (string.IsNullOrEmpty(tsi.Name))
return;
if (tsi is ToolStripMenuItem)
{
ToolStripMenuItem tsmi = (ToolStripMenuItem)tsi;
if(list.ContainsKey(tsmi.Name))
list[tsi.Name] = tsmi.Text;
else
list.Add(tsi.Name, tsmi.Text);
if(tsmi.HasDropDownItems)
AddLabel(tName, tsmi.Text);
if (tsmi.HasDropDownItems)
{
foreach ( ToolStripItem subtsi in tsmi.DropDownItems )
foreach (ToolStripItem subtsi in tsmi.DropDownItems)
{
if ( subtsi is ToolStripMenuItem )
{
ToolStripMenuItem ts2 = (ToolStripMenuItem)subtsi;
GetMenuItem(ts2, list);
}
GetMenuItem(tName, subtsi);
}
}
}
else if ( tsi is ToolStripLabel )
else if (tsi is ToolStripLabel)
{
ToolStripLabel tlbl=(ToolStripLabel)tsi;
if(list.ContainsKey(tlbl.Name))
list[tlbl.Name] = tlbl.Text;
else
list.Add(tlbl.Name, tlbl.Text);
ToolStripLabel tlbl = (ToolStripLabel)tsi;
AddLabel(tName, tlbl.Text);
}
}
#endregion
#region 保存语言文件
public static bool SaveLanguage(Form fm, string f)
public static bool SaveLanguage(string conf)
{
if(!wordslist.ContainsKey(fm.Name))
return false;
SortedList<string, string> fmlist=wordslist[fm.Name];
using(FileStream fs=new FileStream(f, FileMode.Create, FileAccess.Write))
using (FileStream fs = new FileStream(conf, FileMode.Create, FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs, Encoding.UTF8);
foreach(string k in fmlist.Keys)
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
foreach (string k in mWordslist.Keys)
{
sw.WriteLine(fm.Name+SEP+k+" "+fmlist[k]);
sw.WriteLine(k + SEP_LINE + mWordslist[k]);
}
sw.Close();
fs.Close();
......@@ -266,17 +248,17 @@ public static bool SaveLanguage(Form fm, string f)
public static bool SaveMessage(string f)
{
using(FileStream fs=new FileStream(f, FileMode.Create, FileAccess.Write))
using (FileStream fs = new FileStream(f, FileMode.Create, FileAccess.Write))
{
StreamWriter sw=new StreamWriter(fs, Encoding.UTF8);
foreach(LMSG k in msglist.Keys)
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
foreach (LMSG k in msglist.Keys)
{
sw.WriteLine("0x"+((uint)k).ToString("x")+"\t"+msglist[k].Replace("\n","/n"));
sw.WriteLine("0x" + ((uint)k).ToString("x") + "\t" + msglist[k].Replace("\n", "/n"));
}
foreach ( LMSG k in Enum.GetValues(typeof(LMSG)))
foreach (LMSG k in Enum.GetValues(typeof(LMSG)))
{
if(!msglist.ContainsKey(k))
sw.WriteLine("0x"+((uint)k).ToString("x")+"\t"+k.ToString());
if (!msglist.ContainsKey(k))
sw.WriteLine("0x" + ((uint)k).ToString("x") + "\t" + k.ToString());
}
sw.Close();
fs.Close();
......@@ -286,66 +268,63 @@ public static bool SaveMessage(string f)
#endregion
#region 加载语言文件
public static SortedList<string, string> LoadLanguage(string f)
public static void LoadFormLabels(string f)
{
SortedList<string, string> list=new SortedList<string, string>();
if(File.Exists(f))
if (!File.Exists(f))
return;
mWordslist.Clear();
using (FileStream fs = new FileStream(f, FileMode.Open, FileAccess.Read))
{
using(FileStream fs=new FileStream(f, FileMode.Open, FileAccess.Read))
StreamReader sr = new StreamReader(fs, Encoding.UTF8);
string line, sk, v;
while ((line = sr.ReadLine()) != null)
{
StreamReader sr=new StreamReader(fs, Encoding.UTF8);
string line,sk,v;
while((line=sr.ReadLine())!=null)
if (!line.StartsWith("#")&&line.Length>0)
{
if(!line.StartsWith("#"))
int si = line.IndexOf(SEP_LINE);
if (si > 0)
{
int ss=line.IndexOf(SEP);
int si=(ss>0)?line.IndexOf(" "):-1;
if(si>0)
{
sk=line.Substring(ss+SEP.Length,si-ss-SEP.Length);
v=line.Substring(si+1);
sk = line.Substring(0, si);
v = line.Substring(si + 1);
if(!list.ContainsKey(sk))
list.Add(sk,v);
if (!mWordslist.ContainsKey(sk))
mWordslist.Add(sk, v);
}
}
}
sr.Close();
fs.Close();
}
}
return list;
}
}
public static void LoadMessage(string f)
{
if(File.Exists(f))
{
if (!File.Exists(f))
return;
msglist.Clear();
using(FileStream fs=new FileStream(f, FileMode.Open, FileAccess.Read))
using (FileStream fs = new FileStream(f, FileMode.Open, FileAccess.Read))
{
StreamReader sr=new StreamReader(fs, Encoding.UTF8);
string line,sk,v;
StreamReader sr = new StreamReader(fs, Encoding.UTF8);
string line, sk, v;
uint utemp;
LMSG ltemp;
while((line=sr.ReadLine())!=null)
while ((line = sr.ReadLine()) != null)
{
if(!line.StartsWith("#"))
if (!line.StartsWith("#"))
{
int si=line.IndexOf("\t");
if(si>0)
int si = line.IndexOf("\t");
if (si > 0)
{
sk=line.Substring(0,si);
v=line.Substring(si+1);
if(sk.StartsWith("0x"))
uint.TryParse(sk.Replace("0x",""), NumberStyles.HexNumber, null, out utemp);
sk = line.Substring(0, si);
v = line.Substring(si + 1);
if (sk.StartsWith("0x"))
uint.TryParse(sk.Replace("0x", ""), NumberStyles.HexNumber, null, out utemp);
else
uint.TryParse(sk, out utemp);
ltemp=(LMSG)utemp;
if(msglist.IndexOfKey(ltemp)<0)
msglist.Add(ltemp, v.Replace("/n","\n"));
ltemp = (LMSG)utemp;
if (msglist.IndexOfKey(ltemp) < 0)
msglist.Add(ltemp, v.Replace("/n", "\n"));
}
}
}
......@@ -353,7 +332,6 @@ public static void LoadMessage(string f)
fs.Close();
}
}
}
#endregion
}
......
......@@ -16,217 +16,115 @@
using FastColoredTextBoxNS;
using DataEditorX.Language;
using DataEditorX.Core;
using DataEditorX.Config;
using System.Text;
using DataEditorX.Controls;
namespace DataEditorX
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
public partial class MainForm : Form, IMainForm
{
#region member
string cdbHistoryFile;
List<string> cdbhistory;
List<string> luahistory;
//历史
History history;
//数据目录
string datapath;
string conflang,conflang_de,conflang_ce,confmsg,conflang_pe;
DataEditForm compare1,compare2;
//语言配置
string conflang;
string confmsg;
//打开历史
string historyFile;
//数据库对比
DataEditForm compare1, compare2;
Card[] tCards;
//
DataConfig datacfg = null;
CodeConfig codecfg = null;
#endregion
#region init
public MainForm(string datapath, string file)
{
Init(datapath);
if(MainForm.isScript(file))
OpenScript(file);
else
Open(file);
}
public MainForm(string datapath)
{
Init(datapath);
}
void Init(string datapath)
#region 设置界面,消息语言
public void SetLanguage(string language)
{
//判断是否合法
if (string.IsNullOrEmpty(language))
return;
tCards = null;
cdbhistory = new List<string>();
luahistory = new List<string>();
this.datapath = datapath;
InitDataEditor();
InitCodeEditor();
this.datapath = MyPath.Combine(Application.StartupPath, language);
cdbHistoryFile =MyPath.Combine(datapath, "history.txt");
conflang = MyPath.Combine(datapath, "language-mainform.txt");
conflang_de = MyPath.Combine(datapath, "language-dataeditor.txt");
conflang_ce = MyPath.Combine(datapath, "language-codeeditor.txt");
conflang_pe = MyPath.Combine(datapath, "language-puzzleditor.txt");
confmsg = MyPath.Combine(datapath, "message.txt");
//文件路径
historyFile = MyPath.Combine(datapath, MyConfig.FILE_HISTORY);
conflang = MyPath.Combine(datapath, MyConfig.FILE_LANGUAGE);
confmsg = MyPath.Combine(datapath, MyConfig.FILE_MESSAGE);
//游戏数据
datacfg = new DataConfig(datapath);
datacfg.Init();
//
YGOUtil.SetConfig(datacfg);
//代码提示
codecfg = new CodeConfig(datapath);
codecfg.Init();
codecfg.SetNames(datacfg.dicSetnames);
codecfg.AddStrings();
InitializeComponent();
LANG.InitForm(this, conflang);
history = new History(this);
//加载多语言
LANG.LoadFormLabels(conflang);
LANG.LoadMessage(confmsg);
LANG.SetLanguage(this);
ReadHistory();
MenuHistory();
bgWorker1.RunWorkerAsync();
}
#endregion
#region const
public const int WM_OPEN=0x0401;
public const int WM_OPEN_SCRIPT=0x0402;
public const string TMPFILE="open.tmp";
public const int MAX_HISTORY=0x10;
public static bool isScript(string file)
{
if(file!=null && file.EndsWith("lua",StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
#endregion
#region History
void ReadHistory()
{
if(!File.Exists(cdbHistoryFile))
return;
string[] lines=File.ReadAllLines(cdbHistoryFile);
AddHistorys(lines);
}
void AddHistorys(string[] lines)
{
luahistory.Clear();
cdbhistory.Clear();
foreach (string line in lines)
{
if (string.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if (File.Exists(line))
{
if (MainForm.isScript(line))
{
if (luahistory.Count < MainForm.MAX_HISTORY
&& luahistory.IndexOf(line) < 0)
luahistory.Add(line);
}
else
{
if (cdbhistory.Count < MainForm.MAX_HISTORY
&& cdbhistory.IndexOf(line) < 0)
cdbhistory.Add(line);
}
}
}
}
void AddHistory(string file)
{
List<string> tmplist = new List<string>();
//添加到开始
tmplist.Add(file);
//添加旧记录
tmplist.AddRange(cdbhistory.ToArray());
tmplist.AddRange(luahistory.ToArray());
//
AddHistorys(tmplist.ToArray());
SaveHistory();
MenuHistory();
}
void SaveHistory()
{
string texts="# database history";
foreach(string str in cdbhistory)
LANG.SetFormLabel(this);
//设置所有窗口
DockContentCollection contents = dockPanel1.Contents;
foreach (DockContent dc in contents)
{
if(File.Exists(str))
texts += Environment.NewLine + str;
}
texts += Environment.NewLine + "# script history";
foreach (string str in luahistory)
if (dc is Form)
{
if (File.Exists(str))
texts += Environment.NewLine + str;
LANG.SetFormLabel((Form)dc);
}
File.Delete(cdbHistoryFile);
File.WriteAllText(cdbHistoryFile, texts);
}
void MenuHistory()
{
menuitem_history.DropDownItems.Clear();
menuitem_shistory.DropDownItems.Clear();
foreach(string str in cdbhistory)
{
ToolStripMenuItem tsmi=new ToolStripMenuItem(str);
tsmi.Click+=MenuHistoryItem_Click;
menuitem_history.DropDownItems.Add(tsmi);
//读取历史记录
history.ReadHistory(historyFile);
history.MenuHistory();
}
menuitem_history.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem tsmiclear=new ToolStripMenuItem(LANG.GetMsg(LMSG.ClearHistory));
tsmiclear.Click+=MenuHistoryClear_Click;
menuitem_history.DropDownItems.Add(tsmiclear);
#endregion
foreach (string str in luahistory)
#region 打开历史
public void CdbMenuClear()
{
ToolStripMenuItem tsmi = new ToolStripMenuItem(str);
tsmi.Click += MenuHistoryItem_Click;
menuitem_shistory.DropDownItems.Add(tsmi);
}
menuitem_shistory.DropDownItems.Add(new ToolStripSeparator());
ToolStripMenuItem tsmiclear2 = new ToolStripMenuItem(LANG.GetMsg(LMSG.ClearHistory));
tsmiclear2.Click += MenuHistoryClear2_Click;
menuitem_shistory.DropDownItems.Add(tsmiclear2);
menuitem_history.DropDownItems.Clear();
}
void MenuHistoryClear2_Click(object sender, EventArgs e)
public void LuaMenuClear()
{
luahistory.Clear();
MenuHistory();
SaveHistory();
menuitem_shistory.DropDownItems.Clear();
}
void MenuHistoryClear_Click(object sender, EventArgs e)
public void AddCdbMenu(ToolStripItem item)
{
cdbhistory.Clear();
MenuHistory();
SaveHistory();
menuitem_history.DropDownItems.Add(item);
}
void MenuHistoryItem_Click(object sender, EventArgs e)
{
ToolStripMenuItem tsmi=sender as ToolStripMenuItem;
if(tsmi!=null){
string file = tsmi.Text;
if (MainForm.isScript(file))
public void AddLuaMenu(ToolStripItem item)
{
OpenScript(file);
}
else
Open(file);
}
menuitem_shistory.DropDownItems.Add(item);
}
#endregion
#region message
#region 处理窗口消息
protected override void DefWndProc(ref System.Windows.Forms.Message m)
{
string file=null;
string file = null;
switch (m.Msg)
{
case MainForm.WM_OPEN://处理消息
file=Path.Combine(Application.StartupPath, MainForm.TMPFILE);
if(File.Exists(file)){
case MyConfig.WM_OPEN://处理消息
file = MyPath.Combine(Application.StartupPath, MyConfig.FILE_TEMP);
if (File.Exists(file))
{
this.Activate();
Open(File.ReadAllText(file));
File.Delete(file);
}
break;
case MainForm.WM_OPEN_SCRIPT:
file=Path.Combine(Application.StartupPath, MainForm.TMPFILE);
if(File.Exists(file)){
this.Activate();
OpenScript(File.ReadAllText(file));
File.Delete(file);
//File.Delete(file);
}
break;
default:
......@@ -236,290 +134,253 @@ protected override void DefWndProc(ref System.Windows.Forms.Message m)
}
#endregion
#region open
public void OpenScript(string file)
#region 打开文件
//打开脚本
void OpenScript(string file)
{
if(!string.IsNullOrEmpty(file) && File.Exists(file)){
AddHistory(file);
}
if (checkOpen(file))
return;
if (OpenInNull(file))
return;
CodeEditForm cf=new CodeEditForm();
LANG.InitForm(cf, conflang_ce);
LANG.SetLanguage(cf);
InitCodeEditor();
cf.SetCDBList(cdbhistory.ToArray());
CodeEditForm cf = new CodeEditForm();
LANG.SetFormLabel(cf);
cf.SetCDBList(history.GetcdbHistory());
cf.InitTooltip(codecfg.TooltipDic, codecfg.FunList, codecfg.ConList);
//cf.SetIMEMode(ImeMode.Inherit);
cf.Open(file);
cf.Show(dockPanel1, DockState.Document);
}
void InitCodeEditor()
{
if (codecfg == null)
{
codecfg = new CodeConfig(datapath);
codecfg.Init();
InitDataEditor();
codecfg.SetNames(datacfg.dicSetnames);
codecfg.AddStrings();
}
}
void InitDataEditor()
{
if (datacfg == null)
{
datacfg = new DataConfig(datapath);
datacfg.Init();
YGOUtil.SetConfig(datacfg);
}
}
public void Open(string file)
//打开数据库
void OpenDataBase(string file)
{
if (MainForm.isScript(file))
{
OpenScript(file);
return;
}
if(!string.IsNullOrEmpty(file) && File.Exists(file)){
AddHistory(file);
}
if(checkOpen(file))
return;
if(OpenInNull(file))
return;
DataEditForm def;
if(string.IsNullOrEmpty(file)|| !File.Exists(file))
def=new DataEditForm(datapath);
if (string.IsNullOrEmpty(file) || !File.Exists(file))
def = new DataEditForm(datapath);
else
def=new DataEditForm(datapath,file);
LANG.InitForm(def, conflang_de);
LANG.SetLanguage(def);
InitDataEditor();
def = new DataEditForm(datapath, file);
LANG.SetFormLabel(def);
def.InitGameData(datacfg);
def.Show(dockPanel1, DockState.Document);
}
bool checkOpen(string file)
{
DockContentCollection contents = dockPanel1.Contents;
foreach (DockContent dc in contents)
{
if (!MainForm.isScript(file))
{
DataEditForm df = dc as DataEditForm;
if (df != null && !df.IsDisposed)
//打开文件
public void Open(string file)
{
if (df.getNowCDB() == file)
if (string.IsNullOrEmpty(file) || !File.Exists(file))
{
df.Show();
return true;
}
}
return;
}
//添加历史
history.AddHistory(file);
//检查是否已经打开
if (FindEditForm(file, true))
return;
//检查可用的
if (FindEditForm(file, false))
return;
if (YGOUtil.isScript(file))
OpenScript(file);
else
{
CodeEditForm cf = dc as CodeEditForm;
if (cf != null && !cf.IsDisposed)
{
if (cf.NowFile == file)
{
cf.Show();
return true;
}
OpenDataBase(file);
}
}
}
return false;
}
bool OpenInNull(string file)
//检查是否打开
bool FindEditForm(string file, bool isOpen)
{
if(string.IsNullOrEmpty(file) || !File.Exists(file))
return false;
DockContentCollection contents = dockPanel1.Contents;
foreach (DockContent dc in contents)
{
if (!MainForm.isScript(file))
{
DataEditForm df = dc as DataEditForm;
if (df != null && !df.IsDisposed)
IEditForm edform = (IEditForm)dc;
if (edform == null)
continue;
if (isOpen)//是否检查打开
{
if (string.IsNullOrEmpty(df.getNowCDB()))
if (file != null && file.Equals(edform.GetOpenFile()))
{
df.Open(file);
df.Show();
edform.SetActived();
return true;
}
}
}
else
{
CodeEditForm cf = dc as CodeEditForm;
if (cf != null && !cf.IsDisposed)
else//检查空白
{
if (string.IsNullOrEmpty(cf.NowFile))
if (string.IsNullOrEmpty(edform.GetOpenFile()) && edform.CanOpen(file))
{
cf.Open(file);
cf.Show();
edform.Open(file);
edform.SetActived();
return true;
}
}
}
}
return false;
}
void DataEditorToolStripMenuItemClick(object sender, EventArgs e)
{
Open(null);
}
#endregion
#region form
#region 加载,关闭
void MainFormLoad(object sender, System.EventArgs e)
{
//
//检查更新
bgWorker1.RunWorkerAsync();
if (dockPanel1.Contents.Count == 0)
OpenDataBase(null);
}
void MainFormFormClosing(object sender, FormClosingEventArgs e)
{
#if DEBUG
LANG.SaveMessage(confmsg+".bak");
#endif
#if DEBUG
LANG.GetFormLabel(this);
DockContentCollection contents = dockPanel1.Contents;
foreach (DockContent dc in contents)
{
LANG.GetFormLabel(dc);
}
//获取窗体文字
LANG.SaveLanguage(conflang + ".bak");
LANG.SaveMessage(confmsg + ".bak");
#endif
}
#endregion
#region windows
#region 窗口管理
void CloseToolStripMenuItemClick(object sender, EventArgs e)
{
//关闭当前
dockPanel1.ActiveContent.DockHandler.Close();
}
//打开脚本编辑
void Menuitem_codeeditorClick(object sender, EventArgs e)
{
OpenScript(null);
}
//新建DataEditorX
void DataEditorToolStripMenuItemClick(object sender, EventArgs e)
{
OpenDataBase(null);
}
//关闭其他或者所有
void CloseMdi(bool isall)
{
DockContentCollection contents = dockPanel1.Contents;
int num = contents.Count-1;
try{
while (num >=0)
int num = contents.Count - 1;
try
{
while (num >= 0)
{
if (contents[num].DockHandler.DockState == DockState.Document)
{
if(isall)
if (isall)
contents[num].DockHandler.Close();
else if(dockPanel1.ActiveContent != contents[num])
else if (dockPanel1.ActiveContent != contents[num])
contents[num].DockHandler.Close();
}
num--;
}
}catch{}
}
catch { }
}
//关闭其他
void CloseOtherToolStripMenuItemClick(object sender, EventArgs e)
{
CloseMdi(false);
}
//关闭所有
void CloseAllToolStripMenuItemClick(object sender, EventArgs e)
{
CloseMdi(true);
}
#endregion
#region file
#region 文件菜单
//得到当前的数据编辑
DataEditForm GetActive()
{
DataEditForm df = dockPanel1.ActiveContent as DataEditForm;
return df;
}
//打开文件
void Menuitem_openClick(object sender, EventArgs e)
{
using(OpenFileDialog dlg=new OpenFileDialog())
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.OpenFile);
if(GetActive() !=null)
dlg.Filter=LANG.GetMsg(LMSG.CdbType);
dlg.Title = LANG.GetMsg(LMSG.OpenFile);
if (GetActive() != null)//判断当前窗口是不是DataEditor
dlg.Filter = LANG.GetMsg(LMSG.CdbType);
else
dlg.Filter=LANG.GetMsg(LMSG.ScriptFilter);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Filter = LANG.GetMsg(LMSG.ScriptFilter);
if (dlg.ShowDialog() == DialogResult.OK)
{
string file=dlg.FileName;
if(MainForm.isScript(file))
OpenScript(file);
else
string file = dlg.FileName;
Open(file);
}
}
}
//退出
void QuitToolStripMenuItemClick(object sender, EventArgs e)
{
this.Close();
}
//新建文件
void Menuitem_newClick(object sender, EventArgs e)
{
using(SaveFileDialog dlg=new SaveFileDialog())
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title=LANG.GetMsg(LMSG.NewFile);
if(GetActive() !=null)
dlg.Filter=LANG.GetMsg(LMSG.CdbType);
dlg.Title = LANG.GetMsg(LMSG.NewFile);
if (GetActive() != null)//判断当前窗口是不是DataEditor
dlg.Filter = LANG.GetMsg(LMSG.CdbType);
else
dlg.Filter=LANG.GetMsg(LMSG.ScriptFilter);
if(dlg.ShowDialog()==DialogResult.OK)
dlg.Filter = LANG.GetMsg(LMSG.ScriptFilter);
if (dlg.ShowDialog() == DialogResult.OK)
{
string file=dlg.FileName;
if(MainForm.isScript(file)){
string file = dlg.FileName;
File.Delete(file);
OpenScript(file);
}
else
if (YGOUtil.isDataBase(file))
{
if(DataBase.Create(file))
if (DataBase.Create(file))
{
if(MyMsg.Question(LMSG.IfOpenDataBase))
if (MyMsg.Question(LMSG.IfOpenDataBase))
Open(file);
}
}
else
{
File.Delete(file);
Open(file);
}
}
}
}
//保存文件
void Menuitem_saveClick(object sender, EventArgs e)
{
CodeEditForm cf= dockPanel1.ActiveContent as CodeEditForm;
if(cf!=null)
IEditForm cf = dockPanel1.ActiveContent as IEditForm;
if (cf != null)
{
if(cf.Save())
if (cf.Save())
MyMsg.Show(LMSG.SaveFileOK);
}
}
#endregion
#region copy
#region 卡片复制粘贴
//复制选中
void Menuitem_copyselecttoClick(object sender, EventArgs e)
{
DataEditForm df =GetActive();
if(df!=null)
DataEditForm df = GetActive();
if (df != null)
{
tCards = df.getCardList(true);
if (tCards != null)
{
tCards=df.getCardList(true);
if(tCards!=null){
SetCopyNumber(tCards.Length);
MyMsg.Show(LMSG.CopyCards);
}
}
}
//复制当前结果
void Menuitem_copyallClick(object sender, EventArgs e)
{
DataEditForm df =GetActive();
if(df!=null)
DataEditForm df = GetActive();
if (df != null)
{
tCards = df.getCardList(false);
if (tCards != null)
{
tCards=df.getCardList(false);
if(tCards!=null){
SetCopyNumber(tCards.Length);
MyMsg.Show(LMSG.CopyCards);
}
......@@ -527,20 +388,20 @@ void Menuitem_copyallClick(object sender, EventArgs e)
}
void SetCopyNumber(int c)
{
string tmp=menuitem_pastecards.Text;
int t=tmp.LastIndexOf(" (");
if(t>0)
tmp=tmp.Substring(0,t);
tmp=tmp+" ("+c.ToString()+")";
menuitem_pastecards.Text=tmp;
string tmp = menuitem_pastecards.Text;
int t = tmp.LastIndexOf(" (");
if (t > 0)
tmp = tmp.Substring(0, t);
tmp = tmp + " (" + c.ToString() + ")";
menuitem_pastecards.Text = tmp;
}
//粘贴卡片
void Menuitem_pastecardsClick(object sender, EventArgs e)
{
if(tCards==null)
if (tCards == null)
return;
DataEditForm df =GetActive();
if(df==null)
DataEditForm df = GetActive();
if (df == null)
return;
df.SaveCards(tCards);
MyMsg.Show(LMSG.PasteCards);
......@@ -548,46 +409,49 @@ void Menuitem_pastecardsClick(object sender, EventArgs e)
#endregion
#region compare
#region 数据对比
void Menuitem_comp1Click(object sender, EventArgs e)
{
compare1 = GetActive();
if(compare1 != null && !string.IsNullOrEmpty(compare1.getNowCDB()))
if (compare1 != null && !string.IsNullOrEmpty(compare1.GetOpenFile()))
{
menuitem_comp2.Enabled = true;
CompareDB();
}
}
void Menuitem_comp2Click(object sender, EventArgs e)
{
compare2 = GetActive();
if (compare2 != null && !string.IsNullOrEmpty(compare2.GetOpenFile()))
{
menuitem_comp2.Enabled=true;
CompareDB();
}
}
//对比数据库
void CompareDB()
{
if(compare1 == null || compare2 == null)
if (compare1 == null || compare2 == null)
return;
string cdb1=compare1.getNowCDB();
string cdb2=compare2.getNowCDB();
if(string.IsNullOrEmpty(cdb1)
string cdb1 = compare1.GetOpenFile();
string cdb2 = compare2.GetOpenFile();
if (string.IsNullOrEmpty(cdb1)
|| string.IsNullOrEmpty(cdb2)
||cdb1==cdb2)
|| cdb1 == cdb2)
return;
bool checktext=MyMsg.Question(LMSG.CheckText);
bool checktext = MyMsg.Question(LMSG.CheckText);
compare1.CompareCards(cdb2, checktext);
compare2.CompareCards(cdb1, checktext);
MyMsg.Show(LMSG.CompareOK);
menuitem_comp2.Enabled=false;
compare1=null;
compare2=null;
}
void Menuitem_comp2Click(object sender, EventArgs e)
{
compare2 = GetActive();
if(compare2 != null && !string.IsNullOrEmpty(compare2.getNowCDB()))
{
CompareDB();
}
menuitem_comp2.Enabled = false;
compare1 = null;
compare2 = null;
}
#endregion
#region complate
#region 获取函数列表
void Menuitem_findluafuncClick(object sender, EventArgs e)
{
using (FolderBrowserDialog fd = new FolderBrowserDialog())
......@@ -603,9 +467,11 @@ void Menuitem_findluafuncClick(object sender, EventArgs e)
}
#endregion
#region 自动更新
private void bgWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
TaskHelper.CheckVersion(false);
}
#endregion
}
}
......@@ -11,44 +11,38 @@
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using DataEditorX.Config;
namespace DataEditorX
{
/// Class with program entry point.
/// </summary>
internal sealed class Program
{
/// <summary>
/// <summary>
/// Program entry point.
/// </summary>
[STAThread]
private static void Main(string[] args)
{
string arg="";
if(args.Length>0)
{
arg=args[0];
}
string file = (args.Length > 0) ? args[0] : "";
Process instance = RunningInstance();
//判断是否已经运行
if (instance == null)
{
ShowForm(arg);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MainForm mainForm = new MainForm();
mainForm.SetLanguage(MyConfig.readString(MyConfig.TAG_LANGUAGE));
mainForm.Open(file);
Application.Run(mainForm);
}
else
{
int msg=MainForm.WM_OPEN;
if(MainForm.isScript(arg))
msg=MainForm.WM_OPEN_SCRIPT;
File.WriteAllText(Path.Combine(Application.StartupPath, MainForm.TMPFILE), arg);
User32.SendMessage(instance.MainWindowHandle, msg, 0 ,0);
//Thread.Sleep(1000);
//发送消息给窗口
string tmpfile = Path.Combine(Application.StartupPath, MyConfig.FILE_TEMP);
File.WriteAllText(tmpfile, file);
User32.SendMessage(instance.MainWindowHandle, MyConfig.WM_OPEN, 0, 0);
Environment.Exit(1);
}
}
private static Process RunningInstance()
static Process RunningInstance()
{
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(current.ProcessName);
......@@ -70,18 +64,5 @@ private static Process RunningInstance()
}
return null;
}
static void ShowForm(string file)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string dir=ConfigurationManager.AppSettings["language"];
if(string.IsNullOrEmpty(dir))
{
Application.Exit();
}
string datapath=Path.Combine(Application.StartupPath, dir);
Application.Run(new MainForm(datapath, file));
}
}
}
0x0 卡片种族
0x1 战士族
0x2 魔法使
0x2 魔法
0x4 天使族
0x8 恶魔族
0x10 不死族
......
CodeEditForm->CodeEditForm 脚本编辑器
CodeEditForm->menuitem_file 文件(&F)
CodeEditForm->menuitem_open 打开
CodeEditForm->menuitem_save 保存
CodeEditForm->menuitem_saveas 另存为
CodeEditForm->menuitem_quit 退出
CodeEditForm->menuitem_setting 设置(&S)
CodeEditForm->menuitem_showmap 显示缩略图
CodeEditForm->menuitem_showinput 显示文本框
CodeEditForm->menuitem_setcard 设置卡片库
CodeEditForm->menuitem_find 查找
CodeEditForm->menuitem_replace 替换
CodeEditForm->menuitem_help 帮助(&H)
CodeEditForm->menuitem_about 关于
\ No newline at end of file
DataEditForm->btn_add 添加(&A)
DataEditForm->btn_del 删除(&D)
DataEditForm->btn_lua 脚本(&L)
DataEditForm->btn_img 导入卡图(&I)
DataEditForm->btn_undo 撤销(&U)
DataEditForm->btn_mod 修改(&M)
DataEditForm->btn_PageDown 下一页
DataEditForm->btn_PageUp 上一页
DataEditForm->btn_reset 重置(&R)
DataEditForm->btn_serach 搜索(&S)
DataEditForm->DataEditForm DataEditorX
DataEditForm->lb_atkdef ATK/DEF
DataEditForm->lb_cardalias 同名卡
DataEditForm->lb_cardcode 卡片密码
DataEditForm->lb_categorys 效果种类
DataEditForm->lb_pleft_right 灵摆刻度
DataEditForm->lb_scripttext
DataEditForm->lb_tiptexts 提示文字
DataEditForm->lb_types 卡片种类
DataEditForm->lb2 /
DataEditForm->lb4 /
DataEditForm->lb5 /
DataEditForm->lv_cardlist0 密码
DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menu_tools 功能(&T)
DataEditForm->menuitem_exportdata 导出所有卡片数据为zip
DataEditForm->menuitem_cancelTask 取消当前任务
DataEditForm->menuitem_compdb 压缩当前数据库
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_importmseimg MSE图片库
DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
DataEditForm->menuitem_saveasmse 当前所有卡片导出MSE存档
DataEditForm->menuitem_about 关于(&A)
DataEditForm->menuitem_checkupdate 检查更新
DataEditForm->menuitem_copyselectto 所选卡片复制到...
DataEditForm->menuitem_copyto 当前所有卡片复制到...
DataEditForm->menuitem_file 文件(&F)
DataEditForm->menuitem_github 源码主页
DataEditForm->menuitem_help 帮助(&H)
DataEditForm->menuitem_new 新建(&N)
DataEditForm->menuitem_open 打开(&O)
DataEditForm->menuitem_quit 退出(&Q)
DataEditForm->menuitem_readimages 从图像文件夹读取
DataEditForm->menuitem_readydk 从ydk文件读取
\ No newline at end of file
MainForm->menuitem_file 文件(&F)
MainForm->menuitem_new 新建(&N)
MainForm->menuitem_open 打开(&O)
MainForm->menuitem_save 保存(&S)
MainForm->menuitem_copyselect 复制所选卡片
MainForm->menuitem_copyall 复制当前结果的所有卡片
MainForm->menuitem_findluafunc 从源码获取Lua函数
MainForm->menuitem_pastecards 粘贴卡片
MainForm->menuitem_comp1 对比-卡片数据 1
MainForm->menuitem_comp2 对比-卡片数据 2
MainForm->menuitem_history 数据库历史记录(&H)
MainForm->menuitem_shistory 脚本历史记录
MainForm->menuitem_quit 退出(&Q)
MainForm->menuitem_windows 窗口(&W)
MainForm->menuitem_dataeditor DataEditor
MainForm->menuitem_codeeditor CodeEditor
MainForm->menuitem_closeall 关闭所有
MainForm->menuitem_closeother 关闭其他
MainForm->menuitem_close 关闭当前
\ No newline at end of file
CodeEditForm 脚本编辑
CodeEditForm.CodeEditForm 脚本编辑器
CodeEditForm.documentMap1 预览图
CodeEditForm.fctb
CodeEditForm.menuitem_about 关于
CodeEditForm.menuitem_file 文件(&F)
CodeEditForm.menuitem_file.menuitem_open 打开
CodeEditForm.menuitem_file.menuitem_quit 退出
CodeEditForm.menuitem_file.menuitem_save 保存
CodeEditForm.menuitem_file.menuitem_saveas 另存为
CodeEditForm.menuitem_find 查找
CodeEditForm.menuitem_help 帮助(&H)
CodeEditForm.menuitem_help.menuitem_about 关于(&A)
CodeEditForm.menuitem_open 打开
CodeEditForm.menuitem_quit 退出
CodeEditForm.menuitem_replace 替换
CodeEditForm.menuitem_save 保存
CodeEditForm.menuitem_saveas 另存为
CodeEditForm.menuitem_setcard 设置卡片库
CodeEditForm.menuitem_setting 设置(&S)
CodeEditForm.menuitem_setting.menuitem_find 查找
CodeEditForm.menuitem_setting.menuitem_replace 替换
CodeEditForm.menuitem_setting.menuitem_setcard 设置卡片库
CodeEditForm.menuitem_setting.menuitem_showinput 显示输入框
CodeEditForm.menuitem_setting.menuitem_showmap 显示预览图
CodeEditForm.menuitem_showinput 显示文本框
CodeEditForm.menuitem_showmap 显示缩略图
CodeEditForm.tb_input
DataEditForm 数据编辑
DataEditForm.btn_add 添加(&A)
DataEditForm.btn_del 删除(&D)
DataEditForm.btn_img 导入卡图(&I)
DataEditForm.btn_lua 脚本(&L)
DataEditForm.btn_mod 修改(&M)
DataEditForm.btn_PageDown 下一页
DataEditForm.btn_PageUp 上一页
DataEditForm.btn_reset 重置(&R)
DataEditForm.btn_serach 搜索(&S)
DataEditForm.btn_undo 撤销(&U)
DataEditForm.lb_atkdef ATK/DEF
DataEditForm.lb_cardalias 同名卡
DataEditForm.lb_cardcode 卡片密码
DataEditForm.lb_categorys 效果种类
DataEditForm.lb_pleft_right 灵摆刻度
DataEditForm.lb_scripttext
DataEditForm.lb_tiptexts 提示文字
DataEditForm.lb_types 卡片种类
DataEditForm.lb2 /
DataEditForm.lb4 /
DataEditForm.lb5 /
DataEditForm.lv_cardlist.0 密码
DataEditForm.lv_cardlist.1 卡片名称
DataEditForm.lv_cardlist0 密码
DataEditForm.lv_cardlist1 卡片名称
DataEditForm.menuitem_file 文件(&F)
DataEditForm.menuitem_help 帮助(&H)
DataEditForm.menuitem_new 新建(&N)
DataEditForm.menuitem_open 打开(&O)
DataEditForm.menuitem_openLastDataBase 最后打开的数据库
DataEditForm.menuitem_quit 退出(&Q)
DataEditForm.menu_tools 功能(&T)
DataEditForm.menu_tools.menuitem_cancelTask 取消当前任务
DataEditForm.menu_tools.menuitem_compdb 压缩数据库
DataEditForm.menu_tools.menuitem_convertimage 批量导入卡图
DataEditForm.menu_tools.menuitem_cutimages 裁剪卡图
DataEditForm.menu_tools.menuitem_exportdata 导出所有卡片数据为zip
DataEditForm.menu_tools.menuitem_importmseimg 设置为MSE图片库
DataEditForm.menu_tools.menuitem_readimages 从图片读取卡片(&I)
DataEditForm.menu_tools.menuitem_readydk 从卡组读取卡片(&Y)
DataEditForm.menu_tools.menuitem_saveasmse 保存当前所有卡片到MSE存档
DataEditForm.menu_tools.menuitem_saveasmse_select 保存选中卡片到MSE存档
DataEditForm.menuitem_help.menuitem_about 关于
DataEditForm.menuitem_help.menuitem_checkupdate 检查更新
DataEditForm.menuitem_help.menuitem_github 软件源码
MainForm.menuitem_close 关闭当前
MainForm.menuitem_closeall 关闭所有
MainForm.menuitem_closeother 关闭其他
MainForm.menuitem_codeeditor CodeEditor
MainForm.menuitem_comp1 对比-卡片数据 1
MainForm.menuitem_comp2 对比-卡片数据 2
MainForm.menuitem_copyall 复制当前结果的所有卡片
MainForm.menuitem_copyselect 复制所选卡片
MainForm.menuitem_dataeditor DataEditor
MainForm.menuitem_file 文件(&F)
MainForm.menuitem_file.menuitem_comp1 设为对比的数据库1
MainForm.menuitem_file.menuitem_comp2 设为对比的数据库2
MainForm.menuitem_file.menuitem_copyall 复制所有结果卡片
MainForm.menuitem_file.menuitem_copyselect 复制选中卡片
MainForm.menuitem_file.menuitem_copyselectto 复制选中卡片到...
MainForm.menuitem_file.menuitem_copyto 复制所有结果卡片到...
MainForm.menuitem_file.menuitem_findluafunc 查找函数
MainForm.menuitem_file.menuitem_history 历史(&H)
MainForm.menuitem_file.menuitem_new 新建
MainForm.menuitem_file.menuitem_open 打开
MainForm.menuitem_file.menuitem_openLastDataBase 打开最后数据卡
MainForm.menuitem_file.menuitem_pastecards 粘贴卡片
MainForm.menuitem_file.menuitem_quit 退出
MainForm.menuitem_file.menuitem_save 保存
MainForm.menuitem_file.menuitem_shistory 脚本历史
MainForm.menuitem_windows 窗口(&W)
MainForm.menuitem_windows.menuitem_close 关闭当前
MainForm.menuitem_windows.menuitem_closeall 关闭所有
MainForm.menuitem_windows.menuitem_closeother 关闭其他
MainForm.menuitem_windows.menuitem_codeeditor 代码编辑
MainForm.menuitem_windows.menuitem_dataeditor 数据编辑
[DataEditorX]2.2.8.4[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
★文件关联(File association)
.lua notepad++/sublime text/DataEditorX
.cdb DataEditorX
★bug反馈
★bug反馈(Feedback)
Email:247321453@qq.com
提交版本前,请检查更新。
......@@ -14,7 +14,10 @@ Email:247321453@qq.com
错误提示文字:(弹出出错框,请按Ctrl+C,然后找地方粘贴)
详细描述:(卡片信息,杀毒软件,本程序目录等等)
★支持多语言化
Title:(DataEditorX+Version)
Content:Error Message
★支持多语言化(Language setting)
DataEditorX.exe.config
<add key="language" value="chinese" />简体
<add key="language" value="english" />英文
......
No preview for this file type
0x0 卡片种族
0x1 战士族
0x2 魔法使
0x2 魔法
0x4 天使族
0x8 恶魔族
0x10 不死族
......
......@@ -3,19 +3,19 @@ F:\games\ygopro\cards.cdb
F:\games\[jp]cards.cdb
F:\games\ygopro\p.zip.cdb
# script history
F:\games\ygopro\script\c131182.lua
F:\games\ygopro\script\c168917.lua
F:\games\ygopro\script\c114932.lua
F:\games\ygopro\script\c269012.lua
F:\games\ygopro\script\c296499.lua
F:\games\ygopro\script\c218704.lua
F:\games\ygopro\script\c126218.lua
F:\games\ygopro\script\c102380.lua
F:\games\ygopro\script\c135598.lua
F:\games\ygopro\script\c176392.lua
F:\games\ygopro\script\c27551.lua
F:\games\ygopro\script\c168917.lua
F:\games\ygopro\script\c131182.lua
F:\games\ygopro\script\c255998.lua
F:\games\ygopro\script\c47198668.lua
F:\games\ygopro\script\c4239451.lua
F:\games\ygopro\script\c93368494.lua
F:\games\ygopro\script\c50485594.lua
\ No newline at end of file
F:\games\ygopro\script\c17857780.lua
F:\games\ygopro\script\c65518099.lua
F:\games\ygopro\script\c64496451.lua
F:\games\ygopro\script\c78835747.lua
F:\games\ygopro\script\c94415058.lua
F:\games\ygopro\script\c26270847.lua
F:\games\ygopro\script\c65025250.lua
\ No newline at end of file
CodeEditForm->CodeEditForm 脚本编辑器
CodeEditForm->menuitem_file 文件(&F)
CodeEditForm->menuitem_open 打开
CodeEditForm->menuitem_save 保存
CodeEditForm->menuitem_saveas 另存为
CodeEditForm->menuitem_quit 退出
CodeEditForm->menuitem_setting 设置(&S)
CodeEditForm->menuitem_showmap 显示缩略图
CodeEditForm->menuitem_showinput 显示文本框
CodeEditForm->menuitem_setcard 设置卡片库
CodeEditForm->menuitem_find 查找
CodeEditForm->menuitem_replace 替换
CodeEditForm->menuitem_help 帮助(&H)
CodeEditForm->menuitem_about 关于
\ No newline at end of file
DataEditForm->btn_add 添加(&A)
DataEditForm->btn_del 删除(&D)
DataEditForm->btn_lua 脚本(&L)
DataEditForm->btn_img 导入卡图(&I)
DataEditForm->btn_undo 撤销(&U)
DataEditForm->btn_mod 修改(&M)
DataEditForm->btn_PageDown 下一页
DataEditForm->btn_PageUp 上一页
DataEditForm->btn_reset 重置(&R)
DataEditForm->btn_serach 搜索(&S)
DataEditForm->DataEditForm DataEditorX
DataEditForm->lb_atkdef ATK/DEF
DataEditForm->lb_cardalias 同名卡
DataEditForm->lb_cardcode 卡片密码
DataEditForm->lb_categorys 效果种类
DataEditForm->lb_pleft_right 灵摆刻度
DataEditForm->lb_scripttext
DataEditForm->lb_tiptexts 提示文字
DataEditForm->lb_types 卡片种类
DataEditForm->lb2 /
DataEditForm->lb4 /
DataEditForm->lb5 /
DataEditForm->lv_cardlist0 密码
DataEditForm->lv_cardlist1 卡片名称
DataEditForm->menu_tools 功能(&T)
DataEditForm->menuitem_exportdata 导出所有卡片数据为zip
DataEditForm->menuitem_cancelTask 取消当前任务
DataEditForm->menuitem_compdb 压缩当前数据库
DataEditForm->menuitem_convertimage 批量导入卡图
DataEditForm->menuitem_importmseimg MSE图片库
DataEditForm->menuitem_openLastDataBase 最后打开的数据库
DataEditForm->menuitem_cutimages 裁剪列表卡片的图片
DataEditForm->menuitem_saveasmse_select 所选卡片导出MSE存档
DataEditForm->menuitem_saveasmse 当前所有卡片导出MSE存档
DataEditForm->menuitem_about 关于(&A)
DataEditForm->menuitem_checkupdate 检查更新
DataEditForm->menuitem_copyselectto 所选卡片复制到...
DataEditForm->menuitem_copyto 当前所有卡片复制到...
DataEditForm->menuitem_file 文件(&F)
DataEditForm->menuitem_github 源码主页
DataEditForm->menuitem_help 帮助(&H)
DataEditForm->menuitem_new 新建(&N)
DataEditForm->menuitem_open 打开(&O)
DataEditForm->menuitem_quit 退出(&Q)
DataEditForm->menuitem_readimages 从图像文件夹读取
DataEditForm->menuitem_readydk 从ydk文件读取
\ No newline at end of file
MainForm->menuitem_file 文件(&F)
MainForm->menuitem_new 新建(&N)
MainForm->menuitem_open 打开(&O)
MainForm->menuitem_save 保存(&S)
MainForm->menuitem_copyselect 复制所选卡片
MainForm->menuitem_copyall 复制当前结果的所有卡片
MainForm->menuitem_findluafunc 从源码获取Lua函数
MainForm->menuitem_pastecards 粘贴卡片
MainForm->menuitem_comp1 对比-卡片数据 1
MainForm->menuitem_comp2 对比-卡片数据 2
MainForm->menuitem_history 数据库历史记录(&H)
MainForm->menuitem_shistory 脚本历史记录
MainForm->menuitem_quit 退出(&Q)
MainForm->menuitem_windows 窗口(&W)
MainForm->menuitem_dataeditor DataEditor
MainForm->menuitem_codeeditor CodeEditor
MainForm->menuitem_closeall 关闭所有
MainForm->menuitem_closeother 关闭其他
MainForm->menuitem_close 关闭当前
\ No newline at end of file
CodeEditForm 脚本编辑
CodeEditForm.CodeEditForm 脚本编辑器
CodeEditForm.documentMap1 预览图
CodeEditForm.fctb
CodeEditForm.menuitem_about 关于
CodeEditForm.menuitem_file 文件(&F)
CodeEditForm.menuitem_file.menuitem_open 打开
CodeEditForm.menuitem_file.menuitem_quit 退出
CodeEditForm.menuitem_file.menuitem_save 保存
CodeEditForm.menuitem_file.menuitem_saveas 另存为
CodeEditForm.menuitem_find 查找
CodeEditForm.menuitem_help 帮助(&H)
CodeEditForm.menuitem_help.menuitem_about 关于(&A)
CodeEditForm.menuitem_open 打开
CodeEditForm.menuitem_quit 退出
CodeEditForm.menuitem_replace 替换
CodeEditForm.menuitem_save 保存
CodeEditForm.menuitem_saveas 另存为
CodeEditForm.menuitem_setcard 设置卡片库
CodeEditForm.menuitem_setting 设置(&S)
CodeEditForm.menuitem_setting.menuitem_find 查找
CodeEditForm.menuitem_setting.menuitem_replace 替换
CodeEditForm.menuitem_setting.menuitem_setcard 设置卡片库
CodeEditForm.menuitem_setting.menuitem_showinput 显示输入框
CodeEditForm.menuitem_setting.menuitem_showmap 显示预览图
CodeEditForm.menuitem_showinput 显示文本框
CodeEditForm.menuitem_showmap 显示缩略图
CodeEditForm.tb_input
DataEditForm 数据编辑
DataEditForm.btn_add 添加(&A)
DataEditForm.btn_del 删除(&D)
DataEditForm.btn_img 导入卡图(&I)
DataEditForm.btn_lua 脚本(&L)
DataEditForm.btn_mod 修改(&M)
DataEditForm.btn_PageDown 下一页
DataEditForm.btn_PageUp 上一页
DataEditForm.btn_reset 重置(&R)
DataEditForm.btn_serach 搜索(&S)
DataEditForm.btn_undo 撤销(&U)
DataEditForm.lb_atkdef ATK/DEF
DataEditForm.lb_cardalias 同名卡
DataEditForm.lb_cardcode 卡片密码
DataEditForm.lb_categorys 效果种类
DataEditForm.lb_pleft_right 灵摆刻度
DataEditForm.lb_scripttext
DataEditForm.lb_tiptexts 提示文字
DataEditForm.lb_types 卡片种类
DataEditForm.lb2 /
DataEditForm.lb4 /
DataEditForm.lb5 /
DataEditForm.lv_cardlist.0 密码
DataEditForm.lv_cardlist.1 卡片名称
DataEditForm.lv_cardlist0 密码
DataEditForm.lv_cardlist1 卡片名称
DataEditForm.menuitem_file 文件(&F)
DataEditForm.menuitem_help 帮助(&H)
DataEditForm.menuitem_new 新建(&N)
DataEditForm.menuitem_open 打开(&O)
DataEditForm.menuitem_openLastDataBase 最后打开的数据库
DataEditForm.menuitem_quit 退出(&Q)
DataEditForm.menu_tools 功能(&T)
DataEditForm.menu_tools.menuitem_cancelTask 取消当前任务
DataEditForm.menu_tools.menuitem_compdb 压缩数据库
DataEditForm.menu_tools.menuitem_convertimage 批量导入卡图
DataEditForm.menu_tools.menuitem_cutimages 裁剪卡图
DataEditForm.menu_tools.menuitem_exportdata 导出所有卡片数据为zip
DataEditForm.menu_tools.menuitem_importmseimg 设置为MSE图片库
DataEditForm.menu_tools.menuitem_readimages 从图片读取卡片(&I)
DataEditForm.menu_tools.menuitem_readydk 从卡组读取卡片(&Y)
DataEditForm.menu_tools.menuitem_saveasmse 保存当前所有卡片到MSE存档
DataEditForm.menu_tools.menuitem_saveasmse_select 保存选中卡片到MSE存档
DataEditForm.menuitem_help.menuitem_about 关于
DataEditForm.menuitem_help.menuitem_checkupdate 检查更新
DataEditForm.menuitem_help.menuitem_github 软件源码
MainForm.menuitem_close 关闭当前
MainForm.menuitem_closeall 关闭所有
MainForm.menuitem_closeother 关闭其他
MainForm.menuitem_codeeditor CodeEditor
MainForm.menuitem_comp1 对比-卡片数据 1
MainForm.menuitem_comp2 对比-卡片数据 2
MainForm.menuitem_copyall 复制当前结果的所有卡片
MainForm.menuitem_copyselect 复制所选卡片
MainForm.menuitem_dataeditor DataEditor
MainForm.menuitem_file 文件(&F)
MainForm.menuitem_file.menuitem_comp1 设为对比的数据库1
MainForm.menuitem_file.menuitem_comp2 设为对比的数据库2
MainForm.menuitem_file.menuitem_copyall 复制所有结果卡片
MainForm.menuitem_file.menuitem_copyselect 复制选中卡片
MainForm.menuitem_file.menuitem_copyselectto 复制选中卡片到...
MainForm.menuitem_file.menuitem_copyto 复制所有结果卡片到...
MainForm.menuitem_file.menuitem_findluafunc 查找函数
MainForm.menuitem_file.menuitem_history 历史(&H)
MainForm.menuitem_file.menuitem_new 新建
MainForm.menuitem_file.menuitem_open 打开
MainForm.menuitem_file.menuitem_openLastDataBase 打开最后数据卡
MainForm.menuitem_file.menuitem_pastecards 粘贴卡片
MainForm.menuitem_file.menuitem_quit 退出
MainForm.menuitem_file.menuitem_save 保存
MainForm.menuitem_file.menuitem_shistory 脚本历史
MainForm.menuitem_windows 窗口(&W)
MainForm.menuitem_windows.menuitem_close 关闭当前
MainForm.menuitem_windows.menuitem_closeall 关闭所有
MainForm.menuitem_windows.menuitem_closeother 关闭其他
MainForm.menuitem_windows.menuitem_codeeditor 代码编辑
MainForm.menuitem_windows.menuitem_dataeditor 数据编辑
[DataEditorX]2.2.8.4[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
★文件关联(File association)
.lua notepad++/sublime text/DataEditorX
.cdb DataEditorX
★bug反馈
★bug反馈(Feedback)
Email:247321453@qq.com
提交版本前,请检查更新。
......@@ -14,7 +14,10 @@ Email:247321453@qq.com
错误提示文字:(弹出出错框,请按Ctrl+C,然后找地方粘贴)
详细描述:(卡片信息,杀毒软件,本程序目录等等)
★支持多语言化
Title:(DataEditorX+Version)
Content:Error Message
★支持多语言化(Language setting)
DataEditorX.exe.config
<add key="language" value="chinese" />简体
<add key="language" value="english" />英文
......
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