Commit 6b85b033 authored by keyongyu's avatar keyongyu

2.3.3.0 导出MSE图片

parent 2ce57c68
...@@ -17,6 +17,7 @@ public class MyConfig : XMLReader ...@@ -17,6 +17,7 @@ public class MyConfig : XMLReader
#region 常量 #region 常量
public const string TAG_SAVE_LAGN = "-savelanguage"; public const string TAG_SAVE_LAGN = "-savelanguage";
public const string TAG_SAVE_LAGN2 = "-sl"; public const string TAG_SAVE_LAGN2 = "-sl";
public const string TAG_MSE_PATH="mse_path";
/// <summary> /// <summary>
/// 窗口消息 打开文件 /// 窗口消息 打开文件
/// </summary> /// </summary>
......
...@@ -41,6 +41,10 @@ public class MSEConfig ...@@ -41,6 +41,10 @@ public class MSEConfig
public const string TAG_TYPE = "type"; public const string TAG_TYPE = "type";
public const string TAG_WIDTH="width"; public const string TAG_WIDTH="width";
public const string TAG_HEIGHT="height"; public const string TAG_HEIGHT="height";
public const string TAG_PEND_WIDTH="pwidth";
public const string TAG_PEND_HEIGHT="pheight";
public const string TAG_IMAGE = "imagepath"; public const string TAG_IMAGE = "imagepath";
public const string TAG_REPALCE = "replace"; public const string TAG_REPALCE = "replace";
...@@ -99,6 +103,12 @@ public void SetConfig(string config, string path) ...@@ -99,6 +103,12 @@ public void SetConfig(string config, string path)
else if (line.StartsWith(TAG_HEIGHT)){ else if (line.StartsWith(TAG_HEIGHT)){
height=ConfHelper.getIntegerValue(line,0); height=ConfHelper.getIntegerValue(line,0);
} }
else if (line.StartsWith(TAG_PEND_WIDTH)){
pwidth=ConfHelper.getIntegerValue(line,0);
}
else if (line.StartsWith(TAG_PEND_HEIGHT)){
pheight=ConfHelper.getIntegerValue(line,0);
}
else if (line.StartsWith(TAG_IMAGE)) else if (line.StartsWith(TAG_IMAGE))
{ {
//如果路径不合法,则为后面的路径 //如果路径不合法,则为后面的路径
...@@ -149,6 +159,10 @@ public void init(string path) ...@@ -149,6 +159,10 @@ public void init(string path)
/// 中间图高度 /// 中间图高度
/// </summary> /// </summary>
public int height; public int height;
public int pwidth;
public int pheight;
//每个存档最大数 //每个存档最大数
public int maxcount; public int maxcount;
//图片路径 //图片路径
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* 时间: 12:48 * 时间: 12:48
* *
*/ */
using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
...@@ -16,6 +17,8 @@ ...@@ -16,6 +17,8 @@
using DataEditorX.Config; using DataEditorX.Config;
using DataEditorX.Language; using DataEditorX.Language;
using DataEditorX.Common; using DataEditorX.Common;
using System.Windows.Forms;
using System.Threading;
namespace DataEditorX.Core.Mse namespace DataEditorX.Core.Mse
{ {
...@@ -366,9 +369,9 @@ public string[] GetTypes(Card c) ...@@ -366,9 +369,9 @@ public string[] GetTypes(Card c)
#region 写存档 #region 写存档
//写存档 //写存档
public string[] WriteSet(string file, Card[] cards) public Dictionary<Card, string> WriteSet(string file, Card[] cards)
{ {
List<string> list = new List<string>(); Dictionary<Card, string> list = new Dictionary<Card, string>();
string pic = cfg.imagepath; string pic = cfg.imagepath;
using (FileStream fs = new FileStream(file, using (FileStream fs = new FileStream(file,
FileMode.Create, FileAccess.Write)) FileMode.Create, FileAccess.Write))
...@@ -380,7 +383,7 @@ public string[] WriteSet(string file, Card[] cards) ...@@ -380,7 +383,7 @@ public string[] WriteSet(string file, Card[] cards)
string jpg = GetCardImagePath(pic, c); string jpg = GetCardImagePath(pic, c);
if (!string.IsNullOrEmpty(jpg)) if (!string.IsNullOrEmpty(jpg))
{ {
list.Add(jpg); list.Add(c, jpg);
jpg = Path.GetFileName(jpg); jpg = Path.GetFileName(jpg);
} }
if (c.IsType(CardType.TYPE_SPELL) || c.IsType(CardType.TYPE_TRAP)) if (c.IsType(CardType.TYPE_SPELL) || c.IsType(CardType.TYPE_TRAP))
...@@ -392,7 +395,7 @@ public string[] WriteSet(string file, Card[] cards) ...@@ -392,7 +395,7 @@ public string[] WriteSet(string file, Card[] cards)
sw.Close(); sw.Close();
} }
return list.ToArray(); return list;
} }
//怪兽,pendulum怪兽 //怪兽,pendulum怪兽
string getMonster(Card c, string img, bool isPendulum) string getMonster(Card c, string img, bool isPendulum)
...@@ -723,7 +726,12 @@ public Card[] ReadCards(string set, bool repalceOld) ...@@ -723,7 +726,12 @@ public Card[] ReadCards(string set, bool repalceOld)
} }
#endregion #endregion
public string getImageCache(string img){ /// <summary>
/// 图片缓存
/// </summary>
/// <param name="img"></param>
/// <returns></returns>
public string getImageCache(string img,Card card){
if(cfg.width<=0 && cfg.height<=0) if(cfg.width<=0 && cfg.height<=0)
return img; return img;
string md5=MyUtils.GetMD5HashFromFile(img); string md5=MyUtils.GetMD5HashFromFile(img);
...@@ -733,14 +741,57 @@ public Card[] ReadCards(string set, bool repalceOld) ...@@ -733,14 +741,57 @@ public Card[] ReadCards(string set, bool repalceOld)
} }
string file = MyPath.Combine(cfg.imagecache, md5); string file = MyPath.Combine(cfg.imagecache, md5);
if(!File.Exists(file)){ if(!File.Exists(file)){
//生成缓存 //生成缓存
Bitmap bmp=MyBitmap.readImage(file); Bitmap bmp=MyBitmap.readImage(file);
//缩放 //缩放
bmp=MyBitmap.Zoom(bmp, cfg.width,cfg.height); if(card!=null && card.IsType(CardType.TYPE_PENDULUM)){
bmp=MyBitmap.Zoom(bmp, cfg.pwidth,cfg.pheight);
}else{
bmp=MyBitmap.Zoom(bmp, cfg.width,cfg.height);
}
//保存文件 //保存文件
MyBitmap.SaveAsJPEG(bmp, file,100); MyBitmap.SaveAsJPEG(bmp, file,100);
} }
return img; return img;
} }
private static void exportSetThread(object obj){
string[] args=(string[])obj;
if(args==null||args.Length<3){
System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
return;
}
string mse_path=args[0];
string setfile=args[1];
string path=args[2];
if(mse_path==null||mse_path.Length==0||setfile==null||setfile.Length==0){
System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImagesErr));
return;
}else{
string cmd=" --export "+setfile.Replace("\\\\","\\").Replace("\\","/")+" {card.gamecode}.png";
System.Diagnostics.Process ie = new System.Diagnostics.Process();
ie.StartInfo.FileName = mse_path;
ie.StartInfo.Arguments = cmd;
ie.StartInfo.WorkingDirectory=path;
MyPath.CreateDir(path);
try{
ie.Start();
//等待结束,需要把当前方法放到线程里面
ie.WaitForExit();
ie.Close();
System.Windows.Forms.MessageBox.Show(Language.LanguageHelper.GetMsg(LMSG.exportMseImages));
}catch{
}
}
}
public static void exportSet(string mse_path,string setfile,string path){
if(mse_path==null||mse_path.Length==0||setfile==null||setfile.Length==0){
return;
}
ParameterizedThreadStart ParStart = new ParameterizedThreadStart(exportSetThread);
Thread myThread = new Thread(ParStart);
myThread.IsBackground=true;
myThread.Start(new string[]{mse_path,setfile,path});
}
} }
} }
...@@ -278,23 +278,24 @@ public void SaveMSEs(string file, Card[] cards, bool isUpdate) ...@@ -278,23 +278,24 @@ public void SaveMSEs(string file, Card[] cards, bool isUpdate)
public void SaveMSE(int num, string file, Card[] cards, bool isUpdate) public void SaveMSE(int num, string file, Card[] cards, bool isUpdate)
{ {
string setFile = file + ".txt"; string setFile = file + ".txt";
string[] images = mseHelper.WriteSet(setFile, cards); Dictionary<Card, string> images = mseHelper.WriteSet(setFile, cards);
if (isUpdate)//仅更新文字 if (isUpdate)//仅更新文字
return; return;
int i = 0; int i = 0;
int count = images.Length; int count = images.Count;
using (ZipStorer zips = ZipStorer.Create(file, "")) using (ZipStorer zips = ZipStorer.Create(file, ""))
{ {
zips.EncodeUTF8 = true;//zip里面的文件名为utf8 zips.EncodeUTF8 = true;//zip里面的文件名为utf8
zips.AddFile(setFile, "set", ""); zips.AddFile(setFile, "set", "");
foreach (string img in images) foreach (Card c in images.Keys)
{ {
string img=images[c];
if (isCancel) if (isCancel)
break; break;
i++; i++;
worker.ReportProgress(i / count, string.Format("{0}/{1}-{2}", i, count, num)); worker.ReportProgress(i / count, string.Format("{0}/{1}-{2}", i, count, num));
//TODO 先裁剪图片 //TODO 先裁剪图片
zips.AddFile(mseHelper.getImageCache(img), Path.GetFileName(img), ""); zips.AddFile(mseHelper.getImageCache(img,c), Path.GetFileName(img), "");
} }
} }
File.Delete(setFile); File.Delete(setFile);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -22,131 +22,131 @@ ...@@ -22,131 +22,131 @@
namespace DataEditorX namespace DataEditorX
{ {
public partial class DataEditForm : DockContent, IDataForm public partial class DataEditForm : DockContent, IDataForm
{ {
#region 成员变量/构造 #region 成员变量/构造
TaskHelper tasker = null; TaskHelper tasker = null;
string taskname; string taskname;
//目录 //目录
YgoPath ygopath; YgoPath ygopath;
/// <summary>当前卡片</summary> /// <summary>当前卡片</summary>
Card oldCard = new Card(0); Card oldCard = new Card(0);
/// <summary>搜索条件</summary> /// <summary>搜索条件</summary>
Card srcCard = new Card(0); Card srcCard = new Card(0);
//卡片编辑 //卡片编辑
CardEdit cardedit; CardEdit cardedit;
string[] strs = null; string[] strs = null;
/// <summary> /// <summary>
/// 对比的id集合 /// 对比的id集合
/// </summary> /// </summary>
List<string>tmpCodes; List<string>tmpCodes;
//初始标题 //初始标题
string title; string title;
string nowCdbFile = ""; string nowCdbFile = "";
int MaxRow = 20; int MaxRow = 20;
int page = 1, pageNum = 1; int page = 1, pageNum = 1;
/// <summary> /// <summary>
/// 卡片总数 /// 卡片总数
/// </summary> /// </summary>
int cardcount; int cardcount;
/// <summary> /// <summary>
/// 搜索结果 /// 搜索结果
/// </summary> /// </summary>
List<Card> cardlist = new List<Card>(); List<Card> cardlist = new List<Card>();
//setcode正在输入 //setcode正在输入
bool[] setcodeIsedit = new bool[5]; bool[] setcodeIsedit = new bool[5];
Image m_cover; Image m_cover;
MSEConfig msecfg; MSEConfig msecfg;
string datapath, confcover; string datapath, confcover;
public DataEditForm(string datapath, string cdbfile) public DataEditForm(string datapath, string cdbfile)
{ {
Initialize(datapath); Initialize(datapath);
nowCdbFile = cdbfile; nowCdbFile = cdbfile;
} }
public DataEditForm(string datapath) public DataEditForm(string datapath)
{ {
Initialize(datapath); Initialize(datapath);
} }
public DataEditForm() public DataEditForm()
{//默认启动 {//默认启动
string dir = MyConfig.readString(MyConfig.TAG_DATA); string dir = MyConfig.readString(MyConfig.TAG_DATA);
if (string.IsNullOrEmpty(dir)) if (string.IsNullOrEmpty(dir))
{ {
Application.Exit(); Application.Exit();
} }
datapath = MyPath.Combine(Application.StartupPath, dir); datapath = MyPath.Combine(Application.StartupPath, dir);
Initialize(datapath); Initialize(datapath);
} }
void Initialize(string datapath) void Initialize(string datapath)
{ {
cardedit = new CardEdit(this); cardedit = new CardEdit(this);
tmpCodes = new List<string>(); tmpCodes = new List<string>();
ygopath = new YgoPath(Application.StartupPath); ygopath = new YgoPath(Application.StartupPath);
InitPath(datapath); InitPath(datapath);
InitializeComponent(); InitializeComponent();
title = this.Text; title = this.Text;
nowCdbFile = ""; nowCdbFile = "";
} }
#endregion #endregion
#region 接口 #region 接口
public void SetActived() public void SetActived()
{ {
this.Activate(); this.Activate();
} }
public string GetOpenFile() public string GetOpenFile()
{ {
return nowCdbFile; return nowCdbFile;
} }
public bool CanOpen(string file) public bool CanOpen(string file)
{ {
return YGOUtil.isDataBase(file); return YGOUtil.isDataBase(file);
} }
public bool Create(string file) public bool Create(string file)
{ {
return Open(file); return Open(file);
} }
public bool Save() public bool Save()
{ {
return true; return true;
} }
#endregion #endregion
#region 窗体 #region 窗体
//窗体第一次加载 //窗体第一次加载
void DataEditFormLoad(object sender, EventArgs e) void DataEditFormLoad(object sender, EventArgs e)
{ {
InitListRows();//调整卡片列表的函数 InitListRows();//调整卡片列表的函数
HideMenu();//是否需要隐藏菜单 HideMenu();//是否需要隐藏菜单
SetTitle();//设置标题 SetTitle();//设置标题
//加载 //加载
msecfg = new MSEConfig(datapath); msecfg = new MSEConfig(datapath);
tasker = new TaskHelper(datapath, bgWorker1, msecfg); tasker = new TaskHelper(datapath, bgWorker1, msecfg);
//设置空白卡片 //设置空白卡片
oldCard = new Card(0); oldCard = new Card(0);
SetCard(oldCard); SetCard(oldCard);
//删除资源 //删除资源
menuitem_operacardsfile.Checked = MyConfig.readBoolean(MyConfig.TAG_DELETE_WITH); menuitem_operacardsfile.Checked = MyConfig.readBoolean(MyConfig.TAG_DELETE_WITH);
//用CodeEditor打开脚本 //用CodeEditor打开脚本
menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS); menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS);
//自动检查更新 //自动检查更新
menuitem_autocheckupdate.Checked = MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE); menuitem_autocheckupdate.Checked = MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE);
if (nowCdbFile != null && File.Exists(nowCdbFile)) if (nowCdbFile != null && File.Exists(nowCdbFile))
Open(nowCdbFile); Open(nowCdbFile);
//获取MSE配菜单 //获取MSE配菜单
AddMenuItemFormMSE(); AddMenuItemFormMSE();
// //
GetLanguageItem(); GetLanguageItem();
// CheckUpdate(false);//检查更新 // CheckUpdate(false);//检查更新
} }
//窗体关闭 //窗体关闭
void DataEditFormFormClosing(object sender, FormClosingEventArgs e) void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
{ {
//清理备份文件 //清理备份文件
List<long> delids = new List<long>(); List<long> delids = new List<long>();
...@@ -160,483 +160,483 @@ void DataEditFormFormClosing(object sender, FormClosingEventArgs e) ...@@ -160,483 +160,483 @@ void DataEditFormFormClosing(object sender, FormClosingEventArgs e)
foreach (long id in delids) foreach (long id in delids)
YGOUtil.CardDelete(id, GetPath(), YGOUtil.DeleteOption.CLEAN); YGOUtil.CardDelete(id, GetPath(), YGOUtil.DeleteOption.CLEAN);
} }
//当前有任务执行,是否结束 //当前有任务执行,是否结束
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
{ {
if (!CancelTask()) if (!CancelTask())
{ {
e.Cancel = true; e.Cancel = true;
return; return;
} }
} }
} }
//窗体激活 //窗体激活
void DataEditFormEnter(object sender, EventArgs e) void DataEditFormEnter(object sender, EventArgs e)
{ {
SetTitle(); SetTitle();
} }
#endregion #endregion
#region 初始化设置 #region 初始化设置
//隐藏菜单 //隐藏菜单
void HideMenu() void HideMenu()
{ {
if (this.MdiParent == null) if (this.MdiParent == null)
return; return;
mainMenu.Visible = false; mainMenu.Visible = false;
menuitem_file.Visible = false; menuitem_file.Visible = false;
menuitem_file.Enabled = false; menuitem_file.Enabled = false;
//this.SuspendLayout(); //this.SuspendLayout();
this.ResumeLayout(true); 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; continue;
Point p = c.Location; Point p = c.Location;
c.Location = new Point(p.X, p.Y - 25); c.Location = new Point(p.X, p.Y - 25);
} }
this.ResumeLayout(false); this.ResumeLayout(false);
//this.PerformLayout(); //this.PerformLayout();
} }
//移除Tag //移除Tag
string RemoveTag(string text) string RemoveTag(string text)
{ {
int t = text.LastIndexOf(" ("); int t = text.LastIndexOf(" (");
if (t > 0) if (t > 0)
{ {
return text.Substring(0, t); return text.Substring(0, t);
} }
return text; return text;
} }
//设置标题 //设置标题
void SetTitle() void SetTitle()
{ {
string str = title; string str = title;
string str2 = RemoveTag(title); string str2 = RemoveTag(title);
if (!string.IsNullOrEmpty(nowCdbFile)) if (!string.IsNullOrEmpty(nowCdbFile))
{ {
str = nowCdbFile + "-" + str; str = nowCdbFile + "-" + str;
str2 = Path.GetFileName(nowCdbFile); str2 = Path.GetFileName(nowCdbFile);
} }
if (this.MdiParent != null) //父容器不为空 if (this.MdiParent != null) //父容器不为空
{ {
this.Text = str2; this.Text = str2;
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
{ {
if (DockPanel.ActiveContent == this) if (DockPanel.ActiveContent == this)
this.MdiParent.Text = str; this.MdiParent.Text = str;
} }
else else
this.MdiParent.Text = str; this.MdiParent.Text = str;
} }
else else
this.Text = str; this.Text = str;
} }
//按cdb路径设置目录 //按cdb路径设置目录
void SetCDB(string cdb) void SetCDB(string cdb)
{ {
this.nowCdbFile = cdb; this.nowCdbFile = cdb;
SetTitle(); SetTitle();
string path = Application.StartupPath; string path = Application.StartupPath;
if (cdb.Length > 0) if (cdb.Length > 0)
{ {
path = Path.GetDirectoryName(cdb); path = Path.GetDirectoryName(cdb);
} }
ygopath.SetPath(path); ygopath.SetPath(path);
} }
//初始化文件路径 //初始化文件路径
void InitPath(string datapath) void InitPath(string datapath)
{ {
this.datapath = datapath; this.datapath = datapath;
confcover = MyPath.Combine(datapath, "cover.jpg"); confcover = MyPath.Combine(datapath, "cover.jpg");
if (File.Exists(confcover)) if (File.Exists(confcover))
m_cover = MyBitmap.readImage(confcover); m_cover = MyBitmap.readImage(confcover);
else else
m_cover = null; m_cover = null;
} }
#endregion #endregion
#region 界面控件 #region 界面控件
//初始化控件 //初始化控件
public void InitControl(DataConfig datacfg) public void InitControl(DataConfig datacfg)
{ {
if (datacfg == null) if (datacfg == null)
return; return;
//选择框 //选择框
InitComboBox(cb_cardrace, datacfg.dicCardRaces); InitComboBox(cb_cardrace, datacfg.dicCardRaces);
InitComboBox(cb_cardattribute, datacfg.dicCardAttributes); InitComboBox(cb_cardattribute, datacfg.dicCardAttributes);
InitComboBox(cb_cardrule, datacfg.dicCardRules); InitComboBox(cb_cardrule, datacfg.dicCardRules);
InitComboBox(cb_cardlevel, datacfg.dicCardLevels); InitComboBox(cb_cardlevel, datacfg.dicCardLevels);
//卡片类型 //卡片类型
InitCheckPanel(pl_cardtype, datacfg.dicCardTypes); InitCheckPanel(pl_cardtype, datacfg.dicCardTypes);
//效果类型 //效果类型
InitCheckPanel(pl_category, datacfg.dicCardcategorys); InitCheckPanel(pl_category, datacfg.dicCardcategorys);
//系列名 //系列名
List<long> setcodes = DataManager.GetKeys(datacfg.dicSetnames); List<long> setcodes = DataManager.GetKeys(datacfg.dicSetnames);
string[] setnames = DataManager.GetValues(datacfg.dicSetnames); string[] setnames = DataManager.GetValues(datacfg.dicSetnames);
InitComboBox(cb_setname1, setcodes, setnames); InitComboBox(cb_setname1, setcodes, setnames);
InitComboBox(cb_setname2, setcodes, setnames); InitComboBox(cb_setname2, setcodes, setnames);
InitComboBox(cb_setname3, setcodes, setnames); InitComboBox(cb_setname3, setcodes, setnames);
InitComboBox(cb_setname4, setcodes, setnames); InitComboBox(cb_setname4, setcodes, setnames);
// //
} }
//初始化FlowLayoutPanel //初始化FlowLayoutPanel
void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic) void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic)
{ {
fpanel.SuspendLayout(); fpanel.SuspendLayout();
fpanel.Controls.Clear(); fpanel.Controls.Clear();
foreach (long key in dic.Keys) foreach (long key in dic.Keys)
{ {
CheckBox _cbox = new CheckBox(); CheckBox _cbox = new CheckBox();
//_cbox.Name = fpanel.Name + key.ToString("x"); //_cbox.Name = fpanel.Name + key.ToString("x");
_cbox.Tag = key;//绑定值 _cbox.Tag = key;//绑定值
_cbox.Text = dic[key]; _cbox.Text = dic[key];
_cbox.AutoSize = true; _cbox.AutoSize = true;
_cbox.Margin = fpanel.Margin; _cbox.Margin = fpanel.Margin;
//_cbox.Click += PanelOnCheckClick; //_cbox.Click += PanelOnCheckClick;
fpanel.Controls.Add(_cbox); fpanel.Controls.Add(_cbox);
} }
fpanel.ResumeLayout(false); fpanel.ResumeLayout(false);
fpanel.PerformLayout(); fpanel.PerformLayout();
} }
//初始化ComboBox //初始化ComboBox
void InitComboBox(ComboBox cb, Dictionary<long, string> tempdic) void InitComboBox(ComboBox cb, Dictionary<long, string> tempdic)
{ {
InitComboBox(cb, DataManager.GetKeys(tempdic), InitComboBox(cb, DataManager.GetKeys(tempdic),
DataManager.GetValues(tempdic)); DataManager.GetValues(tempdic));
} }
//初始化ComboBox //初始化ComboBox
void InitComboBox(ComboBox cb, List<long> keys, string[] values) void InitComboBox(ComboBox cb, List<long> keys, string[] values)
{ {
cb.Items.Clear(); cb.Items.Clear();
cb.Tag = keys; cb.Tag = keys;
cb.Items.AddRange(values); cb.Items.AddRange(values);
cb.SelectedIndex = 0; cb.SelectedIndex = 0;
} }
//计算list最大行数 //计算list最大行数
void InitListRows() void InitListRows()
{ {
if (lv_cardlist.Items.Count == 0) if (lv_cardlist.Items.Count == 0)
{ {
ListViewItem item = new ListViewItem(); ListViewItem item = new ListViewItem();
item.Text = "Test"; item.Text = "Test";
lv_cardlist.Items.Add(item); lv_cardlist.Items.Add(item);
} }
int headH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Y; int headH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Y;
int itemH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height; int itemH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height;
if (itemH > 0) if (itemH > 0)
{ {
int n = (lv_cardlist.Height - headH - 4) / itemH; int n = (lv_cardlist.Height - headH - 4) / itemH;
if (n > 0) if (n > 0)
MaxRow = n; MaxRow = n;
} }
lv_cardlist.Items.Clear(); lv_cardlist.Items.Clear();
if (MaxRow < 10) if (MaxRow < 10)
MaxRow = 20; MaxRow = 20;
} }
//设置checkbox //设置checkbox
void SetCheck(FlowLayoutPanel fpl, long number) void SetCheck(FlowLayoutPanel fpl, long number)
{ {
long temp; long temp;
//string strType = ""; //string strType = "";
foreach (Control c in fpl.Controls) foreach (Control c in fpl.Controls)
{ {
if (c is CheckBox) if (c is CheckBox)
{ {
CheckBox cbox = (CheckBox)c; CheckBox cbox = (CheckBox)c;
if (cbox.Tag == null) if (cbox.Tag == null)
temp = 0; temp = 0;
else else
temp = (long)cbox.Tag; temp = (long)cbox.Tag;
if ((temp & number) == temp && temp != 0) if ((temp & number) == temp && temp != 0)
{ {
cbox.Checked = true; cbox.Checked = true;
//strType += "/" + c.Text; //strType += "/" + c.Text;
} }
else else
cbox.Checked = false; cbox.Checked = false;
} }
} }
//return strType; //return strType;
} }
//设置combobox //设置combobox
void SetSelect(ComboBox cb, long k) void SetSelect(ComboBox cb, long k)
{ {
if (cb.Tag == null) if (cb.Tag == null)
{ {
cb.SelectedIndex = 0; cb.SelectedIndex = 0;
return; return;
} }
List<long> keys = (List<long>)cb.Tag; List<long> keys = (List<long>)cb.Tag;
int index = keys.IndexOf(k); int index = keys.IndexOf(k);
if (index >= 0 && index < cb.Items.Count) if (index >= 0 && index < cb.Items.Count)
cb.SelectedIndex = index; cb.SelectedIndex = index;
else else
cb.SelectedIndex = 0; cb.SelectedIndex = 0;
} }
//得到所选值 //得到所选值
long GetSelect(ComboBox cb) long GetSelect(ComboBox cb)
{ {
if (cb.Tag == null) if (cb.Tag == null)
{ {
return 0; return 0;
} }
List<long> keys = (List<long>)cb.Tag; List<long> keys = (List<long>)cb.Tag;
int index = cb.SelectedIndex; int index = cb.SelectedIndex;
if (index >= keys.Count) if (index >= keys.Count)
return 0; return 0;
else else
return keys[index]; return keys[index];
} }
//得到checkbox的总值 //得到checkbox的总值
long GetCheck(FlowLayoutPanel fpl) long GetCheck(FlowLayoutPanel fpl)
{ {
long number = 0; long number = 0;
long temp; long temp;
foreach (Control c in fpl.Controls) foreach (Control c in fpl.Controls)
{ {
if (c is CheckBox) if (c is CheckBox)
{ {
CheckBox cbox = (CheckBox)c; CheckBox cbox = (CheckBox)c;
if (cbox.Tag == null) if (cbox.Tag == null)
temp = 0; temp = 0;
else else
temp = (long)cbox.Tag; temp = (long)cbox.Tag;
if (cbox.Checked) if (cbox.Checked)
number += temp; number += temp;
} }
} }
return number; return number;
} }
//添加列表行 //添加列表行
void AddListView(int p) void AddListView(int p)
{ {
int i, j, istart, iend; int i, j, istart, iend;
if (p <= 0) if (p <= 0)
p = 1; p = 1;
else if (p >= pageNum) else if (p >= pageNum)
p = pageNum; p = pageNum;
istart = (p - 1) * MaxRow; istart = (p - 1) * MaxRow;
iend = p * MaxRow; iend = p * MaxRow;
if (iend > cardcount) if (iend > cardcount)
iend = cardcount; iend = cardcount;
page = p; page = p;
lv_cardlist.BeginUpdate(); lv_cardlist.BeginUpdate();
lv_cardlist.Items.Clear(); lv_cardlist.Items.Clear();
if ((iend - istart) > 0) if ((iend - istart) > 0)
{ {
ListViewItem[] items = new ListViewItem[iend - istart]; ListViewItem[] items = new ListViewItem[iend - istart];
Card mcard; Card mcard;
for (i = istart, j = 0; i < iend; i++, j++) for (i = istart, j = 0; i < iend; i++, j++)
{ {
mcard = cardlist[i]; mcard = cardlist[i];
items[j] = new ListViewItem(); items[j] = new ListViewItem();
items[j].Tag = i; items[j].Tag = i;
items[j].Text = mcard.id.ToString(); items[j].Text = mcard.id.ToString();
if (mcard.id == oldCard.id) if (mcard.id == oldCard.id)
items[j].Checked = true; items[j].Checked = true;
if (i % 2 == 0) if (i % 2 == 0)
items[j].BackColor = Color.GhostWhite; items[j].BackColor = Color.GhostWhite;
else else
items[j].BackColor = Color.White; items[j].BackColor = Color.White;
items[j].SubItems.Add(mcard.name); items[j].SubItems.Add(mcard.name);
} }
lv_cardlist.Items.AddRange(items); lv_cardlist.Items.AddRange(items);
} }
lv_cardlist.EndUpdate(); lv_cardlist.EndUpdate();
tb_page.Text = page.ToString(); tb_page.Text = page.ToString();
} }
#endregion #endregion
#region 设置卡片 #region 设置卡片
public YgoPath GetPath() public YgoPath GetPath()
{ {
return ygopath; return ygopath;
} }
public Card GetOldCard() public Card GetOldCard()
{ {
return oldCard; return oldCard;
} }
public void SetCard(Card c) public void SetCard(Card c)
{ {
oldCard = c; oldCard = c;
tb_cardname.Text = c.name; tb_cardname.Text = c.name;
tb_cardtext.Text = c.desc; tb_cardtext.Text = c.desc;
strs = new string[c.Str.Length]; strs = new string[c.Str.Length];
Array.Copy(c.Str, strs, Card.STR_MAX); Array.Copy(c.Str, strs, Card.STR_MAX);
lb_scripttext.Items.Clear(); lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(c.Str); lb_scripttext.Items.AddRange(c.Str);
tb_edittext.Text = ""; tb_edittext.Text = "";
//data //data
SetSelect(cb_cardrule, c.ot); SetSelect(cb_cardrule, c.ot);
SetSelect(cb_cardattribute, c.attribute); SetSelect(cb_cardattribute, c.attribute);
SetSelect(cb_cardlevel, (c.level & 0xff)); SetSelect(cb_cardlevel, (c.level & 0xff));
SetSelect(cb_cardrace, c.race); SetSelect(cb_cardrace, c.race);
//setcode //setcode
long[] setcodes = c.GetSetCode(); long[] setcodes = c.GetSetCode();
tb_setcode1.Text = setcodes[0].ToString("x"); tb_setcode1.Text = setcodes[0].ToString("x");
tb_setcode2.Text = setcodes[1].ToString("x"); tb_setcode2.Text = setcodes[1].ToString("x");
tb_setcode3.Text = setcodes[2].ToString("x"); tb_setcode3.Text = setcodes[2].ToString("x");
tb_setcode4.Text = setcodes[3].ToString("x"); tb_setcode4.Text = setcodes[3].ToString("x");
//type,category //type,category
SetCheck(pl_cardtype, c.type); SetCheck(pl_cardtype, c.type);
SetCheck(pl_category, c.category); SetCheck(pl_category, c.category);
//Pendulum //Pendulum
tb_pleft.Text = ((c.level >> 0x18) & 0xff).ToString(); tb_pleft.Text = ((c.level >> 0x18) & 0xff).ToString();
tb_pright.Text = ((c.level >> 0x10) & 0xff).ToString(); tb_pright.Text = ((c.level >> 0x10) & 0xff).ToString();
//atk,def //atk,def
tb_atk.Text = (c.atk < 0) ? "?" : c.atk.ToString(); tb_atk.Text = (c.atk < 0) ? "?" : c.atk.ToString();
tb_def.Text = (c.def < 0) ? "?" : c.def.ToString(); tb_def.Text = (c.def < 0) ? "?" : c.def.ToString();
tb_cardcode.Text = c.id.ToString(); tb_cardcode.Text = c.id.ToString();
tb_cardalias.Text = c.alias.ToString(); tb_cardalias.Text = c.alias.ToString();
SetImage(c.id.ToString()); SetImage(c.id.ToString());
} }
#endregion #endregion
#region 获取卡片 #region 获取卡片
public Card GetCard() public Card GetCard()
{ {
int temp; int temp;
Card c = new Card(0); Card c = new Card(0);
c.name = tb_cardname.Text; c.name = tb_cardname.Text;
c.desc = tb_cardtext.Text; c.desc = tb_cardtext.Text;
Array.Copy(strs, c.Str, Card.STR_MAX); Array.Copy(strs, c.Str, Card.STR_MAX);
c.ot = (int)GetSelect(cb_cardrule); c.ot = (int)GetSelect(cb_cardrule);
c.attribute = (int)GetSelect(cb_cardattribute); c.attribute = (int)GetSelect(cb_cardattribute);
c.level = (int)GetSelect(cb_cardlevel); c.level = (int)GetSelect(cb_cardlevel);
c.race = (int)GetSelect(cb_cardrace); c.race = (int)GetSelect(cb_cardrace);
//系列 //系列
c.SetSetCode( c.SetSetCode(
tb_setcode1.Text, tb_setcode1.Text,
tb_setcode2.Text, tb_setcode2.Text,
tb_setcode3.Text, tb_setcode3.Text,
tb_setcode4.Text); tb_setcode4.Text);
c.type = GetCheck(pl_cardtype); c.type = GetCheck(pl_cardtype);
c.category = GetCheck(pl_category); c.category = GetCheck(pl_category);
int.TryParse(tb_pleft.Text, out temp); int.TryParse(tb_pleft.Text, out temp);
c.level += (temp << 0x18); c.level += (temp << 0x18);
int.TryParse(tb_pright.Text, out temp); int.TryParse(tb_pright.Text, out temp);
c.level += (temp << 0x10); c.level += (temp << 0x10);
if (tb_atk.Text == "?" || tb_atk.Text == "?") if (tb_atk.Text == "?" || tb_atk.Text == "?")
c.atk = -2; c.atk = -2;
else if (tb_atk.Text == ".") else if (tb_atk.Text == ".")
c.atk = -1; c.atk = -1;
else else
int.TryParse(tb_atk.Text, out c.atk); int.TryParse(tb_atk.Text, out c.atk);
if (tb_def.Text == "?" || tb_def.Text == "?") if (tb_def.Text == "?" || tb_def.Text == "?")
c.def = -2; c.def = -2;
else if (tb_def.Text == ".") else if (tb_def.Text == ".")
c.def = -1; c.def = -1;
else else
int.TryParse(tb_def.Text, out c.def); int.TryParse(tb_def.Text, out c.def);
long.TryParse(tb_cardcode.Text, out c.id); long.TryParse(tb_cardcode.Text, out c.id);
long.TryParse(tb_cardalias.Text, out c.alias); long.TryParse(tb_cardalias.Text, out c.alias);
return c; return c;
} }
#endregion #endregion
#region 卡片列表 #region 卡片列表
//列表选择 //列表选择
void Lv_cardlistSelectedIndexChanged(object sender, EventArgs e) 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 sel = lv_cardlist.SelectedItems[0].Index;
int index = (page - 1) * MaxRow + sel; int index = (page - 1) * MaxRow + sel;
if (index < cardlist.Count) if (index < cardlist.Count)
{ {
Card c = cardlist[index]; Card c = cardlist[index];
SetCard(c); SetCard(c);
} }
} }
} }
//列表按键 //列表按键
void Lv_cardlistKeyDown(object sender, KeyEventArgs e) void Lv_cardlistKeyDown(object sender, KeyEventArgs e)
{ {
switch (e.KeyCode) switch (e.KeyCode)
{ {
case Keys.Delete: case Keys.Delete:
cardedit.DelCards(menuitem_operacardsfile.Checked); cardedit.DelCards(menuitem_operacardsfile.Checked);
break; break;
case Keys.Right: case Keys.Right:
Btn_PageDownClick(null, null); Btn_PageDownClick(null, null);
break; break;
case Keys.Left: case Keys.Left:
Btn_PageUpClick(null, null); Btn_PageUpClick(null, null);
break; break;
} }
} }
//上一页 //上一页
void Btn_PageUpClick(object sender, EventArgs e) void Btn_PageUpClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
page--; page--;
AddListView(page); AddListView(page);
} }
//下一页 //下一页
void Btn_PageDownClick(object sender, EventArgs e) void Btn_PageDownClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
page++; page++;
AddListView(page); AddListView(page);
} }
//跳转到指定页数 //跳转到指定页数
void Tb_pageKeyPress(object sender, KeyPressEventArgs e) void Tb_pageKeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == (char)Keys.Enter) if (e.KeyChar == (char)Keys.Enter)
{ {
int p; int p;
int.TryParse(tb_page.Text, out p); int.TryParse(tb_page.Text, out p);
if (p > 0) if (p > 0)
AddListView(p); AddListView(p);
} }
} }
#endregion #endregion
#region 卡片搜索,打开 #region 卡片搜索,打开
//检查是否打开数据库 //检查是否打开数据库
public bool CheckOpen() public bool CheckOpen()
{ {
if (File.Exists(nowCdbFile)) if (File.Exists(nowCdbFile))
return true; return true;
else else
{ {
MyMsg.Warning(LMSG.NotSelectDataBase); MyMsg.Warning(LMSG.NotSelectDataBase);
return false; return false;
} }
} }
//打开数据库 //打开数据库
public bool Open(string file) public bool Open(string file)
{ {
SetCDB(file); SetCDB(file);
if (!File.Exists(file)) if (!File.Exists(file))
{ {
MyMsg.Error(LMSG.FileIsNotExists); MyMsg.Error(LMSG.FileIsNotExists);
return false; return false;
} }
//清空 //清空
tmpCodes.Clear(); tmpCodes.Clear();
cardlist.Clear(); cardlist.Clear();
//检查表是否存在 //检查表是否存在
DataBase.CheckTable(file); DataBase.CheckTable(file);
srcCard = new Card(); srcCard = new Card();
SetCards(DataBase.Read(file, true, ""), false); SetCards(DataBase.Read(file, true, ""), false);
return true; return true;
} }
//setcode, 灵摆刻度的搜索 //setcode, 灵摆刻度的搜索
public bool CardFilter(Card c, Card sc) public bool CardFilter(Card c, Card sc)
{ {
...@@ -649,468 +649,468 @@ public bool CardFilter(Card c, Card sc) ...@@ -649,468 +649,468 @@ public bool CardFilter(Card c, Card sc)
res &= (c.GetRightScale() == sc.GetRightScale()); res &= (c.GetRightScale() == sc.GetRightScale());
return res; return res;
} }
//设置卡片列表的结果 //设置卡片列表的结果
public void SetCards(Card[] cards, bool isfresh) public void SetCards(Card[] cards, bool isfresh)
{ {
if (cards != null) if (cards != null)
{ {
cardlist.Clear(); cardlist.Clear();
foreach (Card c in cards) foreach (Card c in cards)
{ {
if (CardFilter(c, srcCard)) if (CardFilter(c, srcCard))
cardlist.Add(c); cardlist.Add(c);
} }
cardcount = cardlist.Count; cardcount = cardlist.Count;
pageNum = cardcount / MaxRow; pageNum = cardcount / MaxRow;
if (cardcount % MaxRow > 0) if (cardcount % MaxRow > 0)
pageNum++; pageNum++;
else if (cardcount == 0) else if (cardcount == 0)
pageNum = 1; pageNum = 1;
tb_pagenum.Text = pageNum.ToString(); tb_pagenum.Text = pageNum.ToString();
if (isfresh)//是否跳到之前页数 if (isfresh)//是否跳到之前页数
AddListView(page); AddListView(page);
else else
AddListView(1); AddListView(1);
} }
else else
{//结果为空 {//结果为空
cardcount = 0; cardcount = 0;
page = 1; page = 1;
pageNum = 1; pageNum = 1;
tb_page.Text = page.ToString(); tb_page.Text = page.ToString();
tb_pagenum.Text = pageNum.ToString(); tb_pagenum.Text = pageNum.ToString();
cardlist.Clear(); cardlist.Clear();
lv_cardlist.Items.Clear(); lv_cardlist.Items.Clear();
SetCard(new Card(0)); SetCard(new Card(0));
} }
} }
//搜索卡片 //搜索卡片
public void Search(bool isfresh) public void Search(bool isfresh)
{ {
Search(srcCard, isfresh); Search(srcCard, isfresh);
} }
void Search(Card c, bool isfresh) void Search(Card c, bool isfresh)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
//如果临时卡片不为空,则更新,这个在搜索的时候清空 //如果临时卡片不为空,则更新,这个在搜索的时候清空
if (tmpCodes.Count > 0) if (tmpCodes.Count > 0)
{ {
Card[] mcards = DataBase.Read(nowCdbFile, Card[] mcards = DataBase.Read(nowCdbFile,
true, tmpCodes.ToArray()); true, tmpCodes.ToArray());
SetCards(getCompCards(), true); SetCards(getCompCards(), true);
} }
else else
{ {
srcCard = c; srcCard = c;
string sql = DataBase.GetSelectSQL(c); string sql = DataBase.GetSelectSQL(c);
SetCards(DataBase.Read(nowCdbFile, true, sql), isfresh); SetCards(DataBase.Read(nowCdbFile, true, sql), isfresh);
} }
} }
//更新临时卡片 //更新临时卡片
public void Reset() public void Reset()
{ {
oldCard = new Card(0); oldCard = new Card(0);
SetCard(oldCard); SetCard(oldCard);
} }
#endregion #endregion
#region 按钮 #region 按钮
//搜索卡片 //搜索卡片
void Btn_serachClick(object sender, EventArgs e) void Btn_serachClick(object sender, EventArgs e)
{ {
tmpCodes.Clear();//清空临时的结果 tmpCodes.Clear();//清空临时的结果
Search(GetCard(), false); Search(GetCard(), false);
} }
//重置卡片 //重置卡片
void Btn_resetClick(object sender, EventArgs e) void Btn_resetClick(object sender, EventArgs e)
{ {
Reset(); Reset();
} }
//添加 //添加
void Btn_addClick(object sender, EventArgs e) void Btn_addClick(object sender, EventArgs e)
{ {
if(cardedit != null) if(cardedit != null)
cardedit.AddCard(); cardedit.AddCard();
if (cardedit.undoSQL.Count != 0) if (cardedit.undoSQL.Count != 0)
btn_undo.Enabled = true; btn_undo.Enabled = true;
} }
//修改 //修改
void Btn_modClick(object sender, EventArgs e) void Btn_modClick(object sender, EventArgs e)
{ {
if (cardedit != null) if (cardedit != null)
cardedit.ModCard(menuitem_operacardsfile.Checked); cardedit.ModCard(menuitem_operacardsfile.Checked);
if (cardedit.undoSQL.Count != 0) if (cardedit.undoSQL.Count != 0)
btn_undo.Enabled = true; btn_undo.Enabled = true;
} }
//打开脚本 //打开脚本
void Btn_luaClick(object sender, EventArgs e) void Btn_luaClick(object sender, EventArgs e)
{ {
if (cardedit != null) if (cardedit != null)
cardedit.OpenScript(menuitem_openfileinthis.Checked); cardedit.OpenScript(menuitem_openfileinthis.Checked);
} }
//删除 //删除
void Btn_delClick(object sender, EventArgs e) void Btn_delClick(object sender, EventArgs e)
{ {
if (cardedit != null) if (cardedit != null)
cardedit.DelCards(menuitem_operacardsfile.Checked); cardedit.DelCards(menuitem_operacardsfile.Checked);
if (cardedit.undoSQL.Count != 0) if (cardedit.undoSQL.Count != 0)
btn_undo.Enabled = true; btn_undo.Enabled = true;
} }
void Btn_undoClick(object sender, EventArgs e) void Btn_undoClick(object sender, EventArgs e)
{ {
if (cardedit != null) if (cardedit != null)
cardedit.Undo(); cardedit.Undo();
if (cardedit.undoSQL.Count == 0) if (cardedit.undoSQL.Count == 0)
btn_undo.Enabled = false; btn_undo.Enabled = false;
} }
//导入卡图 //导入卡图
void Btn_imgClick(object sender, EventArgs e) void Btn_imgClick(object sender, EventArgs e)
{ {
ImportImageFromSelect(); ImportImageFromSelect();
} }
#endregion #endregion
#region 文本框 #region 文本框
//卡片密码搜索 //卡片密码搜索
void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs 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); long.TryParse(tb_cardcode.Text, out c.id);
if (c.id > 0) if (c.id > 0)
{ {
tmpCodes.Clear();//清空临时的结果 tmpCodes.Clear();//清空临时的结果
Search(c, false); Search(c, false);
} }
} }
} }
//卡片名称搜索、编辑 //卡片名称搜索、编辑
void Tb_cardnameKeyDown(object sender, KeyEventArgs e) void Tb_cardnameKeyDown(object sender, KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Enter) if (e.KeyCode == Keys.Enter)
{ {
Card c = new Card(0); Card c = new Card(0);
c.name = tb_cardname.Text; c.name = tb_cardname.Text;
if (c.name.Length > 0) if (c.name.Length > 0)
{ {
tmpCodes.Clear();//清空临时的结果 tmpCodes.Clear();//清空临时的结果
Search(c, false); Search(c, false);
} }
} }
} }
//卡片描述编辑 //卡片描述编辑
void Setscripttext(string str) void Setscripttext(string str)
{ {
int index = -1; int index = -1;
try try
{ {
index = lb_scripttext.SelectedIndex; index = lb_scripttext.SelectedIndex;
} }
catch catch
{ {
index = -1; index = -1;
MyMsg.Error(LMSG.NotSelectScriptText); MyMsg.Error(LMSG.NotSelectScriptText);
} }
if (index >= 0) if (index >= 0)
{ {
strs[index] = str; strs[index] = str;
lb_scripttext.Items.Clear(); lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(strs); lb_scripttext.Items.AddRange(strs);
lb_scripttext.SelectedIndex = index; lb_scripttext.SelectedIndex = index;
} }
} }
string Getscripttext() string Getscripttext()
{ {
int index = -1; int index = -1;
try try
{ {
index = lb_scripttext.SelectedIndex; index = lb_scripttext.SelectedIndex;
} }
catch catch
{ {
index = -1; index = -1;
MyMsg.Error(LMSG.NotSelectScriptText); MyMsg.Error(LMSG.NotSelectScriptText);
} }
if (index >= 0) if (index >= 0)
return strs[index]; return strs[index];
else else
return ""; return "";
} }
//脚本文本 //脚本文本
void Lb_scripttextSelectedIndexChanged(object sender, EventArgs e) void Lb_scripttextSelectedIndexChanged(object sender, EventArgs e)
{ {
tb_edittext.Text = Getscripttext(); tb_edittext.Text = Getscripttext();
} }
//脚本文本 //脚本文本
void Tb_edittextTextChanged(object sender, EventArgs e) void Tb_edittextTextChanged(object sender, EventArgs e)
{ {
Setscripttext(tb_edittext.Text); Setscripttext(tb_edittext.Text);
} }
#endregion #endregion
#region 帮助菜单 #region 帮助菜单
void Menuitem_aboutClick(object sender, EventArgs e) void Menuitem_aboutClick(object sender, EventArgs e)
{ {
MyMsg.Show( MyMsg.Show(
LanguageHelper.GetMsg(LMSG.About) + "\t" + Application.ProductName + "\n" LanguageHelper.GetMsg(LMSG.About) + "\t" + Application.ProductName + "\n"
+ LanguageHelper.GetMsg(LMSG.Version) + "\t" + Application.ProductVersion + "\n" + LanguageHelper.GetMsg(LMSG.Version) + "\t" + Application.ProductVersion + "\n"
+ LanguageHelper.GetMsg(LMSG.Author) + "\t柯永裕\n" + LanguageHelper.GetMsg(LMSG.Author) + "\t柯永裕\n"
+ "Email:\t247321453@qq.com"); + "Email:\t247321453@qq.com");
} }
void Menuitem_checkupdateClick(object sender, EventArgs e) void Menuitem_checkupdateClick(object sender, EventArgs e)
{ {
CheckUpdate(true); CheckUpdate(true);
} }
public void CheckUpdate(bool showNew) public void CheckUpdate(bool showNew)
{ {
if (!isRun()) if (!isRun())
{ {
tasker.SetTask(MyTask.CheckUpdate, null, showNew.ToString()); tasker.SetTask(MyTask.CheckUpdate, null, showNew.ToString());
Run(LanguageHelper.GetMsg(LMSG.checkUpdate)); Run(LanguageHelper.GetMsg(LMSG.checkUpdate));
} }
} }
bool CancelTask() bool CancelTask()
{ {
bool bl = false; bool bl = false;
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
{ {
bl = MyMsg.Question(LMSG.IfCancelTask); bl = MyMsg.Question(LMSG.IfCancelTask);
if (bl) if (bl)
{ {
if (tasker != null) if (tasker != null)
tasker.Cancel(); tasker.Cancel();
if (bgWorker1.IsBusy) if (bgWorker1.IsBusy)
bgWorker1.CancelAsync(); bgWorker1.CancelAsync();
} }
} }
return bl; return bl;
} }
void Menuitem_cancelTaskClick(object sender, EventArgs e) void Menuitem_cancelTaskClick(object sender, EventArgs e)
{ {
CancelTask(); CancelTask();
} }
void Menuitem_githubClick(object sender, EventArgs e) void Menuitem_githubClick(object sender, EventArgs e)
{ {
System.Diagnostics.Process.Start(MyConfig.readString(MyConfig.TAG_SOURCE_URL)); System.Diagnostics.Process.Start(MyConfig.readString(MyConfig.TAG_SOURCE_URL));
} }
#endregion #endregion
#region 文件菜单 #region 文件菜单
//打开文件 //打开文件
void Menuitem_openClick(object sender, EventArgs e) void Menuitem_openClick(object sender, EventArgs e)
{ {
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath); dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType); dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
Open(dlg.FileName); Open(dlg.FileName);
} }
} }
} }
//新建文件 //新建文件
void Menuitem_newClick(object sender, EventArgs e) void Menuitem_newClick(object sender, EventArgs e)
{ {
using (SaveFileDialog dlg = new SaveFileDialog()) using (SaveFileDialog dlg = new SaveFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath); dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType); dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK) 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); Open(dlg.FileName);
} }
} }
} }
} }
//读取ydk //读取ydk
void Menuitem_readydkClick(object sender, EventArgs e) void Menuitem_readydkClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectYdkPath); dlg.Title = LanguageHelper.GetMsg(LMSG.SelectYdkPath);
dlg.Filter = LanguageHelper.GetMsg(LMSG.ydkType); dlg.Filter = LanguageHelper.GetMsg(LMSG.ydkType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
tmpCodes.Clear(); tmpCodes.Clear();
string[] ids = YGOUtil.ReadYDK(dlg.FileName); string[] ids = YGOUtil.ReadYDK(dlg.FileName);
tmpCodes.AddRange(ids); tmpCodes.AddRange(ids);
SetCards(DataBase.Read(nowCdbFile, true, SetCards(DataBase.Read(nowCdbFile, true,
ids), false); ids), false);
} }
} }
} }
//从图片文件夹读取 //从图片文件夹读取
void Menuitem_readimagesClick(object sender, EventArgs e) void Menuitem_readimagesClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
using (FolderBrowserDialog fdlg = new FolderBrowserDialog()) using (FolderBrowserDialog fdlg = new FolderBrowserDialog())
{ {
fdlg.Description = LanguageHelper.GetMsg(LMSG.SelectImagePath); fdlg.Description = LanguageHelper.GetMsg(LMSG.SelectImagePath);
if (fdlg.ShowDialog() == DialogResult.OK) if (fdlg.ShowDialog() == DialogResult.OK)
{ {
tmpCodes.Clear(); tmpCodes.Clear();
string[] ids = YGOUtil.ReadImage(fdlg.SelectedPath); string[] ids = YGOUtil.ReadImage(fdlg.SelectedPath);
tmpCodes.AddRange(ids); tmpCodes.AddRange(ids);
SetCards(DataBase.Read(nowCdbFile, true, SetCards(DataBase.Read(nowCdbFile, true,
ids), false); ids), false);
} }
} }
} }
//关闭 //关闭
void Menuitem_quitClick(object sender, EventArgs e) void Menuitem_quitClick(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
#endregion #endregion
#region 线程 #region 线程
//是否在执行 //是否在执行
bool isRun() bool isRun()
{ {
if (tasker != null && tasker.IsRuning()) if (tasker != null && tasker.IsRuning())
{ {
MyMsg.Warning(LMSG.RunError); MyMsg.Warning(LMSG.RunError);
return true; return true;
} }
return false; return false;
} }
//执行任务 //执行任务
void Run(string name) void Run(string name)
{ {
if (isRun()) if (isRun())
return; return;
taskname = name; taskname = name;
title = title + " (" + taskname + ")"; title = title + " (" + taskname + ")";
SetTitle(); SetTitle();
bgWorker1.RunWorkerAsync(); bgWorker1.RunWorkerAsync();
} }
//线程任务 //线程任务
void BgWorker1DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) void BgWorker1DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{ {
tasker.Run(); tasker.Run();
} }
void BgWorker1ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e) void BgWorker1ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{ {
title = string.Format("{0} ({1}-{2})", title = string.Format("{0} ({1}-{2})",
RemoveTag(title), RemoveTag(title),
taskname, taskname,
// e.ProgressPercentage, // e.ProgressPercentage,
e.UserState); e.UserState);
SetTitle(); SetTitle();
} }
//任务完成 //任务完成
void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) void BgWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{ {
//还原标题 //还原标题
int t = title.LastIndexOf(" ("); int t = title.LastIndexOf(" (");
if (t > 0) if (t > 0)
{ {
title = title.Substring(0, t); title = title.Substring(0, t);
SetTitle(); SetTitle();
} }
if (e.Error != null) if (e.Error != null)
{//出错 {//出错
if (tasker != null) if (tasker != null)
tasker.Cancel(); tasker.Cancel();
if (bgWorker1.IsBusy) if (bgWorker1.IsBusy)
bgWorker1.CancelAsync(); bgWorker1.CancelAsync();
MyMsg.Show(LanguageHelper.GetMsg(LMSG.TaskError) + "\n" + e.Error); MyMsg.Show(LanguageHelper.GetMsg(LMSG.TaskError) + "\n" + e.Error);
} }
else if (tasker.IsCancel() || e.Cancelled) else if (tasker.IsCancel() || e.Cancelled)
{//取消任务 {//取消任务
MyMsg.Show(LMSG.CancelTask); MyMsg.Show(LMSG.CancelTask);
} }
else else
{ {
MyTask mt = tasker.getLastTask(); MyTask mt = tasker.getLastTask();
switch (mt) switch (mt)
{ {
case MyTask.CheckUpdate: case MyTask.CheckUpdate:
break; break;
case MyTask.ExportData: case MyTask.ExportData:
MyMsg.Show(LMSG.ExportDataOK); MyMsg.Show(LMSG.ExportDataOK);
break; break;
case MyTask.CutImages: case MyTask.CutImages:
MyMsg.Show(LMSG.CutImageOK); MyMsg.Show(LMSG.CutImageOK);
break; break;
case MyTask.SaveAsMSE: case MyTask.SaveAsMSE:
MyMsg.Show(LMSG.SaveMseOK); MyMsg.Show(LMSG.SaveMseOK);
break; break;
case MyTask.ConvertImages: case MyTask.ConvertImages:
MyMsg.Show(LMSG.ConvertImageOK); MyMsg.Show(LMSG.ConvertImageOK);
break; break;
case MyTask.ReadMSE: case MyTask.ReadMSE:
//保存读取的卡片 //保存读取的卡片
SaveCards(tasker.CardList); SaveCards(tasker.CardList);
MyMsg.Show(LMSG.ReadMSEisOK); MyMsg.Show(LMSG.ReadMSEisOK);
break; break;
} }
} }
} }
#endregion #endregion
#region 复制卡片 #region 复制卡片
//得到卡片列表,是否是选中的 //得到卡片列表,是否是选中的
public Card[] GetCardList(bool onlyselect) public Card[] GetCardList(bool onlyselect)
{ {
if (!CheckOpen()) if (!CheckOpen())
return null; return null;
List<Card> cards = new List<Card>(); List<Card> cards = new List<Card>();
if (onlyselect) if (onlyselect)
{ {
foreach (ListViewItem lvitem in lv_cardlist.SelectedItems) foreach (ListViewItem lvitem in lv_cardlist.SelectedItems)
{ {
int index; int index;
if (lvitem.Tag != null) if (lvitem.Tag != null)
index = (int)lvitem.Tag; index = (int)lvitem.Tag;
else else
index = lvitem.Index + (page - 1) * MaxRow; index = lvitem.Index + (page - 1) * MaxRow;
if (index>=0 && index < cardlist.Count) if (index>=0 && index < cardlist.Count)
cards.Add(cardlist[index]); cards.Add(cardlist[index]);
} }
} }
else else
cards.AddRange(cardlist.ToArray()); cards.AddRange(cardlist.ToArray());
if (cards.Count == 0) if (cards.Count == 0)
{ {
//MyMsg.Show(LMSG.NoSelectCard); //MyMsg.Show(LMSG.NoSelectCard);
} }
return cards.ToArray(); return cards.ToArray();
} }
void Menuitem_copytoClick(object sender, EventArgs e) void Menuitem_copytoClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
CopyTo(GetCardList(false)); CopyTo(GetCardList(false));
} }
void Menuitem_copyselecttoClick(object sender, EventArgs e) void Menuitem_copyselecttoClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
CopyTo(GetCardList(true)); CopyTo(GetCardList(true));
} }
//保存卡片到当前数据库 //保存卡片到当前数据库
public void SaveCards(Card[] cards) public void SaveCards(Card[] cards)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (cards == null || cards.Length == 0) if (cards == null || cards.Length == 0)
return; return;
bool replace = false; bool replace = false;
Card[] oldcards = DataBase.Read(nowCdbFile, true, ""); Card[] oldcards = DataBase.Read(nowCdbFile, true, "");
string undo = ""; string undo = "";
...@@ -1138,448 +1138,448 @@ public void SaveCards(Card[] cards) ...@@ -1138,448 +1138,448 @@ public void SaveCards(Card[] cards)
cardedit.undoSQL.Add(undo); cardedit.undoSQL.Add(undo);
cardedit.undoModified.Add(new CardEdit.FileModified()); cardedit.undoModified.Add(new CardEdit.FileModified());
cardedit.undoDeleted.Add(new CardEdit.FileDeleted()); cardedit.undoDeleted.Add(new CardEdit.FileDeleted());
DataBase.CopyDB(nowCdbFile, !replace, cards); DataBase.CopyDB(nowCdbFile, !replace, cards);
Search(srcCard, true); Search(srcCard, true);
btn_undo.Enabled = true; btn_undo.Enabled = true;
} }
//卡片另存为 //卡片另存为
void CopyTo(Card[] cards) void CopyTo(Card[] cards)
{ {
if (cards == null || cards.Length == 0) if (cards == null || cards.Length == 0)
return; return;
//select file //select file
bool replace = false; bool replace = false;
string filename = null; string filename = null;
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath); dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType); dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
filename = dlg.FileName; filename = dlg.FileName;
replace = MyMsg.Question(LMSG.IfReplaceExistingCard); replace = MyMsg.Question(LMSG.IfReplaceExistingCard);
} }
} }
if (!string.IsNullOrEmpty(filename)) if (!string.IsNullOrEmpty(filename))
{ {
DataBase.CopyDB(filename, !replace, cards); DataBase.CopyDB(filename, !replace, cards);
MyMsg.Show(LMSG.CopyCardsToDBIsOK); MyMsg.Show(LMSG.CopyCardsToDBIsOK);
} }
} }
#endregion #endregion
#region MSE存档/裁剪图片 #region MSE存档/裁剪图片
//裁剪图片 //裁剪图片
void Menuitem_cutimagesClick(object sender, EventArgs e) void Menuitem_cutimagesClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (isRun()) if (isRun())
return; return;
bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage); bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage);
tasker.SetTask(MyTask.CutImages, cardlist.ToArray(), tasker.SetTask(MyTask.CutImages, cardlist.ToArray(),
ygopath.picpath, isreplace.ToString()); ygopath.picpath, isreplace.ToString());
Run(LanguageHelper.GetMsg(LMSG.CutImage)); Run(LanguageHelper.GetMsg(LMSG.CutImage));
} }
void Menuitem_saveasmse_selectClick(object sender, EventArgs e) void Menuitem_saveasmse_selectClick(object sender, EventArgs e)
{ {
//选择 //选择
SaveAsMSE(true); SaveAsMSE(true);
} }
void Menuitem_saveasmseClick(object sender, EventArgs e) void Menuitem_saveasmseClick(object sender, EventArgs e)
{ {
//全部 //全部
SaveAsMSE(false); SaveAsMSE(false);
} }
void SaveAsMSE(bool onlyselect) void SaveAsMSE(bool onlyselect)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (isRun()) if (isRun())
return; return;
Card[] cards = GetCardList(onlyselect); Card[] cards = GetCardList(onlyselect);
if (cards == null) if (cards == null)
return; return;
//select save mse-set //select save mse-set
using (SaveFileDialog dlg = new SaveFileDialog()) using (SaveFileDialog dlg = new SaveFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset); dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType); dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
bool isUpdate = false; bool isUpdate = false;
#if DEBUG #if DEBUG
isUpdate=MyMsg.Question(LMSG.OnlySet); isUpdate=MyMsg.Question(LMSG.OnlySet);
#endif #endif
tasker.SetTask(MyTask.SaveAsMSE, cards, tasker.SetTask(MyTask.SaveAsMSE, cards,
dlg.FileName, isUpdate.ToString()); dlg.FileName, isUpdate.ToString());
Run(LanguageHelper.GetMsg(LMSG.SaveMse)); Run(LanguageHelper.GetMsg(LMSG.SaveMse));
} }
} }
} }
#endregion #endregion
#region 导入卡图 #region 导入卡图
void ImportImageFromSelect() void ImportImageFromSelect()
{ {
string tid = tb_cardcode.Text; string tid = tb_cardcode.Text;
if (tid == "0" || tid.Length == 0) if (tid == "0" || tid.Length == 0)
return; return;
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectImage) + "-" + tb_cardname.Text; dlg.Title = LanguageHelper.GetMsg(LMSG.SelectImage) + "-" + tb_cardname.Text;
dlg.Filter = LanguageHelper.GetMsg(LMSG.ImageType); dlg.Filter = LanguageHelper.GetMsg(LMSG.ImageType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
//dlg.FileName; //dlg.FileName;
ImportImage(dlg.FileName, tid); ImportImage(dlg.FileName, tid);
} }
} }
} }
private void pl_image_DoubleClick(object sender, EventArgs e) private void pl_image_DoubleClick(object sender, EventArgs e)
{ {
ImportImageFromSelect(); ImportImageFromSelect();
} }
void Pl_imageDragDrop(object sender, DragEventArgs e) void Pl_imageDragDrop(object sender, DragEventArgs e)
{ {
string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];
if (File.Exists(files[0])) if (File.Exists(files[0]))
ImportImage(files[0], tb_cardcode.Text); ImportImage(files[0], tb_cardcode.Text);
} }
void Pl_imageDragEnter(object sender, DragEventArgs e) void Pl_imageDragEnter(object sender, DragEventArgs e)
{ {
if (e.Data.GetDataPresent(DataFormats.FileDrop)) if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Link; //重要代码:表明是链接类型的数据,比如文件路径 e.Effect = DragDropEffects.Link; //重要代码:表明是链接类型的数据,比如文件路径
else else
e.Effect = DragDropEffects.None; e.Effect = DragDropEffects.None;
} }
private void menuitem_importmseimg_Click(object sender, EventArgs e) private void menuitem_importmseimg_Click(object sender, EventArgs e)
{ {
string tid = tb_cardcode.Text; string tid = tb_cardcode.Text;
menuitem_importmseimg.Checked = !menuitem_importmseimg.Checked; menuitem_importmseimg.Checked = !menuitem_importmseimg.Checked;
SetImage(tid); SetImage(tid);
} }
void ImportImage(string file, string tid) void ImportImage(string file, string tid)
{ {
string f; string f;
if (pl_image.BackgroundImage != null if (pl_image.BackgroundImage != null
&& pl_image.BackgroundImage != m_cover) && pl_image.BackgroundImage != m_cover)
{//释放图片资源 {//释放图片资源
pl_image.BackgroundImage.Dispose(); pl_image.BackgroundImage.Dispose();
pl_image.BackgroundImage = m_cover; pl_image.BackgroundImage = m_cover;
} }
if (menuitem_importmseimg.Checked) if (menuitem_importmseimg.Checked)
{ {
if (!Directory.Exists(tasker.MSEImagePath)) if (!Directory.Exists(tasker.MSEImagePath))
Directory.CreateDirectory(tasker.MSEImagePath); Directory.CreateDirectory(tasker.MSEImagePath);
f = MyPath.Combine(tasker.MSEImagePath, tid + ".jpg"); f = MyPath.Combine(tasker.MSEImagePath, tid + ".jpg");
File.Copy(file, f, true); File.Copy(file, f, true);
} }
else else
{ {
tasker.ToImg(file, ygopath.GetImage(tid), tasker.ToImg(file, ygopath.GetImage(tid),
ygopath.GetImageThum(tid)); ygopath.GetImageThum(tid));
} }
SetImage(tid); SetImage(tid);
} }
public void SetImage(string id) public void SetImage(string id)
{ {
long t; long t;
long.TryParse(id, out t); long.TryParse(id, out t);
SetImage(t); SetImage(t);
} }
public void SetImage(long id) public void SetImage(long id)
{ {
string pic = ygopath.GetImage(id); string pic = ygopath.GetImage(id);
if (menuitem_importmseimg.Checked)//显示MSE图片 if (menuitem_importmseimg.Checked)//显示MSE图片
{ {
string msepic = MseMaker.GetCardImagePath(tasker.MSEImagePath, oldCard); string msepic = MseMaker.GetCardImagePath(tasker.MSEImagePath, oldCard);
if(File.Exists(msepic)) if(File.Exists(msepic))
{ {
pl_image.BackgroundImage = MyBitmap.readImage(msepic); pl_image.BackgroundImage = MyBitmap.readImage(msepic);
} }
} }
else if (File.Exists(pic)) else if (File.Exists(pic))
{ {
pl_image.BackgroundImage = MyBitmap.readImage(pic); pl_image.BackgroundImage = MyBitmap.readImage(pic);
} }
else else
pl_image.BackgroundImage = m_cover; pl_image.BackgroundImage = m_cover;
} }
void Menuitem_convertimageClick(object sender, EventArgs e) void Menuitem_convertimageClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (isRun()) if (isRun())
return; return;
using (FolderBrowserDialog fdlg = new FolderBrowserDialog()) using (FolderBrowserDialog fdlg = new FolderBrowserDialog())
{ {
fdlg.Description = LanguageHelper.GetMsg(LMSG.SelectImagePath); fdlg.Description = LanguageHelper.GetMsg(LMSG.SelectImagePath);
if (fdlg.ShowDialog() == DialogResult.OK) if (fdlg.ShowDialog() == DialogResult.OK)
{ {
bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage); bool isreplace = MyMsg.Question(LMSG.IfReplaceExistingImage);
tasker.SetTask(MyTask.ConvertImages, null, tasker.SetTask(MyTask.ConvertImages, null,
fdlg.SelectedPath, ygopath.gamepath, isreplace.ToString()); fdlg.SelectedPath, ygopath.gamepath, isreplace.ToString());
Run(LanguageHelper.GetMsg(LMSG.ConvertImage)); Run(LanguageHelper.GetMsg(LMSG.ConvertImage));
} }
} }
} }
#endregion #endregion
#region 导出数据包 #region 导出数据包
void Menuitem_exportdataClick(object sender, EventArgs e) void Menuitem_exportdataClick(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (isRun()) if (isRun())
return; return;
using (SaveFileDialog dlg = new SaveFileDialog()) using (SaveFileDialog dlg = new SaveFileDialog())
{ {
dlg.InitialDirectory = ygopath.gamepath; dlg.InitialDirectory = ygopath.gamepath;
dlg.Filter = "Zip|(*.zip|All Files(*.*)|*.*"; dlg.Filter = "Zip|(*.zip|All Files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
tasker.SetTask(MyTask.ExportData, tasker.SetTask(MyTask.ExportData,
GetCardList(false), GetCardList(false),
ygopath.gamepath, dlg.FileName); ygopath.gamepath, dlg.FileName);
Run(LanguageHelper.GetMsg(LMSG.ExportData)); Run(LanguageHelper.GetMsg(LMSG.ExportData));
} }
} }
} }
#endregion #endregion
#region 对比数据 #region 对比数据
/// <summary> /// <summary>
/// 数据一致,返回true,不存在和数据不同,则返回false /// 数据一致,返回true,不存在和数据不同,则返回false
/// </summary> /// </summary>
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; continue;
//data数据不一样 //data数据不一样
if (checkinfo) if (checkinfo)
return card.EqualsData(c); return card.EqualsData(c);
else else
return true; return true;
} }
return false; return false;
} }
//读取将要对比的数据 //读取将要对比的数据
Card[] getCompCards() Card[] getCompCards()
{ {
if (tmpCodes.Count == 0) if (tmpCodes.Count == 0)
return null; return null;
if (!CheckOpen()) if (!CheckOpen())
return null; return null;
return DataBase.Read(nowCdbFile, true, tmpCodes.ToArray()); return DataBase.Read(nowCdbFile, true, tmpCodes.ToArray());
} }
public void CompareCards(string cdbfile, bool checktext) public void CompareCards(string cdbfile, bool checktext)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
tmpCodes.Clear(); tmpCodes.Clear();
srcCard = new Card(); srcCard = new Card();
Card[] mcards = DataBase.Read(nowCdbFile, true, ""); Card[] mcards = DataBase.Read(nowCdbFile, true, "");
Card[] cards = DataBase.Read(cdbfile, true, ""); Card[] cards = DataBase.Read(cdbfile, true, "");
foreach (Card card in mcards) foreach (Card card in mcards)
{ {
if (!CheckCard(cards, card, checktext))//添加到id集合 if (!CheckCard(cards, card, checktext))//添加到id集合
tmpCodes.Add(card.id.ToString()); tmpCodes.Add(card.id.ToString());
} }
if (tmpCodes.Count == 0) if (tmpCodes.Count == 0)
{ {
SetCards(null, false); SetCards(null, false);
return; return;
} }
SetCards(getCompCards(), false); SetCards(getCompCards(), false);
} }
#endregion #endregion
#region MSE配置菜单 #region MSE配置菜单
//把文件添加到菜单 //把文件添加到菜单
void AddMenuItemFormMSE() void AddMenuItemFormMSE()
{ {
if(!Directory.Exists(datapath)) if(!Directory.Exists(datapath))
return; return;
menuitem_mseconfig.DropDownItems.Clear();//清空 menuitem_mseconfig.DropDownItems.Clear();//清空
string[] files = Directory.GetFiles(datapath); string[] files = Directory.GetFiles(datapath);
foreach (string file in files) foreach (string file in files)
{ {
string name = MyPath.getFullFileName(MSEConfig.TAG, file); string name = MyPath.getFullFileName(MSEConfig.TAG, file);
//是否是MSE配置文件 //是否是MSE配置文件
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
continue; continue;
//菜单文字是语言 //菜单文字是语言
ToolStripMenuItem tsmi = new ToolStripMenuItem(name); ToolStripMenuItem tsmi = new ToolStripMenuItem(name);
tsmi.ToolTipText = file;//提示文字为真实路径 tsmi.ToolTipText = file;//提示文字为真实路径
tsmi.Click += SetMseConfig_Click; tsmi.Click += SetMseConfig_Click;
if (msecfg.configName.Equals(name, StringComparison.OrdinalIgnoreCase)) if (msecfg.configName.Equals(name, StringComparison.OrdinalIgnoreCase))
tsmi.Checked = true;//如果是当前,则打勾 tsmi.Checked = true;//如果是当前,则打勾
menuitem_mseconfig.DropDownItems.Add(tsmi); menuitem_mseconfig.DropDownItems.Add(tsmi);
} }
} }
void SetMseConfig_Click(object sender, EventArgs e) void SetMseConfig_Click(object sender, EventArgs e)
{ {
if (isRun())//正在执行任务 if (isRun())//正在执行任务
return; return;
if (sender is ToolStripMenuItem) if (sender is ToolStripMenuItem)
{ {
ToolStripMenuItem tsmi = (ToolStripMenuItem)sender; ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
//读取新的配置 //读取新的配置
msecfg.SetConfig(tsmi.ToolTipText, datapath); msecfg.SetConfig(tsmi.ToolTipText, datapath);
//刷新菜单 //刷新菜单
AddMenuItemFormMSE(); AddMenuItemFormMSE();
//保存配置 //保存配置
MyConfig.Save(MyConfig.TAG_MSE, tsmi.Text); MyConfig.Save(MyConfig.TAG_MSE, tsmi.Text);
} }
} }
#endregion #endregion
#region 查找lua函数 #region 查找lua函数
private void menuitem_findluafunc_Click(object sender, EventArgs e) private void menuitem_findluafunc_Click(object sender, EventArgs e)
{ {
string funtxt = MyPath.Combine(datapath, MyConfig.FILE_FUNCTION); string funtxt = MyPath.Combine(datapath, MyConfig.FILE_FUNCTION);
using (FolderBrowserDialog fd = new FolderBrowserDialog()) using (FolderBrowserDialog fd = new FolderBrowserDialog())
{ {
fd.Description = "Folder Name: ocgcore"; fd.Description = "Folder Name: ocgcore";
if (fd.ShowDialog() == DialogResult.OK) if (fd.ShowDialog() == DialogResult.OK)
{ {
LuaFunction.Read(funtxt);//先读取旧函数列表 LuaFunction.Read(funtxt);//先读取旧函数列表
LuaFunction.Find(fd.SelectedPath);//查找新函数,并保存 LuaFunction.Find(fd.SelectedPath);//查找新函数,并保存
MessageBox.Show("OK"); MessageBox.Show("OK");
} }
} }
} }
#endregion #endregion
#region 系列名textbox #region 系列名textbox
//系列名输入时 //系列名输入时
void setCode_InputText(int index, ComboBox cb, TextBox tb) void setCode_InputText(int index, ComboBox cb, TextBox tb)
{ {
if(index>=0 && index < setcodeIsedit.Length) if(index>=0 && index < setcodeIsedit.Length)
{ {
if (setcodeIsedit[index])//如果正在编辑 if (setcodeIsedit[index])//如果正在编辑
return; return;
setcodeIsedit[index] = true; setcodeIsedit[index] = true;
int temp; int temp;
int.TryParse(tb.Text, NumberStyles.HexNumber, null, out temp); int.TryParse(tb.Text, NumberStyles.HexNumber, null, out temp);
//tb.Text = temp.ToString("x"); //tb.Text = temp.ToString("x");
if (temp == 0 && (tb.Text != "0" || tb.Text.Length == 0)) if (temp == 0 && (tb.Text != "0" || tb.Text.Length == 0))
temp = -1; temp = -1;
SetSelect(cb, temp); SetSelect(cb, temp);
setcodeIsedit[index] = false; setcodeIsedit[index] = false;
} }
} }
private void tb_setcode1_TextChanged(object sender, EventArgs e) private void tb_setcode1_TextChanged(object sender, EventArgs e)
{ {
setCode_InputText(1, cb_setname1, tb_setcode1); setCode_InputText(1, cb_setname1, tb_setcode1);
} }
private void tb_setcode2_TextChanged(object sender, EventArgs e) private void tb_setcode2_TextChanged(object sender, EventArgs e)
{ {
setCode_InputText(2, cb_setname2, tb_setcode2); setCode_InputText(2, cb_setname2, tb_setcode2);
} }
private void tb_setcode3_TextChanged(object sender, EventArgs e) private void tb_setcode3_TextChanged(object sender, EventArgs e)
{ {
setCode_InputText(3, cb_setname3, tb_setcode3); setCode_InputText(3, cb_setname3, tb_setcode3);
} }
private void tb_setcode4_TextChanged(object sender, EventArgs e) private void tb_setcode4_TextChanged(object sender, EventArgs e)
{ {
setCode_InputText(4, cb_setname4, tb_setcode4); setCode_InputText(4, cb_setname4, tb_setcode4);
} }
#endregion #endregion
#region 系列名comobox #region 系列名comobox
//系列选择框 选择时 //系列选择框 选择时
void setCode_Selected(int index, ComboBox cb, TextBox tb) void setCode_Selected(int index, ComboBox cb, TextBox tb)
{ {
if (index >= 0 && index < setcodeIsedit.Length) if (index >= 0 && index < setcodeIsedit.Length)
{ {
if (setcodeIsedit[index])//如果正在编辑 if (setcodeIsedit[index])//如果正在编辑
return; return;
setcodeIsedit[index] = true; setcodeIsedit[index] = true;
long tmp = GetSelect(cb); long tmp = GetSelect(cb);
tb.Text = tmp.ToString("x"); tb.Text = tmp.ToString("x");
setcodeIsedit[index] = false; setcodeIsedit[index] = false;
} }
} }
private void cb_setname1_SelectedIndexChanged(object sender, EventArgs e) private void cb_setname1_SelectedIndexChanged(object sender, EventArgs e)
{ {
setCode_Selected(1, cb_setname1, tb_setcode1); setCode_Selected(1, cb_setname1, tb_setcode1);
} }
private void cb_setname2_SelectedIndexChanged(object sender, EventArgs e) private void cb_setname2_SelectedIndexChanged(object sender, EventArgs e)
{ {
setCode_Selected(2, cb_setname2, tb_setcode2); setCode_Selected(2, cb_setname2, tb_setcode2);
} }
private void cb_setname3_SelectedIndexChanged(object sender, EventArgs e) private void cb_setname3_SelectedIndexChanged(object sender, EventArgs e)
{ {
setCode_Selected(3, cb_setname3, tb_setcode3); setCode_Selected(3, cb_setname3, tb_setcode3);
} }
private void cb_setname4_SelectedIndexChanged(object sender, EventArgs e) private void cb_setname4_SelectedIndexChanged(object sender, EventArgs e)
{ {
setCode_Selected(4, cb_setname4, tb_setcode4); setCode_Selected(4, cb_setname4, tb_setcode4);
} }
#endregion #endregion
#region 读取MSE存档 #region 读取MSE存档
private void menuitem_readmse_Click(object sender, EventArgs e) private void menuitem_readmse_Click(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
if (isRun()) if (isRun())
return; return;
//select open mse-set //select open mse-set
using (OpenFileDialog dlg = new OpenFileDialog()) using (OpenFileDialog dlg = new OpenFileDialog())
{ {
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset); dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType); dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
bool isUpdate = false;//是否替换存在的图片 bool isUpdate = false;//是否替换存在的图片
isUpdate = MyMsg.Question(LMSG.IfReplaceExistingImage); isUpdate = MyMsg.Question(LMSG.IfReplaceExistingImage);
tasker.SetTask(MyTask.ReadMSE, null, tasker.SetTask(MyTask.ReadMSE, null,
dlg.FileName, isUpdate.ToString()); dlg.FileName, isUpdate.ToString());
Run(LanguageHelper.GetMsg(LMSG.ReadMSE)); Run(LanguageHelper.GetMsg(LMSG.ReadMSE));
} }
} }
} }
#endregion #endregion
#region 压缩数据库 #region 压缩数据库
private void menuitem_compdb_Click(object sender, EventArgs e) private void menuitem_compdb_Click(object sender, EventArgs e)
{ {
if (!CheckOpen()) if (!CheckOpen())
return; return;
DataBase.Compression(nowCdbFile); DataBase.Compression(nowCdbFile);
MyMsg.Show(LMSG.CompDBOK); MyMsg.Show(LMSG.CompDBOK);
} }
#endregion #endregion
#region 设置 #region 设置
//删除卡片的时候,是否要删除图片和脚本 //删除卡片的时候,是否要删除图片和脚本
private void menuitem_deletecardsfile_Click(object sender, EventArgs e) private void menuitem_deletecardsfile_Click(object sender, EventArgs e)
{ {
menuitem_operacardsfile.Checked = !menuitem_operacardsfile.Checked; menuitem_operacardsfile.Checked = !menuitem_operacardsfile.Checked;
MyConfig.Save(MyConfig.TAG_DELETE_WITH, menuitem_operacardsfile.Checked.ToString().ToLower()); MyConfig.Save(MyConfig.TAG_DELETE_WITH, menuitem_operacardsfile.Checked.ToString().ToLower());
} }
//用CodeEditor打开lua //用CodeEditor打开lua
private void menuitem_openfileinthis_Click(object sender, EventArgs e) private void menuitem_openfileinthis_Click(object sender, EventArgs e)
{ {
menuitem_openfileinthis.Checked = !menuitem_openfileinthis.Checked; menuitem_openfileinthis.Checked = !menuitem_openfileinthis.Checked;
MyConfig.Save(MyConfig.TAG_OPEN_IN_THIS, menuitem_openfileinthis.Checked.ToString().ToLower()); MyConfig.Save(MyConfig.TAG_OPEN_IN_THIS, menuitem_openfileinthis.Checked.ToString().ToLower());
} }
//自动检查更新 //自动检查更新
private void menuitem_autocheckupdate_Click(object sender, EventArgs e) private void menuitem_autocheckupdate_Click(object sender, EventArgs e)
{ {
...@@ -1622,5 +1622,24 @@ void SetLanguage_Click(object sender, EventArgs e) ...@@ -1622,5 +1622,24 @@ void SetLanguage_Click(object sender, EventArgs e)
} }
} }
#endregion #endregion
}
//把mse存档导出为图片
void Menuitem_exportMSEimageClick(object sender, EventArgs e)
{
if (isRun())
return;
//select open mse-set
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
if (dlg.ShowDialog() == DialogResult.OK)
{
string mseset=dlg.FileName;
string msepath=MyConfig.readString(MyConfig.TAG_MSE_PATH);
MseMaker.exportSet(msepath, mseset, MyPath.Combine(Application.StartupPath, "cache"));
}
}
}
}
} }
...@@ -92,6 +92,8 @@ public enum LMSG : uint ...@@ -92,6 +92,8 @@ public enum LMSG : uint
ReadMSEisOK = 0x48, ReadMSEisOK = 0x48,
PlzRestart = 0x49, PlzRestart = 0x49,
exportMseImages = 0x4a,
exportMseImagesErr = 0x4b,
COUNT, COUNT,
} }
} }
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
// //
// You can specify all the values or you can use the default the Revision and // You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below: // Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("2.3.2.0")] [assembly: AssemblyVersion("2.3.3.0")]
...@@ -45,5 +45,7 @@ ...@@ -45,5 +45,7 @@
<add key="tabisspace" value="false" /> <add key="tabisspace" value="false" />
<add key="fontname" value="Consolas" /> <add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" /> <add key="fontsize" value="14.5" />
<!-- MSE path-->
<add key="mse_path" value="E:\\git\\MagicSetEditor2\\mse.exe"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
★更新历史 ★更新历史
2.3.3.0
一键导出MSE存档为图片。
注意:
仅支持原始大小导出因此还需要调用批量导入功能。
如果卡片数量多,需要的时间很久,请耐心等待。
原理:
图片会在cmd.exe的当前目录,建议先定位到mse.exe的目录。
把E:/test.mse-set替换为存档所在的目录,分隔符必须为/
(win7右键mse目录的空白处,在此打开命令窗口)
mse.exe --export E:/test.mse-set {card.gamecode}.png
2.3.2.0 2.3.2.0
MSE存档的中间图缩放 MSE存档的中间图缩放
2.3.1.4 2.3.1.4
......
...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_saveasmse_select 把选中导为MSE存档 ...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_saveasmse_select 把选中导为MSE存档
DataEditForm.mainMenu.menuitem_saveasmse 把结果导为MSE存档 DataEditForm.mainMenu.menuitem_saveasmse 把结果导为MSE存档
DataEditForm.mainMenu.menuitem_cutimages 批量裁剪卡图 DataEditForm.mainMenu.menuitem_cutimages 批量裁剪卡图
DataEditForm.mainMenu.menuitem_convertimage 批量导入卡图 DataEditForm.mainMenu.menuitem_convertimage 批量导入卡图
DataEditForm.mainMenu.menuitem_exportMSEimage 从MSE存档导出图片
DataEditForm.mainMenu.menuitem_cancelTask 取消任务 DataEditForm.mainMenu.menuitem_cancelTask 取消任务
DataEditForm.mainMenu.menuitem_help 帮助(&H) DataEditForm.mainMenu.menuitem_help 帮助(&H)
DataEditForm.mainMenu.menuitem_about 关于 DataEditForm.mainMenu.menuitem_about 关于
...@@ -156,4 +157,6 @@ MainForm.mainMenu.menuitem_closeall 关闭所有 ...@@ -156,4 +157,6 @@ MainForm.mainMenu.menuitem_closeall 关闭所有
0x46 是否保存脚本? 0x46 是否保存脚本?
0x47 读取MSE存档 0x47 读取MSE存档
0x48 读取MSE存档完成! 0x48 读取MSE存档完成!
0x49 请重启程序使更改生效 0x49 请重启程序使更改生效。
0x4a 从MSE存档导出图片完成。
0x4b 从MSE存档导出图片失败。
...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_cutimages Cut Images ...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_cutimages Cut Images
DataEditForm.mainMenu.menuitem_convertimage Convert Images DataEditForm.mainMenu.menuitem_convertimage Convert Images
DataEditForm.mainMenu.menuitem_importmseimg Set MSE'Image DataEditForm.mainMenu.menuitem_importmseimg Set MSE'Image
DataEditForm.mainMenu.menuitem_cancelTask Cancel Task DataEditForm.mainMenu.menuitem_cancelTask Cancel Task
DataEditForm.mainMenu.menuitem_exportMSEimage export mse-set to images
DataEditForm.mainMenu.menuitem_help Help(&H) DataEditForm.mainMenu.menuitem_help Help(&H)
DataEditForm.mainMenu.menuitem_about About DataEditForm.mainMenu.menuitem_about About
DataEditForm.mainMenu.menuitem_language Laguage DataEditForm.mainMenu.menuitem_language Laguage
...@@ -156,3 +157,5 @@ MainForm.mainMenu.menuitem_closeall Close All ...@@ -156,3 +157,5 @@ MainForm.mainMenu.menuitem_closeall Close All
0x47 Read MSE-set 0x47 Read MSE-set
0x48 Read MSE-set is OK. 0x48 Read MSE-set is OK.
0x49 Please restart program to apply changes. 0x49 Please restart program to apply changes.
0x4a Export Mse-set to Images OK.
0x4b Export Mse-set to Images Fail.
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
# spell = %% # spell = %%
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
# spell = %% # spell = %%
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 200 maxcount = 200
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
spell = [Sepll Card%%] spell = [Sepll Card%%]
trap = [Trap Card%%] trap = [Trap Card%%]
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
spell = %% spell = %%
......
[DataEditorX]2.3.2.0[DataEditorX] [DataEditorX]2.3.3.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment) ★运行环境(Environment)
......
No preview for this file type
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<connectionStrings> <connectionStrings>
<!-- Example connection to a SQL Server Database on localhost. --> <!-- Example connection to a SQL Server Database on localhost. -->
<!-- <add name="ExampleConnectionString" <!-- <add name="ExampleConnectionString"
connectionString="Data Source=.;Initial Catalog=DBName;Integrated Security=True" connectionString="Data Source=.;Initial Catalog=DBName;Integrated Security=True"
providerName="System.Data.SqlClient" /> --> providerName="System.Data.SqlClient" /> -->
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<!-- access these values via the property: <!-- access these values via the property:
System.Configuration.ConfigurationManager.AppSettings[key] System.Configuration.ConfigurationManager.AppSettings[key]
--> -->
<!-- auto enter length --> <!-- auto enter length -->
<add key="autolength" value="30" /> <add key="autolength" value="30" />
<!-- MSE language data/mse_xxx.txt --> <!-- MSE language data/mse_xxx.txt -->
<add key="mse" value="Chinese-Simplified" /> <add key="mse" value="Chinese-Simplified" />
<!-- Language data/cardinfo_xxxx.txt data/language_xxx.txt --> <!-- Language data/cardinfo_xxxx.txt data/language_xxx.txt -->
<add key="language" value="english" /> <add key="language" value="Chinese" />
<!-- Check system language when running program first time --> <!-- Check system language when running program first time -->
<add key="check_system_language" value="true" /> <add key="check_system_language" value="false" />
<!-- async load data --> <!-- async load data -->
<add key="async" value="false" /> <add key="async" value="false" />
<!-- DataEditorX source code --> <!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" /> <add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url--> <!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" /> <add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- delete,modify with card's files image script --> <!-- delete,modify with card's files image script -->
<add key="opera_with_cards_file" value="true" /> <add key="opera_with_cards_file" value="true" />
<!-- open file in this.such as lua --> <!-- open file in this.such as lua -->
<add key="open_file_in_this" value="true" /> <add key="open_file_in_this" value="true" />
<!-- check update when opening application automatically --> <!-- check update when opening application automatically -->
<add key="auto_check_update" value="true" /> <add key="auto_check_update" value="true" />
<!-- Cut Images Setting --> <!-- Cut Images Setting -->
<add key="image_quilty" value="100" /> <add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" /> <add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" /> <add key="image_other" value="25,54,128,128" />
<add key="image_xyz" value="24,51,128,128" /> <add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" /> <add key="image_pendulum" value="14,46,149,120" />
<!-- CodeEdiotr Setting <!-- CodeEdiotr Setting
IME = true 使用輸入法,正常顯示文字,反應變慢 IME = true 使用輸入法,正常顯示文字,反應變慢
IME = false English IME = false English
--> -->
<add key="IME" value="false" /> <add key="IME" value="false" />
<add key="wordwrap" value="true" /> <add key="wordwrap" value="true" />
<add key="tabisspace" value="false" /> <add key="tabisspace" value="false" />
<add key="fontname" value="Consolas" /> <add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" /> <add key="fontsize" value="14.5" />
</appSettings> <!-- MSE path-->
<add key="mse_path" value="E:\\git\\MagicSetEditor2\\mse.exe" />
</appSettings>
</configuration> </configuration>
\ No newline at end of file
★更新历史 ★更新历史
2.3.3.0
一键导出MSE存档为图片。
注意:
仅支持原始大小导出因此还需要调用批量导入功能。
如果卡片数量多,需要的时间很久,请耐心等待。
原理:
图片会在cmd.exe的当前目录,建议先定位到mse.exe的目录。
把E:/test.mse-set替换为存档所在的目录,分隔符必须为/
(win7右键mse目录的空白处,在此打开命令窗口)
mse.exe --export E:/test.mse-set {card.gamecode}.png
2.3.2.0 2.3.2.0
MSE存档的中间图缩放 MSE存档的中间图缩放
2.3.1.4 2.3.1.4
......
...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_saveasmse_select 把选中导为MSE存档 ...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_saveasmse_select 把选中导为MSE存档
DataEditForm.mainMenu.menuitem_saveasmse 把结果导为MSE存档 DataEditForm.mainMenu.menuitem_saveasmse 把结果导为MSE存档
DataEditForm.mainMenu.menuitem_cutimages 批量裁剪卡图 DataEditForm.mainMenu.menuitem_cutimages 批量裁剪卡图
DataEditForm.mainMenu.menuitem_convertimage 批量导入卡图 DataEditForm.mainMenu.menuitem_convertimage 批量导入卡图
DataEditForm.mainMenu.menuitem_exportMSEimage 从MSE存档导出图片
DataEditForm.mainMenu.menuitem_cancelTask 取消任务 DataEditForm.mainMenu.menuitem_cancelTask 取消任务
DataEditForm.mainMenu.menuitem_help 帮助(&H) DataEditForm.mainMenu.menuitem_help 帮助(&H)
DataEditForm.mainMenu.menuitem_about 关于 DataEditForm.mainMenu.menuitem_about 关于
...@@ -156,4 +157,6 @@ MainForm.mainMenu.menuitem_closeall 关闭所有 ...@@ -156,4 +157,6 @@ MainForm.mainMenu.menuitem_closeall 关闭所有
0x46 是否保存脚本? 0x46 是否保存脚本?
0x47 读取MSE存档 0x47 读取MSE存档
0x48 读取MSE存档完成! 0x48 读取MSE存档完成!
0x49 请重启程序使更改生效 0x49 请重启程序使更改生效。
0x4a 从MSE存档导出图片完成。
0x4b 从MSE存档导出图片失败。
...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_cutimages Cut Images ...@@ -56,6 +56,7 @@ DataEditForm.mainMenu.menuitem_cutimages Cut Images
DataEditForm.mainMenu.menuitem_convertimage Convert Images DataEditForm.mainMenu.menuitem_convertimage Convert Images
DataEditForm.mainMenu.menuitem_importmseimg Set MSE'Image DataEditForm.mainMenu.menuitem_importmseimg Set MSE'Image
DataEditForm.mainMenu.menuitem_cancelTask Cancel Task DataEditForm.mainMenu.menuitem_cancelTask Cancel Task
DataEditForm.mainMenu.menuitem_exportMSEimage export mse-set to images
DataEditForm.mainMenu.menuitem_help Help(&H) DataEditForm.mainMenu.menuitem_help Help(&H)
DataEditForm.mainMenu.menuitem_about About DataEditForm.mainMenu.menuitem_about About
DataEditForm.mainMenu.menuitem_language Laguage DataEditForm.mainMenu.menuitem_language Laguage
...@@ -156,3 +157,5 @@ MainForm.mainMenu.menuitem_closeall Close All ...@@ -156,3 +157,5 @@ MainForm.mainMenu.menuitem_closeall Close All
0x47 Read MSE-set 0x47 Read MSE-set
0x48 Read MSE-set is OK. 0x48 Read MSE-set is OK.
0x49 Please restart program to apply changes. 0x49 Please restart program to apply changes.
0x4a Export Mse-set to Images OK.
0x4b Export Mse-set to Images Fail.
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
# spell = %% # spell = %%
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
# spell = %% # spell = %%
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 200 maxcount = 200
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
spell = [Sepll Card%%] spell = [Sepll Card%%]
trap = [Trap Card%%] trap = [Trap Card%%]
......
...@@ -8,8 +8,10 @@ cn2tw = false ...@@ -8,8 +8,10 @@ cn2tw = false
maxcount = 0 maxcount = 0
imagepath = ./Images imagepath = ./Images
########################### 中间图 ########################### 中间图
width = 345 width = 319
height = 346 height = 317
pwidth = 363
pheight= 275
########################### Spell/Trap ########################### Spell/Trap
#jp setting #jp setting
spell = %% spell = %%
......
[DataEditorX]2.3.2.0[DataEditorX] [DataEditorX]2.3.3.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL] [URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment) ★运行环境(Environment)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment