Commit ccf4f16b authored by 247321453's avatar 247321453

add

parent a499a399
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 17:01
*
*/
using System;
using System.Data.SQLite;
namespace DataEditorX.Core
{
/// <summary>
/// Description of SQLite.
/// </summary>
public class CDB
{
}
}
......@@ -15,12 +15,13 @@ public struct Card : IEquatable<Card>
/// </summary>
/// <param name="cardCode">密码</param>
/// <param name="cardName">名字</param>
public Card(int cardCode,string cardName)
public Card(int cardCode)
{
int i;
this.id = cardCode;
this.name="";
this.ot = 0;
this.alias = 0;
this.name = cardName;
this.setcode = 0;
this.type = 0;
this.atk = 0;
......@@ -31,65 +32,39 @@ public Card(int cardCode,string cardName)
this.category = 0;
this.desc = "";
this.str = new string[0x10];
for(i=0;i<0x10;i++)
str[i]="";
}
#endregion
#region 成员
/// <summary>
/// 卡片密码
/// </summary>
public int id;
/// <summary>
/// 卡片规则
/// </summary>
/// <summary>卡片密码</summary>
public long id;
/// <summary>卡片规则</summary>
public int ot;
/// <summary>
/// 卡片同名卡
/// </summary>
public int alias;
/// <summary>
/// 卡片系列号
/// </summary>
public ulong setcode;
/// <summary>
/// 卡片种类
/// </summary>
/// <summary>卡片同名卡</summary>
public long alias;
/// <summary>卡片系列号</summary>
public long setcode;
/// <summary>卡片种类</summary>
public long type;
/// <summary>
/// 攻击力
/// </summary>
/// <summary>攻击力</summary>
public int atk;
/// <summary>
/// 防御力
/// </summary>
/// <summary>防御力</summary>
public int def;
/// <summary>
/// 卡片等级
/// </summary>
public int level;
/// <summary>
/// 卡片种族
/// </summary>
public int race;
/// <summary>
/// 卡片属性
/// </summary>
/// <summary>卡片等级</summary>
public long level;
/// <summary>卡片种族</summary>
public long race;
/// <summary>卡片属性</summary>
public int attribute;
/// <summary>
/// 效果种类
/// </summary>
/// <summary>效果种类</summary>
public long category;
/// <summary>
/// 卡片名称
/// </summary>
/// <summary>卡片名称</summary>
public string name;
/// <summary>
/// 描述文本
/// </summary>
/// <summary>描述文本</summary>
public string desc;
/// <summary>
/// 脚本文件组
/// </summary>
/// <summary>脚本文件组</summary>
public string[] str;
#endregion
......@@ -187,156 +162,7 @@ public override int GetHashCode()
{
return !left.Equals(right);
}
/// <summary>
/// 左边接近右边
/// </summary>
/// <param name="left">卡片1</param>
/// <param name="right">卡片2</param>
/// <returns></returns>
public static bool operator >(Card left, Card right)
{
return left.Like(right);
}
/// <summary>
/// 左边接近右边
/// </summary>
/// <param name="left">卡片1</param>
/// <param name="right">卡片2</param>
/// <returns></returns>
public static bool operator >=(Card left, Card right)
{
return left.Like(right);
}
/// <summary>
/// 左边不接近右边
/// </summary>
/// <param name="left">卡片1</param>
/// <param name="right">卡片2</param>
/// <returns></returns>
public static bool operator <(Card left, Card right)
{
return !left.Like(right);
}
/// <summary>
/// 左边不接近右边
/// </summary>
/// <param name="left">卡片1</param>
/// <param name="right">卡片2</param>
/// <returns></returns>
public static bool operator <=(Card left, Card right)
{
return !left.Like(right);
}
#endregion
#region 卡片过滤
/// <summary>
/// 卡片是否符合searchCard卡片?
/// 0请用-1代替
/// ?用-2代替
/// 密码大于0,同名小于0=搜索密码大于密码
/// 密码大于0,同名等于0=搜索密码等于密码
/// 密码小于0,同名大于0=搜索同名大于同名
/// 密码等于0,同名大于0=搜索同名等于同名
/// 密码大于0,同名大于0=搜索密码大于密码,小于同名
/// </summary>
/// <param name="searchCard">过滤卡片</param>
/// <returns>是否符合</returns>
public bool Like(Card searchCard)
{
if (!CheckCode(this.id, this.alias, searchCard.id, searchCard.alias))
return false;
if (!CheckString(this.name, searchCard.name))
return false;
if (!CheckString(this.desc, searchCard.desc))
return false;
if (!CheckNumber(this.atk, searchCard.atk))
return false;
if (!CheckNumber(this.def, searchCard.def))
return false;
if (!CheckNumber(this.ot, searchCard.ot))
return false;
if (!CheckNumber(this.attribute, searchCard.attribute))
return false;
if (!CheckNumber(this.race, searchCard.race))
return false;
if (!CheckNumber(this.level&0xff, searchCard.level&0xff))
return false;
if (!CheckNumber2(this.type, searchCard.type))
return false;
if (!CheckNumber2(this.category, searchCard.category))
return false;
if (!CheckSetcode(this.setcode, searchCard.setcode))
return false;
return true;
}
private bool CheckString(string str1, string str2)
{
if (str2 == null || str2.Length == 0)
return true;
else if (str1.IndexOf(str2) >= 0)
return true;
else
return false;
}
private bool CheckNumber(int num1, int num2)
{
if (num2 == 0)//default
return true;
else if (num2 == -1 && num1 == 0)//search 0
return true;
else if (num1 == num2)//search -2 && >0
return true;
else
return false;
}
private bool CheckSetcode(ulong num1,ulong num2)
{
if (num2 <= 0)//default
return true;
else if (num1 == 0 && num2 > 0)
return false;
//setcode1[0-3]==setcode2[0-3]
else if ((num1 & 0xffff) == num2 && num2 < 0xffff)
return true;
//setcode1[4-7]==setcode2[4-7]
else if ((num1 >> 0x10) == num2 && num2 < 0xffff)
return true;
else if (num1 == num2)
return true;
else if (((num1 & 0xffff) == (num2 >> 0x10)) &&
((num1 >> 0x10) == (num2 & 0xffff)))
return true;
else
return false;
}
private bool CheckNumber2(long num1, long num2)
{
if (num2 == 0)
return true;
else if ((num1 & num2) == num2)
return true;
else
return false;
}
private bool CheckCode(int code1, int alias1, int code2, int alias2)
{
if (alias2 == 0 && code2 == 0)
return true;
else if (alias2 == 0 && code1 == code2)//code1=code2
return true;
else if (alias2 < 0 && code1 >= code2)//code1>=code2
return true;
else if (code2 == 0 && (alias1 == alias2 || code1 == alias2))//alias1==alias2
return true;
else if (code2 < 0 && code1 <= alias2)//alias1>=alias2
return true;
//cod1>=code2 && code1<=alias2
else if (code2 > 0 && alias2 > 0 && code1 >= code2 && code1 <= alias2)
return true;
else
return false;
}
#endregion
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 20:53
*
*/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DataEditorX.Core
{
/// <summary>
/// Description of CheckPanel.
/// </summary>
public class CheckPanel : FlowLayoutPanel
{
Dictionary<long, string> m_dic=null;
List<CheckBox> checkBoxList;
public CheckPanel()
{
checkBoxList=new List<CheckBox>();
m_dic=new Dictionary<long, string>();
}
public void SetDic(Dictionary<long, string> dic)
{
m_dic=dic;
}
public bool Init()
{
if(m_dic==null)
return false;
this.Controls.Clear();
checkBoxList.Clear();
this.SuspendLayout();
int i=0;
foreach(string str in m_dic.Values)
{
i++;
if(str=="N/A")
continue;
CheckBox cbox=new CheckBox();
cbox.Name = "cbox"+i.ToString();
cbox.TabIndex =i;
cbox.AutoSize = true;
cbox.Margin=new Padding(1,2,1,2);
cbox.Text=str;
checkBoxList.Add(cbox);
}
this.Controls.AddRange(checkBoxList.ToArray());
this.ResumeLayout(false);
this.PerformLayout();
return true;
}
public void SetNumber(long num)
{
}
public long GetNumber()
{
return 0;
}
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 17:01
*
*/
using System;
using System.Data.SQLite;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace DataEditorX.Core
{
/// <summary>
/// Description of SQLite.
/// </summary>
public static class DataBase
{
#region 默认
static string defaultSQL;
static string defaultTableSQL;
static DataBase()
{
defaultSQL =
"SELECT datas.*,texts.* FROM datas,texts WHERE datas.id=texts.id ";
StringBuilder st = new StringBuilder();
st.Append(@"CREATE TABLE texts(id integer primary key,name text,desc text");
for ( int i = 1; i <= 16; i++ )
{
st.Append(",str");
st.Append(i.ToString());
st.Append(" text");
}
st.Append(");");
st.Append(@"CREATE TABLE datas(");
st.Append("id integer primary key,ot integer,alias integer,");
st.Append("setcode integer,type integer,atk integer,def integer,");
st.Append("level integer,race integer,attribute integer,category integer) ");
defaultTableSQL=st.ToString();
st.Remove(0,st.Length);
st=null;
}
#endregion
#region 创建数据库
/// <summary>
/// 创建数据库
/// </summary>
/// <param name="Db">新数据库路径</param>
public static void Create(string Db)
{
if ( File.Exists(Db) )
File.Delete(Db);
try{
SQLiteConnection.CreateFile(Db);
Command(Db, defaultTableSQL);
}
catch(Exception exc)
{
File.AppendAllText("System.Data.SQLite.log", exc.Source+"\n"+
exc.TargetSite+"\n"+exc.Message+"\n"+exc.ToString());
}
}
#endregion
#region 执行sql语句
/// <summary>
/// 执行sql语句
/// </summary>
/// <param name="DB">数据库</param>
/// <param name="SQLs">sql语句</param>
/// <returns>返回影响行数</returns>
public static int Command(string DB, params string[] SQLs)
{
int result = 0;
if ( File.Exists(DB) && SQLs != null )
{
using ( SQLiteConnection con = new SQLiteConnection(@"Data Source=" + DB) )
{
con.Open();
using ( SQLiteTransaction trans = con.BeginTransaction() )
{
try
{
using ( SQLiteCommand cmd = new SQLiteCommand(con) )
{
foreach ( string SQLstr in SQLs )
{
cmd.CommandText = SQLstr;
result += cmd.ExecuteNonQuery();
}
}
}
catch(Exception exc)
{
File.AppendAllText("System.Data.SQLite.log", exc.Source+"\n"+
exc.TargetSite+"\n"+exc.Message+"\n"+exc.ToString());
trans.Rollback();
result = -1;
}
finally
{
trans.Commit();
}
}
con.Close();
}
}
return result;
}
#endregion
#region 数据读取
#region 根据SQL读取
static Card ReadCard(SQLiteDataReader reader,bool reNewLine)
{
Card c = new Card(0);
c.id = reader.GetInt64(0);
c.ot = reader.GetInt32(1);
c.alias = reader.GetInt64(2);
c.setcode = reader.GetInt64(3);
c.type = reader.GetInt64(4);
c.atk = reader.GetInt32(5);
c.def = reader.GetInt32(6);
c.level = reader.GetInt64(7);
c.race = reader.GetInt64(8);
c.attribute = reader.GetInt32(9);
c.category = reader.GetInt64(10);
c.name = reader.GetString(12);
c.desc = reader.GetString(13);
if(reNewLine)
c.desc=Retext(c.desc);
string temp = null;
for ( int i = 0; i < 0x10; i++ )
{
temp = reader.GetString(14 + i);
c.str[i]= ( temp == null ) ? "":temp;
}
return c;
}
static string Retext(string text)
{
StringBuilder sr = new StringBuilder(text);
sr.Replace("\r\n", "\n");
sr.Replace("\n", Environment.NewLine);//换为当前系统的换行符
text = sr.ToString();
sr.Remove(0, sr.Length);
return text;
}
/// <summary>
/// 根据密码集合,读取数据
/// </summary>
/// <param name="DB">数据库</param>
/// <param name="reNewLine">调整换行符</param>
/// <param name="SQLs">SQL/密码语句集合集合</param>
public static Card[] Read(string DB,bool reNewLine, params string[] SQLs)
{
List<Card> list=new List<Card>();
string SQLstr = "";
if ( File.Exists(DB) && SQLs != null )
{
using ( SQLiteConnection sqliteconn = new SQLiteConnection(@"Data Source=" + DB) )
{
sqliteconn.Open();
using ( SQLiteTransaction trans = sqliteconn.BeginTransaction() )
{
using ( SQLiteCommand sqlitecommand = new SQLiteCommand(sqliteconn) )
{
foreach ( string str in SQLs )
{
if ( string.IsNullOrEmpty(str) )
SQLstr = defaultSQL;
else if ( str.Length < 20 )
SQLstr = defaultSQL + " and datas.id=" + str;
else
SQLstr = str;
sqlitecommand.CommandText = SQLstr;
using ( SQLiteDataReader reader = sqlitecommand.ExecuteReader() )
{
while ( reader.Read() )
{
list.Add(ReadCard(reader,reNewLine));
}
reader.Close();
}
}
}
trans.Commit();
}
sqliteconn.Close();
}
}
if(list.Count==0)
return null;
return list.ToArray();
}
#endregion
#region 根据文件读取数据库
public static Card[] ReadYdk(string dbfile, string ydkfile)
{
if ( File.Exists(dbfile) )
{
string[] ids = ReadYDK(ydkfile);
if(ids!=null)
return DataBase.Read(dbfile, true, ids);
}
return null;
}
/// <summary>
/// 读取ydk文件为密码数组
/// </summary>
/// <param name="file">ydk文件</param>
/// <returns>密码数组</returns>
static string[] ReadYDK(string ydkfile)
{
string str;
List<string> IDs = new List<string>();
if ( File.Exists(ydkfile) )
{
using ( FileStream f = new FileStream(ydkfile, FileMode.Open, FileAccess.Read) )
{
StreamReader sr = new StreamReader(f, Encoding.Default);
str = sr.ReadLine();
while ( str != null )
{
if ( !str.StartsWith("!") && !str.StartsWith("#") &&str.Length>0)
{
if ( IDs.IndexOf(str) < 0 )
IDs.Add(str);
}
str = sr.ReadLine();
}
sr.Close();
f.Close();
}
}
if(IDs.Count==0)
return null;
return IDs.ToArray();
}
#endregion
#region 根据图像读取数据库
public static Card[] ReadImage(string dbfile, string path)
{
if ( File.Exists(dbfile) )
{
string[] files = Directory.GetFiles(path, "*.jpg");
int n = files.Length;
for ( int i = 0; i < n; i++ )
{
files[i] = Path.GetFileNameWithoutExtension(files[i]);
}
return DataBase.Read(dbfile, true,files);
}
return null;
}
#endregion
#endregion
#region 复制数据库
/// <summary>
/// 复制数据库
/// </summary>
/// <param name="DB">复制到的数据库</param>
/// <param name="cards">卡片集合</param>
/// <param name="ignore">是否忽略存在</param>
/// <returns>更新数x2</returns>
public static int CopyDB(string DB, bool ignore,params Card[] cards)
{
int result = 0;
if ( File.Exists(DB) &&cards!=null)
{
using ( SQLiteConnection con = new SQLiteConnection(@"Data Source=" + DB) )
{
con.Open();
using ( SQLiteTransaction trans = con.BeginTransaction() )
{
using ( SQLiteCommand cmd = new SQLiteCommand(con) )
{
foreach ( Card c in cards )
{
cmd.CommandText = DataBase.GetInsertSQL(c, ignore);
result += cmd.ExecuteNonQuery();
}
}
trans.Commit();
}
con.Close();
}
}
return result;
}
#endregion
#region SQL语句
#region 查询
public static string GetSelectSQL(Card c)
{
StringBuilder sb=new StringBuilder();
sb.Append("SELECT datas.*,texts.* FROM datas,texts WHERE datas.id=texts.id ");
if(!string.IsNullOrEmpty(c.name))
sb.Append(" and texts.name like '%"+c.name+"%' ");
if(!string.IsNullOrEmpty(c.desc))
sb.Append(" and texts.desc like '%"+c.desc+"%' ");
unchecked{
if(c.ot>0)
sb.Append(" and datas.ot & "+c.ot.ToString()+" = "+c.ot.ToString());
if(c.attribute>0)
sb.Append(" and datas.attribute & "+c.attribute.ToString()+" = "+c.attribute.ToString());
if(c.level>0)
sb.Append(" and datas.level & "+((int)c.level).ToString()+" = "+((int)c.level).ToString());
if(c.race>0)
sb.Append(" and datas.race & "+((int)c.race).ToString()+" = "+((int)c.race).ToString());
if(c.type>0)
sb.Append(" and datas.type & "+((int)c.type).ToString()+" = "+((int)c.type).ToString());
if(c.category>0)
sb.Append(" and datas.category & "+((int)c.category).ToString()+" = "+((int)c.category).ToString());
}
if(c.id>0 && c.alias<0)
sb.Append(" and datas.id >= "+c.id.ToString());
else if(c.id>0 && c.alias>0)
sb.Append(" and datas.id >= "+c.id.ToString()+" and datas.alias >="+c.alias.ToString());
else if(c.id>0)
sb.Append(" and datas.id="+c.id.ToString());
else if(c.alias>0)
sb.Append(" and datas.alias= "+c.alias.ToString());
return sb.ToString();
}
#endregion
#region 插入
/// <summary>
/// 转换为插入语句
/// </summary>
/// <param name="c">卡片数据</param>
/// <returns>SQL语句</returns>
public static string GetInsertSQL(Card c, bool ignore)
{
StringBuilder st = new StringBuilder();
if(ignore)
st.Append("INSERT or ignore into datas values(");
else
st.Append("INSERT into datas values(");
st.Append(c.id.ToString()); st.Append(",");
st.Append(c.ot.ToString()); st.Append(",");
st.Append(c.alias.ToString()); st.Append(",");
st.Append(c.setcode.ToString()); st.Append(",");
st.Append(c.type.ToString()); st.Append(",");
st.Append(c.atk.ToString()); ; st.Append(",");
st.Append(c.def.ToString()); st.Append(",");
st.Append(c.level.ToString()); st.Append(",");
st.Append(c.race.ToString()); st.Append(",");
st.Append(c.attribute.ToString()); st.Append(",");
st.Append(c.category.ToString()); st.Append(")");
st.Append(";INSERT or ignore into texts values(");
st.Append(c.id.ToString()); st.Append(",'");
st.Append(c.name.Replace("'", "''")); st.Append("','");
st.Append(c.desc.Replace("'", "''"));
for ( int i = 0; i < 0x10; i++ )
{
st.Append("','"); st.Append(c.str[i].Replace("'", "''"));
}
st.Append("');");
string sql = st.ToString();
st = null;
return sql;
}
#endregion
#region 更新
/// <summary>
/// 转换为更新语句
/// </summary>
/// <param name="c">卡片数据</param>
/// <returns>SQL语句</returns>
public static string GetUpdateSQL(Card c)
{
StringBuilder st = new StringBuilder();
st.Append("update datas set ot="); st.Append(c.ot.ToString());
st.Append(",alias="); st.Append(c.alias.ToString());
st.Append(",setcode="); st.Append(c.setcode.ToString());
st.Append(",type="); st.Append(c.type.ToString());
st.Append(",atk="); st.Append(c.atk.ToString());
st.Append(",def="); st.Append(c.def.ToString());
st.Append(",level="); st.Append(c.level.ToString());
st.Append(",race="); st.Append(c.race.ToString());
st.Append(",attribute="); st.Append(c.attribute.ToString());
st.Append(",category="); st.Append(c.category.ToString());
st.Append(" where id="); st.Append(c.id.ToString());
st.Append("; update texts set name='"); st.Append(c.name.Replace("'", "''"));
st.Append("',desc='"); st.Append(c.desc.Replace("'", "''")); st.Append("', ");
for ( int i = 0; i < 0x10; i++ )
{
st.Append("str"); st.Append(( i + 1 ).ToString()); st.Append("='");
st.Append(c.str[i].Replace("'", "''"));
if ( i < 15 )
{
st.Append("',");
}
}
st.Append("' where id="); st.Append(c.id.ToString());
st.Append(";");
string sql = st.ToString();
st = null;
return sql;
}
#endregion
#region 删除
/// <summary>
/// 转换删除语句
/// </summary>
/// <param name="c">卡片密码</param>
/// <returns>SQL语句</returns>
public static string GetDeleteSQL(Card c)
{
string id = c.id.ToString();
return "Delete from datas where id=" + id + ";Delete from texts where id=" + id + ";";
}
#endregion
#endregion
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月19 星期一
* 时间: 8:50
*
*/
using System;
namespace System.Windows.Forms
{
public class DListView :ListView
{
public DListView()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint,
true);
UpdateStyles();
}
}
public class DFlowLayoutPanel : FlowLayoutPanel
{
public DFlowLayoutPanel()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint,
true);
UpdateStyles();
}
}
public class DListBox : ListBox
{
public DListBox()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint,
true);
UpdateStyles();
}
}
}
......@@ -35,39 +35,47 @@ protected override void Dispose(bool disposing)
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.文件FToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.打开OToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.保存SToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.另存为ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.复制到ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.导出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.导入ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.读取ydkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.读取图片ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.编辑EToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.撤销ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.还原ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.添加ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.修改ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.删除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.搜索ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.重置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.打开脚本ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启动游戏ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.检查更新ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lv_cardlist = new System.Windows.Forms.ListView();
this.menuitem_file = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_open = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_new = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_save = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_saveas = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_copyto = new System.Windows.Forms.ToolStripMenuItem();
this.tsep1 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_inport = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_export = new System.Windows.Forms.ToolStripMenuItem();
this.tsep2 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_readydk = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_readimages = new System.Windows.Forms.ToolStripMenuItem();
this.tsep3 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_quit = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_edit = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_undo = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_redo = new System.Windows.Forms.ToolStripMenuItem();
this.tsep4 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_add = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_mod = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_del = new System.Windows.Forms.ToolStripMenuItem();
this.tsep5 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_search = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_reset = new System.Windows.Forms.ToolStripMenuItem();
this.tsep6 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_showimage = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_openscript = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_opengame = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_help = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_about = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_checkupdate = new System.Windows.Forms.ToolStripMenuItem();
this.lv_cardlist = new System.Windows.Forms.DListView();
this.ch_cardcode = new System.Windows.Forms.ColumnHeader();
this.ch_cardname = new System.Windows.Forms.ColumnHeader();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cb_cardattribute = new System.Windows.Forms.ComboBox();
this.tb_cardname = new System.Windows.Forms.TextBox();
this.cb_cardrule = new System.Windows.Forms.ComboBox();
......@@ -78,7 +86,7 @@ private void InitializeComponent()
this.cb_setname4 = new System.Windows.Forms.ComboBox();
this.cb_setname3 = new System.Windows.Forms.ComboBox();
this.tb_cardtext = new System.Windows.Forms.TextBox();
this.lb_scripttext = new System.Windows.Forms.ListBox();
this.lb_scripttext = new System.Windows.Forms.DListBox();
this.tb_edittext = new System.Windows.Forms.TextBox();
this.lb_pleft_right = new System.Windows.Forms.Label();
this.tb_pleft = new System.Windows.Forms.TextBox();
......@@ -102,232 +110,268 @@ private void InitializeComponent()
this.btn_lua = new System.Windows.Forms.Button();
this.btn_reset = new System.Windows.Forms.Button();
this.btn_serach = new System.Windows.Forms.Button();
this.pl_cardtype = new DataEditorX.Core.CheckPanel();
this.pl_category = new DataEditorX.Core.CheckPanel();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.btn_redo = new System.Windows.Forms.Button();
this.btn_undo = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.显示卡片图像ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pl_cardtype = new System.Windows.Forms.DFlowLayoutPanel();
this.pl_category = new System.Windows.Forms.DFlowLayoutPanel();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.文件FToolStripMenuItem,
this.编辑EToolStripMenuItem,
this.帮助ToolStripMenuItem});
this.menuitem_file,
this.menuitem_edit,
this.menuitem_help});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(814, 25);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// 文件FToolStripMenuItem
// menuitem_file
//
this.文件FToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.打开OToolStripMenuItem,
this.保存SToolStripMenuItem,
this.另存为ToolStripMenuItem,
this.复制到ToolStripMenuItem,
this.toolStripSeparator1,
this.导出ToolStripMenuItem,
this.导入ToolStripMenuItem,
this.toolStripSeparator3,
this.读取ydkToolStripMenuItem,
this.读取图片ToolStripMenuItem,
this.toolStripSeparator2,
this.退出ToolStripMenuItem});
this.文件FToolStripMenuItem.Name = "文件FToolStripMenuItem";
this.文件FToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.文件FToolStripMenuItem.Text = "文件(&F)";
this.menuitem_file.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_open,
this.menuitem_new,
this.menuitem_save,
this.menuitem_saveas,
this.menuitem_copyto,
this.tsep1,
this.menuitem_inport,
this.menuitem_export,
this.tsep2,
this.menuitem_readydk,
this.menuitem_readimages,
this.tsep3,
this.menuitem_quit});
this.menuitem_file.Name = "menuitem_file";
this.menuitem_file.Size = new System.Drawing.Size(58, 21);
this.menuitem_file.Text = "文件(&F)";
//
// 打开OToolStripMenuItem
// menuitem_open
//
this.打开OToolStripMenuItem.Name = "打开OToolStripMenuItem";
this.打开OToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.打开OToolStripMenuItem.Text = "打开(&O)";
this.menuitem_open.Name = "menuitem_open";
this.menuitem_open.Size = new System.Drawing.Size(124, 22);
this.menuitem_open.Text = "打开(&O)";
this.menuitem_open.Click += new System.EventHandler(this.Menuitem_openClick);
//
// 保存SToolStripMenuItem
// menuitem_new
//
this.保存SToolStripMenuItem.Name = "保存SToolStripMenuItem";
this.保存SToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.保存SToolStripMenuItem.Text = "保存(&S)";
this.menuitem_new.Name = "menuitem_new";
this.menuitem_new.Size = new System.Drawing.Size(124, 22);
this.menuitem_new.Text = "新建(&N)";
this.menuitem_new.Click += new System.EventHandler(this.Menuitem_newClick);
//
// 另存为ToolStripMenuItem
// menuitem_save
//
this.另存为ToolStripMenuItem.Name = "另存为ToolStripMenuItem";
this.另存为ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.另存为ToolStripMenuItem.Text = "另存为";
this.menuitem_save.Name = "menuitem_save";
this.menuitem_save.Size = new System.Drawing.Size(124, 22);
this.menuitem_save.Text = "保存(&S)";
this.menuitem_save.Click += new System.EventHandler(this.Menuitem_saveClick);
//
// 复制到ToolStripMenuItem
// menuitem_saveas
//
this.复制到ToolStripMenuItem.Name = "复制到ToolStripMenuItem";
this.复制到ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.复制到ToolStripMenuItem.Text = "复制到";
this.menuitem_saveas.Name = "menuitem_saveas";
this.menuitem_saveas.Size = new System.Drawing.Size(124, 22);
this.menuitem_saveas.Text = "另存为";
this.menuitem_saveas.Click += new System.EventHandler(this.Menuitem_saveasClick);
//
// toolStripSeparator1
// menuitem_copyto
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(121, 6);
this.menuitem_copyto.Name = "menuitem_copyto";
this.menuitem_copyto.Size = new System.Drawing.Size(124, 22);
this.menuitem_copyto.Text = "复制到";
this.menuitem_copyto.Click += new System.EventHandler(this.Menuitem_copytoClick);
//
// 导出ToolStripMenuItem
// tsep1
//
this.导出ToolStripMenuItem.Name = "导出ToolStripMenuItem";
this.导出ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.导出ToolStripMenuItem.Text = "导出";
this.tsep1.Name = "tsep1";
this.tsep1.Size = new System.Drawing.Size(121, 6);
//
// 导入ToolStripMenuItem
// menuitem_inport
//
this.导入ToolStripMenuItem.Name = "导入ToolStripMenuItem";
this.导入ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.导入ToolStripMenuItem.Text = "导入";
this.menuitem_inport.Name = "menuitem_inport";
this.menuitem_inport.Size = new System.Drawing.Size(124, 22);
this.menuitem_inport.Text = "导出";
this.menuitem_inport.Click += new System.EventHandler(this.Menuitem_inportClick);
//
// toolStripSeparator3
// menuitem_export
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(121, 6);
this.menuitem_export.Name = "menuitem_export";
this.menuitem_export.Size = new System.Drawing.Size(124, 22);
this.menuitem_export.Text = "导入";
this.menuitem_export.Click += new System.EventHandler(this.Menuitem_exportClick);
//
// 读取ydkToolStripMenuItem
// tsep2
//
this.读取ydkToolStripMenuItem.Name = "读取ydkToolStripMenuItem";
this.读取ydkToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.读取ydkToolStripMenuItem.Text = "读取ydk";
this.tsep2.Name = "tsep2";
this.tsep2.Size = new System.Drawing.Size(121, 6);
//
// 读取图片ToolStripMenuItem
// menuitem_readydk
//
this.读取图片ToolStripMenuItem.Name = "读取图片ToolStripMenuItem";
this.读取图片ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.读取图片ToolStripMenuItem.Text = "读取图片";
this.menuitem_readydk.Name = "menuitem_readydk";
this.menuitem_readydk.Size = new System.Drawing.Size(124, 22);
this.menuitem_readydk.Text = "读取ydk";
this.menuitem_readydk.Click += new System.EventHandler(this.Menuitem_readydkClick);
//
// toolStripSeparator2
// menuitem_readimages
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(121, 6);
this.menuitem_readimages.Name = "menuitem_readimages";
this.menuitem_readimages.Size = new System.Drawing.Size(124, 22);
this.menuitem_readimages.Text = "读取图片";
this.menuitem_readimages.Click += new System.EventHandler(this.Menuitem_readimagesClick);
//
// 退出ToolStripMenuItem
// tsep3
//
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.退出ToolStripMenuItem.Text = "退出";
this.tsep3.Name = "tsep3";
this.tsep3.Size = new System.Drawing.Size(121, 6);
//
// 编辑EToolStripMenuItem
// menuitem_quit
//
this.编辑EToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.撤销ToolStripMenuItem,
this.还原ToolStripMenuItem,
this.toolStripSeparator4,
this.添加ToolStripMenuItem,
this.修改ToolStripMenuItem,
this.删除ToolStripMenuItem,
this.toolStripSeparator5,
this.搜索ToolStripMenuItem,
this.重置ToolStripMenuItem,
this.toolStripSeparator6,
this.打开脚本ToolStripMenuItem,
this.启动游戏ToolStripMenuItem,
this.显示卡片图像ToolStripMenuItem});
this.编辑EToolStripMenuItem.Name = "编辑EToolStripMenuItem";
this.编辑EToolStripMenuItem.Size = new System.Drawing.Size(59, 21);
this.编辑EToolStripMenuItem.Text = "编辑(&E)";
this.menuitem_quit.Name = "menuitem_quit";
this.menuitem_quit.Size = new System.Drawing.Size(124, 22);
this.menuitem_quit.Text = "退出";
this.menuitem_quit.Click += new System.EventHandler(this.Menuitem_quitClick);
//
// 撤销ToolStripMenuItem
// menuitem_edit
//
this.撤销ToolStripMenuItem.Name = "撤销ToolStripMenuItem";
this.撤销ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.撤销ToolStripMenuItem.Text = "撤销";
this.menuitem_edit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_undo,
this.menuitem_redo,
this.tsep4,
this.menuitem_add,
this.menuitem_mod,
this.menuitem_del,
this.tsep5,
this.menuitem_search,
this.menuitem_reset,
this.tsep6,
this.menuitem_showimage,
this.menuitem_openscript,
this.menuitem_opengame});
this.menuitem_edit.Name = "menuitem_edit";
this.menuitem_edit.Size = new System.Drawing.Size(59, 21);
this.menuitem_edit.Text = "编辑(&E)";
//
// 还原ToolStripMenuItem
// menuitem_undo
//
this.还原ToolStripMenuItem.Name = "还原ToolStripMenuItem";
this.还原ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.还原ToolStripMenuItem.Text = "还原";
this.menuitem_undo.Name = "menuitem_undo";
this.menuitem_undo.Size = new System.Drawing.Size(152, 22);
this.menuitem_undo.Text = "撤销";
this.menuitem_undo.Click += new System.EventHandler(this.Menuitem_undoClick);
//
// toolStripSeparator4
// menuitem_redo
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(121, 6);
this.menuitem_redo.Name = "menuitem_redo";
this.menuitem_redo.Size = new System.Drawing.Size(152, 22);
this.menuitem_redo.Text = "还原";
this.menuitem_redo.Click += new System.EventHandler(this.Menuitem_redoClick);
//
// 添加ToolStripMenuItem
// tsep4
//
this.添加ToolStripMenuItem.Name = "添加ToolStripMenuItem";
this.添加ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.添加ToolStripMenuItem.Text = "添加";
this.tsep4.Name = "tsep4";
this.tsep4.Size = new System.Drawing.Size(149, 6);
//
// 修改ToolStripMenuItem
// menuitem_add
//
this.修改ToolStripMenuItem.Name = "修改ToolStripMenuItem";
this.修改ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.修改ToolStripMenuItem.Text = "修改";
this.menuitem_add.Name = "menuitem_add";
this.menuitem_add.Size = new System.Drawing.Size(152, 22);
this.menuitem_add.Text = "添加";
this.menuitem_add.Click += new System.EventHandler(this.Menuitem_addClick);
//
// 删除ToolStripMenuItem
// menuitem_mod
//
this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem";
this.删除ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.删除ToolStripMenuItem.Text = "删除";
this.menuitem_mod.Name = "menuitem_mod";
this.menuitem_mod.Size = new System.Drawing.Size(152, 22);
this.menuitem_mod.Text = "修改";
this.menuitem_mod.Click += new System.EventHandler(this.Menuitem_modClick);
//
// toolStripSeparator5
// menuitem_del
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(121, 6);
this.menuitem_del.Name = "menuitem_del";
this.menuitem_del.Size = new System.Drawing.Size(152, 22);
this.menuitem_del.Text = "删除";
this.menuitem_del.Click += new System.EventHandler(this.Menuitem_delClick);
//
// 搜索ToolStripMenuItem
// tsep5
//
this.搜索ToolStripMenuItem.Name = "搜索ToolStripMenuItem";
this.搜索ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.搜索ToolStripMenuItem.Text = "搜索";
this.tsep5.Name = "tsep5";
this.tsep5.Size = new System.Drawing.Size(149, 6);
//
// 重置ToolStripMenuItem
// menuitem_search
//
this.重置ToolStripMenuItem.Name = "重置ToolStripMenuItem";
this.重置ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.重置ToolStripMenuItem.Text = "重置";
this.menuitem_search.Name = "menuitem_search";
this.menuitem_search.Size = new System.Drawing.Size(152, 22);
this.menuitem_search.Text = "搜索";
this.menuitem_search.Click += new System.EventHandler(this.Menuitem_searchClick);
//
// toolStripSeparator6
// menuitem_reset
//
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(121, 6);
this.menuitem_reset.Name = "menuitem_reset";
this.menuitem_reset.Size = new System.Drawing.Size(152, 22);
this.menuitem_reset.Text = "重置";
this.menuitem_reset.Click += new System.EventHandler(this.Menuitem_resetClick);
//
// 打开脚本ToolStripMenuItem
// tsep6
//
this.打开脚本ToolStripMenuItem.Name = "打开脚本ToolStripMenuItem";
this.打开脚本ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.打开脚本ToolStripMenuItem.Text = "打开脚本";
this.tsep6.Name = "tsep6";
this.tsep6.Size = new System.Drawing.Size(149, 6);
//
// 启动游戏ToolStripMenuItem
// menuitem_showimage
//
this.启动游戏ToolStripMenuItem.Name = "启动游戏ToolStripMenuItem";
this.启动游戏ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.启动游戏ToolStripMenuItem.Text = "启动游戏";
this.menuitem_showimage.CheckOnClick = true;
this.menuitem_showimage.Name = "menuitem_showimage";
this.menuitem_showimage.Size = new System.Drawing.Size(152, 22);
this.menuitem_showimage.Text = "显示卡片图像";
this.menuitem_showimage.Click += new System.EventHandler(this.Menuitem_showimageClick);
//
// 帮助ToolStripMenuItem
// menuitem_openscript
//
this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.关于ToolStripMenuItem,
this.检查更新ToolStripMenuItem});
this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(61, 21);
this.帮助ToolStripMenuItem.Text = "帮助(&H)";
this.menuitem_openscript.Name = "menuitem_openscript";
this.menuitem_openscript.Size = new System.Drawing.Size(152, 22);
this.menuitem_openscript.Text = "打开脚本";
this.menuitem_openscript.Click += new System.EventHandler(this.Menuitem_openscriptClick);
//
// 关于ToolStripMenuItem
// menuitem_opengame
//
this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.关于ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.关于ToolStripMenuItem.Text = "关于";
this.menuitem_opengame.Name = "menuitem_opengame";
this.menuitem_opengame.Size = new System.Drawing.Size(152, 22);
this.menuitem_opengame.Text = "启动游戏";
this.menuitem_opengame.Click += new System.EventHandler(this.Menuitem_opengameClick);
//
// 检查更新ToolStripMenuItem
// menuitem_help
//
this.检查更新ToolStripMenuItem.Name = "检查更新ToolStripMenuItem";
this.检查更新ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.检查更新ToolStripMenuItem.Text = "检查更新";
this.menuitem_help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_about,
this.menuitem_checkupdate});
this.menuitem_help.Name = "menuitem_help";
this.menuitem_help.Size = new System.Drawing.Size(61, 21);
this.menuitem_help.Text = "帮助(&H)";
//
// menuitem_about
//
this.menuitem_about.Name = "menuitem_about";
this.menuitem_about.Size = new System.Drawing.Size(124, 22);
this.menuitem_about.Text = "关于";
this.menuitem_about.Click += new System.EventHandler(this.Menuitem_aboutClick);
//
// menuitem_checkupdate
//
this.menuitem_checkupdate.Name = "menuitem_checkupdate";
this.menuitem_checkupdate.Size = new System.Drawing.Size(124, 22);
this.menuitem_checkupdate.Text = "检查更新";
this.menuitem_checkupdate.Click += new System.EventHandler(this.Menuitem_checkupdateClick);
//
// lv_cardlist
//
......@@ -336,15 +380,19 @@ private void InitializeComponent()
this.lv_cardlist.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.ch_cardcode,
this.ch_cardname});
this.lv_cardlist.ContextMenuStrip = this.contextMenuStrip1;
this.lv_cardlist.FullRowSelect = true;
this.lv_cardlist.GridLines = true;
this.lv_cardlist.HideSelection = false;
this.lv_cardlist.LabelWrap = false;
this.lv_cardlist.Location = new System.Drawing.Point(0, 27);
this.lv_cardlist.Name = "lv_cardlist";
this.lv_cardlist.ShowItemToolTips = true;
this.lv_cardlist.Size = new System.Drawing.Size(218, 495);
this.lv_cardlist.TabIndex = 1;
this.lv_cardlist.UseCompatibleStateImageBehavior = false;
this.lv_cardlist.View = System.Windows.Forms.View.Details;
this.lv_cardlist.SelectedIndexChanged += new System.EventHandler(this.Lv_cardlistSelectedIndexChanged);
//
// ch_cardcode
//
......@@ -356,6 +404,40 @@ private void InitializeComponent()
this.ch_cardname.Text = "卡片名称";
this.ch_cardname.Width = 140;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.importToolStripMenuItem,
this.exportToolStripMenuItem,
this.copyToToolStripMenuItem,
this.deleteToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(122, 92);
//
// importToolStripMenuItem
//
this.importToolStripMenuItem.Name = "importToolStripMenuItem";
this.importToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.importToolStripMenuItem.Text = "Import";
//
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.exportToolStripMenuItem.Text = "Export";
//
// copyToToolStripMenuItem
//
this.copyToToolStripMenuItem.Name = "copyToToolStripMenuItem";
this.copyToToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.copyToToolStripMenuItem.Text = "CopyTo";
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.deleteToolStripMenuItem.Text = "Delete";
//
// cb_cardattribute
//
this.cb_cardattribute.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
......@@ -371,6 +453,8 @@ private void InitializeComponent()
this.tb_cardname.Name = "tb_cardname";
this.tb_cardname.Size = new System.Drawing.Size(281, 21);
this.tb_cardname.TabIndex = 4;
this.tb_cardname.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.tb_cardname.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Tb_cardnameKeyDown);
//
// cb_cardrule
//
......@@ -445,6 +529,7 @@ private void InitializeComponent()
this.tb_cardtext.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tb_cardtext.Size = new System.Drawing.Size(281, 236);
this.tb_cardtext.TabIndex = 4;
this.tb_cardtext.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Tb_cardtextKeyDown);
//
// lb_scripttext
//
......@@ -456,6 +541,7 @@ private void InitializeComponent()
this.lb_scripttext.ScrollAlwaysVisible = true;
this.lb_scripttext.Size = new System.Drawing.Size(281, 120);
this.lb_scripttext.TabIndex = 6;
this.lb_scripttext.SelectedIndexChanged += new System.EventHandler(this.Lb_scripttextSelectedIndexChanged);
//
// tb_edittext
//
......@@ -467,6 +553,7 @@ private void InitializeComponent()
this.tb_edittext.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tb_edittext.Size = new System.Drawing.Size(279, 41);
this.tb_edittext.TabIndex = 4;
this.tb_edittext.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Tb_edittextKeyPress);
//
// lb_pleft_right
//
......@@ -526,6 +613,7 @@ private void InitializeComponent()
this.tb_page.TabIndex = 8;
this.tb_page.Text = "0";
this.tb_page.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.tb_page.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Tb_pageKeyPress);
//
// tb_pagenum
//
......@@ -548,6 +636,7 @@ private void InitializeComponent()
this.btn_PageUp.TabIndex = 5;
this.btn_PageUp.Text = "< <";
this.btn_PageUp.UseVisualStyleBackColor = true;
this.btn_PageUp.Click += new System.EventHandler(this.Btn_PageUpClick);
//
// btn_PageDown
//
......@@ -558,6 +647,7 @@ private void InitializeComponent()
this.btn_PageDown.TabIndex = 5;
this.btn_PageDown.Text = "> >";
this.btn_PageDown.UseVisualStyleBackColor = true;
this.btn_PageDown.Click += new System.EventHandler(this.Btn_PageDownClick);
//
// btn_add
//
......@@ -567,6 +657,7 @@ private void InitializeComponent()
this.btn_add.TabIndex = 5;
this.btn_add.Text = "添加";
this.btn_add.UseVisualStyleBackColor = true;
this.btn_add.Click += new System.EventHandler(this.Btn_addClick);
//
// label5
//
......@@ -615,6 +706,7 @@ private void InitializeComponent()
this.tb_cardcode.TabIndex = 8;
this.tb_cardcode.Text = "0";
this.tb_cardcode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tb_cardcode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Tb_cardcodeKeyPress);
//
// lb_cardalias
//
......@@ -643,6 +735,7 @@ private void InitializeComponent()
this.btn_mod.TabIndex = 5;
this.btn_mod.Text = "修改";
this.btn_mod.UseVisualStyleBackColor = true;
this.btn_mod.Click += new System.EventHandler(this.Btn_modClick);
//
// btn_del
//
......@@ -653,6 +746,7 @@ private void InitializeComponent()
this.btn_del.TabIndex = 5;
this.btn_del.Text = "删除";
this.btn_del.UseVisualStyleBackColor = true;
this.btn_del.Click += new System.EventHandler(this.Btn_delClick);
//
// btn_lua
//
......@@ -663,6 +757,7 @@ private void InitializeComponent()
this.btn_lua.TabIndex = 5;
this.btn_lua.Text = "脚本";
this.btn_lua.UseVisualStyleBackColor = true;
this.btn_lua.Click += new System.EventHandler(this.Btn_luaClick);
//
// btn_reset
//
......@@ -672,6 +767,7 @@ private void InitializeComponent()
this.btn_reset.TabIndex = 5;
this.btn_reset.Text = "重置";
this.btn_reset.UseVisualStyleBackColor = true;
this.btn_reset.Click += new System.EventHandler(this.Btn_resetClick);
//
// btn_serach
//
......@@ -681,22 +777,7 @@ private void InitializeComponent()
this.btn_serach.TabIndex = 5;
this.btn_serach.Text = "搜索";
this.btn_serach.UseVisualStyleBackColor = true;
//
// pl_cardtype
//
this.pl_cardtype.Location = new System.Drawing.Point(221, 220);
this.pl_cardtype.Name = "pl_cardtype";
this.pl_cardtype.Padding = new System.Windows.Forms.Padding(2);
this.pl_cardtype.Size = new System.Drawing.Size(293, 112);
this.pl_cardtype.TabIndex = 9;
//
// pl_category
//
this.pl_category.Location = new System.Drawing.Point(220, 355);
this.pl_category.Name = "pl_category";
this.pl_category.Padding = new System.Windows.Forms.Padding(2);
this.pl_category.Size = new System.Drawing.Size(310, 164);
this.pl_category.TabIndex = 10;
this.btn_serach.Click += new System.EventHandler(this.Btn_serachClick);
//
// label1
//
......@@ -751,23 +832,25 @@ private void InitializeComponent()
this.label7.Text = "卡片信息";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button1
// btn_redo
//
this.button1.Location = new System.Drawing.Point(390, 522);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(68, 26);
this.button1.TabIndex = 5;
this.button1.Text = "还原";
this.button1.UseVisualStyleBackColor = true;
this.btn_redo.Location = new System.Drawing.Point(390, 522);
this.btn_redo.Name = "btn_redo";
this.btn_redo.Size = new System.Drawing.Size(68, 26);
this.btn_redo.TabIndex = 5;
this.btn_redo.Text = "还原";
this.btn_redo.UseVisualStyleBackColor = true;
this.btn_redo.Click += new System.EventHandler(this.Btn_redoClick);
//
// button2
// btn_undo
//
this.button2.Location = new System.Drawing.Point(460, 522);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(68, 26);
this.button2.TabIndex = 5;
this.button2.Text = "撤销";
this.button2.UseVisualStyleBackColor = true;
this.btn_undo.Location = new System.Drawing.Point(460, 522);
this.btn_undo.Name = "btn_undo";
this.btn_undo.Size = new System.Drawing.Size(68, 26);
this.btn_undo.TabIndex = 5;
this.btn_undo.Text = "撤销";
this.btn_undo.UseVisualStyleBackColor = true;
this.btn_undo.Click += new System.EventHandler(this.Btn_undoClick);
//
// textBox1
//
......@@ -805,18 +888,31 @@ private void InitializeComponent()
this.label9.Text = "卡片名称";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// 显示卡片图像ToolStripMenuItem
// pl_cardtype
//
this.显示卡片图像ToolStripMenuItem.CheckOnClick = true;
this.显示卡片图像ToolStripMenuItem.Name = "显示卡片图像ToolStripMenuItem";
this.显示卡片图像ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.显示卡片图像ToolStripMenuItem.Text = "显示卡片图像";
this.pl_cardtype.Location = new System.Drawing.Point(220, 219);
this.pl_cardtype.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2);
this.pl_cardtype.Name = "pl_cardtype";
this.pl_cardtype.Padding = new System.Windows.Forms.Padding(2);
this.pl_cardtype.Size = new System.Drawing.Size(293, 112);
this.pl_cardtype.TabIndex = 12;
//
// pl_category
//
this.pl_category.Location = new System.Drawing.Point(220, 353);
this.pl_category.Margin = new System.Windows.Forms.Padding(1, 2, 1, 2);
this.pl_category.Name = "pl_category";
this.pl_category.Padding = new System.Windows.Forms.Padding(2);
this.pl_category.Size = new System.Drawing.Size(310, 169);
this.pl_category.TabIndex = 13;
//
// DataEditForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(814, 553);
this.Controls.Add(this.pl_category);
this.Controls.Add(this.pl_cardtype);
this.Controls.Add(this.label3);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
......@@ -824,7 +920,6 @@ private void InitializeComponent()
this.Controls.Add(this.label7);
this.Controls.Add(this.label1);
this.Controls.Add(this.tb_edittext);
this.Controls.Add(this.pl_cardtype);
this.Controls.Add(this.tb_pagenum);
this.Controls.Add(this.tb_def);
this.Controls.Add(this.tb_pright);
......@@ -845,9 +940,9 @@ private void InitializeComponent()
this.Controls.Add(this.btn_lua);
this.Controls.Add(this.btn_serach);
this.Controls.Add(this.btn_del);
this.Controls.Add(this.button2);
this.Controls.Add(this.btn_undo);
this.Controls.Add(this.btn_mod);
this.Controls.Add(this.button1);
this.Controls.Add(this.btn_redo);
this.Controls.Add(this.btn_add);
this.Controls.Add(this.btn_PageDown);
this.Controls.Add(this.textBox2);
......@@ -865,7 +960,6 @@ private void InitializeComponent()
this.Controls.Add(this.cb_cardattribute);
this.Controls.Add(this.lv_cardlist);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.pl_category);
this.MainMenuStrip = this.menuStrip1;
this.Name = "DataEditForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
......@@ -873,22 +967,29 @@ private void InitializeComponent()
this.Load += new System.EventHandler(this.DataEditFormLoad);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripMenuItem 显示卡片图像ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem menuitem_new;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem menuitem_showimage;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btn_undo;
private System.Windows.Forms.Button btn_redo;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private DataEditorX.Core.CheckPanel pl_category;
private DataEditorX.Core.CheckPanel pl_cardtype;
private System.Windows.Forms.DFlowLayoutPanel pl_category;
private System.Windows.Forms.DFlowLayoutPanel pl_cardtype;
private System.Windows.Forms.Button btn_serach;
private System.Windows.Forms.Button btn_reset;
private System.Windows.Forms.Button btn_lua;
......@@ -913,7 +1014,7 @@ private void InitializeComponent()
private System.Windows.Forms.TextBox tb_pleft;
private System.Windows.Forms.Label lb_pleft_right;
private System.Windows.Forms.TextBox tb_edittext;
private System.Windows.Forms.ListBox lb_scripttext;
private System.Windows.Forms.DListBox lb_scripttext;
private System.Windows.Forms.TextBox tb_cardtext;
private System.Windows.Forms.ComboBox cb_setname3;
private System.Windows.Forms.ComboBox cb_setname4;
......@@ -926,36 +1027,36 @@ private void InitializeComponent()
private System.Windows.Forms.ComboBox cb_cardattribute;
private System.Windows.Forms.ColumnHeader ch_cardname;
private System.Windows.Forms.ColumnHeader ch_cardcode;
private System.Windows.Forms.ListView lv_cardlist;
private System.Windows.Forms.ToolStripMenuItem 检查更新ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 启动游戏ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 打开脚本ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripMenuItem 重置ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 搜索ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem 删除ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 修改ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 添加ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem 还原ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 撤销ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 编辑EToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem 读取图片ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 读取ydkToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem 导入ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 导出ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem 复制到ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 另存为ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 保存SToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 打开OToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 文件FToolStripMenuItem;
private System.Windows.Forms.DListView lv_cardlist;
private System.Windows.Forms.ToolStripMenuItem menuitem_checkupdate;
private System.Windows.Forms.ToolStripMenuItem menuitem_about;
private System.Windows.Forms.ToolStripMenuItem menuitem_help;
private System.Windows.Forms.ToolStripMenuItem menuitem_opengame;
private System.Windows.Forms.ToolStripMenuItem menuitem_openscript;
private System.Windows.Forms.ToolStripSeparator tsep6;
private System.Windows.Forms.ToolStripMenuItem menuitem_reset;
private System.Windows.Forms.ToolStripMenuItem menuitem_search;
private System.Windows.Forms.ToolStripSeparator tsep5;
private System.Windows.Forms.ToolStripMenuItem menuitem_del;
private System.Windows.Forms.ToolStripMenuItem menuitem_mod;
private System.Windows.Forms.ToolStripMenuItem menuitem_add;
private System.Windows.Forms.ToolStripSeparator tsep4;
private System.Windows.Forms.ToolStripMenuItem menuitem_redo;
private System.Windows.Forms.ToolStripMenuItem menuitem_undo;
private System.Windows.Forms.ToolStripMenuItem menuitem_edit;
private System.Windows.Forms.ToolStripMenuItem menuitem_quit;
private System.Windows.Forms.ToolStripSeparator tsep3;
private System.Windows.Forms.ToolStripMenuItem menuitem_readimages;
private System.Windows.Forms.ToolStripMenuItem menuitem_readydk;
private System.Windows.Forms.ToolStripSeparator tsep2;
private System.Windows.Forms.ToolStripMenuItem menuitem_export;
private System.Windows.Forms.ToolStripMenuItem menuitem_inport;
private System.Windows.Forms.ToolStripSeparator tsep1;
private System.Windows.Forms.ToolStripMenuItem menuitem_copyto;
private System.Windows.Forms.ToolStripMenuItem menuitem_saveas;
private System.Windows.Forms.ToolStripMenuItem menuitem_save;
private System.Windows.Forms.ToolStripMenuItem menuitem_open;
private System.Windows.Forms.ToolStripMenuItem menuitem_file;
private System.Windows.Forms.MenuStrip menuStrip1;
}
}
......@@ -11,6 +11,7 @@
using System.IO;
using System.Collections.Generic;
using DataEditorX.Core;
using System.Text;
namespace DataEditorX
{
......@@ -19,7 +20,17 @@ namespace DataEditorX
/// </summary>
public partial class DataEditForm : Form
{
string GAMEPATH,PICPATH,UPDATEURL;
Card oldCard=new Card(0);
ImageForm imgform=new ImageForm();
string[] strs=null;
string title;
string nowCdbFile="";
int MaxRow=20;
int page=1,pageNum=1;
int cardcount;
string strSetname="卡片系列";
List<Card> cardlist=new List<Card>();
Dictionary<long, string> dicCardRules=null;
Dictionary<long, string> dicCardAttributes=null;
Dictionary<long, string> dicCardRaces=null;
......@@ -31,13 +42,40 @@ public partial class DataEditForm : Form
public DataEditForm(string cdbfile)
{
InitializeComponent();
nowCdbFile=cdbfile;
}
public DataEditForm()
{
InitializeComponent();
}
public bool InitForm(string directory)
#region 界面初始化
void DataEditFormLoad(object sender, EventArgs e)
{
InitListRows();
title=this.Text;
#if DEBUG
title=title+"(DEBUG)";
#endif
//set null card
oldCard=new Card(0);
SetCard(oldCard);
if(!string.IsNullOrEmpty(nowCdbFile))
Open(nowCdbFile);
imgform.VisibleChanged+=OnimgFormClosed;
GAMEPATH=Application.StartupPath;
if(File.Exists(Path.Combine(GAMEPATH,"DataEditorX.txt")))
{
string[] lines=File.ReadAllLines(Path.Combine(GAMEPATH,"DataEditorX.txt"),Encoding.Default);
GAMEPATH=(lines.Length>0)?lines[0]:Application.StartupPath;
UPDATEURL=(lines.Length>1)?lines[1]:"http://about:blank";
}
PICPATH=Path.Combine(GAMEPATH,"pics");
}
public void InitForm(string directory)
{
//初始化
dicCardRules=InitComboBox(
cb_cardrule,Path.Combine(directory, "card-rule.txt"));
dicCardAttributes=InitComboBox(
......@@ -48,6 +86,7 @@ public bool InitForm(string directory)
cb_cardlevel,Path.Combine(directory, "card-level.txt"));
dicSetnames=DataManager.Read(
Path.Combine(directory, "card-setname.txt"));
//setname
string[] setnames=DataManager.GetValues(dicSetnames);
cb_setname1.Items.Add(strSetname+"1");
cb_setname2.Items.Add(strSetname+"2");
......@@ -57,19 +96,44 @@ public bool InitForm(string directory)
cb_setname2.Items.AddRange(setnames);
cb_setname3.Items.AddRange(setnames);
cb_setname4.Items.AddRange(setnames);
//card types
dicCardTypes=DataManager.Read(
Path.Combine(directory, "card-type.txt"));
pl_cardtype.SetDic(dicCardTypes);
pl_cardtype.Init();
InitCheckPanel(pl_cardtype, dicCardTypes);
//card categorys
dicCardcategorys=DataManager.Read(
Path.Combine(directory, "card-category.txt"));
pl_category.SetDic(dicCardcategorys);
pl_category.Init();
InitCheckPanel(pl_category, dicCardcategorys);
//
if(File.Exists(Path.Combine(directory, "cover.jpg")))
imgform.SetDefault(Image.FromFile(Path.Combine(directory, "cover.jpg")));
}
//初始化FlowLayoutPanel
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;
fpanel.Controls.Add(_cbox);
}
fpanel.ResumeLayout(false);
fpanel.PerformLayout();
}
//FlowLayoutPanel点击CheckBox
void PanelOnCheckClick(object sender, EventArgs e)
{
SetCard(new Card(0,""));
return true;
}
//初始化ComboBox
Dictionary<long, string> InitComboBox(ComboBox cb, string file)
{
Dictionary<long, string> tempdic=DataManager.Read(file);
......@@ -78,17 +142,600 @@ public bool InitForm(string directory)
cb.SelectedIndex=0;
return tempdic;
}
void SetCard(Card card)
//计算list最大行数
void InitListRows()
{
cb_setname1.SelectedIndex=0;
cb_setname2.SelectedIndex=0;
cb_setname3.SelectedIndex=0;
cb_setname4.SelectedIndex=0;
if ( lv_cardlist.Items.Count==0 )
{
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 n=( lv_cardlist.Height-headH-2 )/itemH;
if ( n>0 )
MaxRow=n;
}
lv_cardlist.Items.Clear();
if ( MaxRow<10 )
MaxRow=20;
}
void DataEditFormLoad(object sender, EventArgs e)
#endregion
#region 设置卡片
void SetCard(Card c)
{
oldCard=c;
tb_cardname.Text=c.name;
tb_cardtext.Text=c.desc;
strs=c.str;
lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(c.str);
tb_edittext.Text="";
SetSelect(dicCardRules,cb_cardrule,(long)c.ot,0);
SetSelect(dicCardAttributes,cb_cardattribute,(long)c.attribute,0);
SetSelect(dicCardLevels,cb_cardlevel,(long)(c.level&0xff),0);
SetSelect(dicCardRaces,cb_cardrace,c.race,0);
SetSelect(dicSetnames, cb_setname1, c.setcode&0xffff,1);
SetSelect(dicSetnames, cb_setname2, (c.setcode>>0x10)&0xffff,1);
SetSelect(dicSetnames, cb_setname3, (c.setcode>>0x20)&0xffff,1);
SetSelect(dicSetnames, cb_setname4, (c.setcode>>0x30)&0xffff,1);
SetCheck(pl_cardtype,c.type);
SetCheck(pl_category,c.category);
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();
}
void SetCheck(FlowLayoutPanel fpl,long number)
{
long temp;
foreach(Control c in fpl.Controls)
{
if(c is CheckBox)
{
CheckBox cbox=(CheckBox)c;
long.TryParse(cbox.Name.Substring(fpl.Name.Length), out temp);
if((temp & number)==temp && temp!=0)
cbox.Checked=true;
else
cbox.Checked=false;
}
}
}
void SetSelect(Dictionary<long, string> dic,ComboBox cb, long k,int start)
{
int index=0;
bool isfind=false;
foreach(long key in dic.Keys)
{
if(k==key)
{
isfind=true;
break;
}
index++;
}
if(isfind)
cb.SelectedIndex=index+start;
else
cb.SelectedIndex=0;
}
#endregion
#region 获取卡片
Card GetCard()
{
int temp;
Card c=new Card(0);
c.name=tb_cardname.Text;
c.desc=tb_cardtext.Text;
c.str=strs;
int.TryParse(GetSelect(dicCardRules,cb_cardrule,0),out c.ot);
int.TryParse(GetSelect(dicCardAttributes,cb_cardattribute,0),out c.attribute);
long.TryParse(GetSelect(dicCardLevels,cb_cardlevel,0),out c.level);
long.TryParse(GetSelect(dicCardRaces,cb_cardrace,0),out c.race);
int.TryParse(GetSelect(dicSetnames, cb_setname1,1), out temp);
c.setcode+=temp;
int.TryParse(GetSelect(dicSetnames, cb_setname2,1), out temp);
c.setcode+=(temp<<0x10);
int.TryParse(GetSelect(dicSetnames, cb_setname3,1), out temp);
c.setcode+=(temp<<0x20);
int.TryParse(GetSelect(dicSetnames, cb_setname4,1), out temp);
c.setcode+=(temp<<0x30);
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);
int.TryParse( tb_atk.Text,out c.atk);
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;
}
string GetSelect(Dictionary<long, string> dic,ComboBox cb, int start)
{
long fkey=0;
foreach(long key in dic.Keys)
{
if(cb.Text==dic[key])
{
fkey=key;
break;
}
}
return fkey.ToString();
}
long GetCheck(FlowLayoutPanel fpl)
{
long number=0;
long temp;
foreach(Control c in fpl.Controls)
{
if(c is CheckBox)
{
CheckBox cbox=(CheckBox)c;
long.TryParse(cbox.Name.Substring(fpl.Name.Length), out temp);
if(cbox.Checked)
number+=temp;
}
}
return number;
}
#endregion
#region 消息显示
void ShowMsg(string strMsg)
{
MessageBox.Show(strMsg, "提示",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
void ShowWarning(string strWarn)
{
MessageBox.Show(strWarn, "警告",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
void ShowError(string strError)
{
MessageBox.Show(strError, "错误",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
bool ShowQuestion(string strQues)
{
if(MessageBox.Show(strQues, "询问",
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)==DialogResult.OK)
return true;
else
return false;
}
#endregion
#region 卡片列表
void Lv_cardlistSelectedIndexChanged(object sender, EventArgs e)
{
if(lv_cardlist.SelectedItems.Count>0)
{
int sel=lv_cardlist.SelectedItems[0].Index;
int index=(page-1)*MaxRow+sel;
if(index<cardlist.Count)
{
Card c=cardlist[index];
SetCard(c);
//设置卡片图像
imgform.SetImageFile(Path.Combine(PICPATH,c.id.ToString()+".jpg"),c.name);
}
}
}
void AddListView(int p)
{
int i,j,istart,iend;
if(p<=0)
{
p=1;
istart=(p-1)*MaxRow;
iend=p*MaxRow;
}
else if(p>=pageNum)
{
p=pageNum;
istart=(p-1)*MaxRow;
iend=cardcount;
}
else
{
istart=(p-1)*MaxRow;
iend=p*MaxRow;
}
page=p;
lv_cardlist.BeginUpdate();
lv_cardlist.Items.Clear();
if((iend-istart)>0)
{
ListViewItem[] items=new ListViewItem[iend-istart];
for(i=istart,j=0;i < iend;i++,j++)
{
items[j]=new ListViewItem();
items[j].Text=cardlist[i].id.ToString();
if ( i % 2 == 0 )
items[j].BackColor = Color.GhostWhite;
else
items[j].BackColor = Color.White;
items[j].SubItems.Add(cardlist[i].name);
}
lv_cardlist.Items.AddRange(items);
}
lv_cardlist.EndUpdate();
tb_page.Text=page.ToString();
}
void Btn_PageUpClick(object sender, EventArgs e)
{
page--;
AddListView(page);
}
void Btn_PageDownClick(object sender, EventArgs e)
{
page++;
AddListView(page);
}
void Tb_pageKeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar==(char)Keys.Enter)
{
int p;
int.TryParse(tb_page.Text,out p);
if(p>0)
AddListView(p);
}
}
#endregion
#region 卡片编辑
public bool Open(string cdbFile)
{
if(!File.Exists(cdbFile))
{
ShowMsg("文件不存在!\n"+cdbFile);
return false;
}
this.Text=cdbFile+"-"+title;
cardlist.Clear();
SetCards(DataBase.Read(cdbFile,true,""));
return true;
}
public void SetCards(Card[] cards)
{
if(cards!=null)
{
cardlist.Clear();
cardcount=cards.Length;
pageNum=cardcount/MaxRow;
if(cardcount%MaxRow > 0)
pageNum++;
tb_pagenum.Text=pageNum.ToString();
cardlist.AddRange(cards);
AddListView(1);
}
else
{
ShowWarning("没有卡片!");
}
}
public void Search(Card c)
{
string sql=DataBase.GetSelectSQL(c);
#if DEBUG
ShowMsg(sql);
#endif
SetCards(DataBase.Read(nowCdbFile, true, sql));
}
public void Reset()
{
oldCard=new Card(0);
SetCard(oldCard);
}
public void Undo()
{
}
public void Redo()
{
}
public bool Add()
{
return false;
}
public bool Mod()
{
return false;
}
public bool Del()
{
return false;
}
public bool OpenScript()
{
return false;
}
public void OpanGame()
{
}
#endregion
#region 按钮
//搜索卡片
void Btn_serachClick(object sender, EventArgs e)
{
Search(GetCard());
}
//重置卡片
void Btn_resetClick(object sender, EventArgs e)
{
Reset();
}
//还原
void Btn_redoClick(object sender, EventArgs e)
{
Redo();
}
//撤销
void Btn_undoClick(object sender, EventArgs e)
{
Undo();
}
//添加
void Btn_addClick(object sender, EventArgs e)
{
Add();
}
//修改
void Btn_modClick(object sender, EventArgs e)
{
Mod();
}
//打开脚本
void Btn_luaClick(object sender, EventArgs e)
{
OpenScript();
}
//删除
void Btn_delClick(object sender, EventArgs e)
{
Del();
}
#endregion
#region 文本框
//卡片密码搜索
void Tb_cardcodeKeyPress(object sender, KeyPressEventArgs e)
{
Card c=new Card(0);
long.TryParse(tb_cardcode.Text, out c.id);
if(c.id>0)
{
string sql=DataBase.GetSelectSQL(c);
SetCards(DataBase.Read(nowCdbFile, true, sql));
}
}
//卡片名称搜索、编辑
void Tb_cardnameKeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
{
Card c=new Card(0);
c.name=tb_cardname.Text;
string sql=DataBase.GetSelectSQL(c);
SetCards(DataBase.Read(nowCdbFile, true, sql));
}
}
//卡片描述编辑
void Tb_cardtextKeyDown(object sender, KeyEventArgs e)
{
}
void Setscripttext(string str)
{
int index=-1;
try{
index=lb_scripttext.SelectedIndex;
}
catch{
index=-1;
ShowError("请选中脚本文本");
}
if(index>=0)
{
strs[index]=str;
lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(strs);
lb_scripttext.SelectedIndex=index;
}
}
string Getscripttext()
{
int index=-1;
try{
index=lb_scripttext.SelectedIndex;
}
catch{
index=-1;
ShowError("请选中脚本文本");
}
if(index>=0)
return strs[index];
else
return "";
}
//脚本文本
void Lb_scripttextSelectedIndexChanged(object sender, EventArgs e)
{
tb_edittext.Text=Getscripttext();
}
//脚本文本
void Tb_edittextKeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar==(char)Keys.Enter)
Setscripttext(tb_edittext.Text);
}
#endregion
#region 帮助菜单
void Menuitem_aboutClick(object sender, EventArgs e)
{
}
void Menuitem_checkupdateClick(object sender, EventArgs e)
{
}
#endregion
#region 文件菜单
void Menuitem_openClick(object sender, EventArgs e)
{
}
void Menuitem_saveClick(object sender, EventArgs e)
{
}
void Menuitem_saveasClick(object sender, EventArgs e)
{
}
void Menuitem_newClick(object sender, EventArgs e)
{
}
void Menuitem_copytoClick(object sender, EventArgs e)
{
}
void Menuitem_inportClick(object sender, EventArgs e)
{
}
void Menuitem_exportClick(object sender, EventArgs e)
{
}
void Menuitem_readydkClick(object sender, EventArgs e)
{
}
void Menuitem_readimagesClick(object sender, EventArgs e)
{
}
//关闭
void Menuitem_quitClick(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 编辑菜单
void Menuitem_undoClick(object sender, EventArgs e)
{
Undo();
}
void Menuitem_redoClick(object sender, EventArgs e)
{
Redo();
}
void Menuitem_addClick(object sender, EventArgs e)
{
Add();
}
void Menuitem_modClick(object sender, EventArgs e)
{
Mod();
}
void Menuitem_delClick(object sender, EventArgs e)
{
Del();
}
void Menuitem_searchClick(object sender, EventArgs e)
{
Search(GetCard());
}
void Menuitem_resetClick(object sender, EventArgs e)
{
Reset();
}
void Menuitem_showimageClick(object sender, EventArgs e)
{
if(menuitem_showimage.Checked)
imgform.Show();
else
imgform.Hide();
}
void OnimgFormClosed(object sender, EventArgs e)
{
menuitem_showimage.Checked=imgform.Visible;
}
void Menuitem_openscriptClick(object sender, EventArgs e)
{
OpenScript();
}
void Menuitem_opengameClick(object sender, EventArgs e)
{
OpanGame();
}
#endregion
}
}
......@@ -120,6 +120,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>130, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
......
......@@ -41,15 +41,17 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Core\Card.cs" />
<Compile Include="Core\CDB.cs" />
<Compile Include="Core\CheckPanel.cs" />
<Compile Include="Core\DataBase.cs" />
<Compile Include="Core\DataManager.cs" />
<Compile Include="Core\DoubleContorl.cs" />
<Compile Include="DataEditForm.cs" />
<Compile Include="DataEditForm.Designer.cs">
<DependentUpon>DataEditForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ICardView.cs" />
<Compile Include="Interface\IEditor.cs" />
<Compile Include="ImageForm.cs" />
<Compile Include="ImageForm.Designer.cs">
<DependentUpon>ImageForm.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
......@@ -61,12 +63,14 @@
<EmbeddedResource Include="DataEditForm.resx">
<DependentUpon>DataEditForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ImageForm.resx">
<DependentUpon>ImageForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Interface" />
<Folder Include="Data" />
<Folder Include="Core" />
</ItemGroup>
......
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月19 星期一
* 时间: 11:19
*
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DataEditorX
{
/// <summary>
/// Description of ImageForm.
/// </summary>
public partial class ImageForm : Form
{
public ImageForm()
{
InitializeComponent();
}
Image deimg=null;
void ImageFormFormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
e.Cancel=true;
}
public void SetDefault(Image img)
{
deimg=img;
SetImage(img,"默认");
}
public void SetImage(Image img,string title)
{
this.Text=title;
this.BackgroundImage=img;
}
public void SetImageFile(string file,string title)
{
this.Text=title;
if(System.IO.File.Exists(file))
this.BackgroundImage=Image.FromFile(file);
else
this.BackgroundImage=deimg;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 16:14
*
*/
using System;
using DataEditorX.Core;
namespace DataEditorX.Interface
{
public interface ICardView
{
Card m_oldcard{set;get;}
Card GetCard();
bool SetCard();
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 16:14
*
*/
using System;
using DataEditorX.Core;
namespace DataEditorX.Interface
{
public interface IEditor
{
string m_dbfile{get;set;}
bool Open(string file);
bool Close();
bool Save();
bool Reload();
Card[] Search(Card modelCard);
Card[] GetCards();
bool Add(Card card);
bool AddCards(Card[] card);
bool Delete(Card card);
bool DeleteCards(Card[] card);
bool Change(Card oldCard,Card nowCard);
bool Undo();
bool Redo();
}
}
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