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;
}
}
}
This diff is collapsed.
/*
* 由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();
}
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -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