Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
DataEditorX
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
聖園ミカ
DataEditorX
Commits
987dec0c
Commit
987dec0c
authored
May 18, 2014
by
247321453
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new
parent
9023a420
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
390 additions
and
14 deletions
+390
-14
DataEditorX/Core/CDB.cs
DataEditorX/Core/CDB.cs
+20
-0
DataEditorX/Core/Card.cs
DataEditorX/Core/Card.cs
+342
-0
DataEditorX/DataEditorX.csproj
DataEditorX/DataEditorX.csproj
+3
-0
DataEditorX/Interface/ICardView.cs
DataEditorX/Interface/ICardView.cs
+6
-7
DataEditorX/Interface/IEditor.cs
DataEditorX/Interface/IEditor.cs
+19
-7
No files found.
DataEditorX/Core/CDB.cs
0 → 100644
View file @
987dec0c
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 17:01
*
*/
using
System
;
using
System.Data.SQLite
;
namespace
DataEditorX.Core
{
/// <summary>
/// Description of SQLite.
/// </summary>
public
class
CDB
{
}
}
DataEditorX/Core/Card.cs
0 → 100644
View file @
987dec0c
/*
* CreateDate :2014-02-07
* desc :卡片类
* ModiftyDate :2014-02-12
*/
using
System
;
namespace
DataEditorX.Core
{
public
struct
Card
:
IEquatable
<
Card
>
{
#
region
构造
/// <summary>
/// 卡片
/// </summary>
/// <param name="cardCode">密码</param>
/// <param name="cardName">名字</param>
public
Card
(
int
cardCode
,
string
cardName
)
{
this
.
id
=
cardCode
;
this
.
ot
=
0
;
this
.
alias
=
0
;
this
.
name
=
cardName
;
this
.
setcode
=
0
;
this
.
type
=
0
;
this
.
atk
=
0
;
this
.
def
=
0
;
this
.
level
=
0
;
this
.
race
=
0
;
this
.
attribute
=
0
;
this
.
category
=
0
;
this
.
desc
=
""
;
this
.
str
=
new
string
[
0x10
];
}
#
endregion
#
region
成员
/// <summary>
/// 卡片密码
/// </summary>
public
int
id
;
/// <summary>
/// 卡片规则
/// </summary>
public
int
ot
;
/// <summary>
/// 卡片同名卡
/// </summary>
public
int
alias
;
/// <summary>
/// 卡片系列号
/// </summary>
public
ulong
setcode
;
/// <summary>
/// 卡片种类
/// </summary>
public
long
type
;
/// <summary>
/// 攻击力
/// </summary>
public
int
atk
;
/// <summary>
/// 防御力
/// </summary>
public
int
def
;
/// <summary>
/// 卡片等级
/// </summary>
public
int
level
;
/// <summary>
/// 卡片种族
/// </summary>
public
int
race
;
/// <summary>
/// 卡片属性
/// </summary>
public
int
attribute
;
/// <summary>
/// 效果种类
/// </summary>
public
long
category
;
/// <summary>
/// 卡片名称
/// </summary>
public
string
name
;
/// <summary>
/// 描述文本
/// </summary>
public
string
desc
;
/// <summary>
/// 脚本文件组
/// </summary>
public
string
[]
str
;
#
endregion
#
region
比较、哈希值、操作符
/// <summary>
/// 比较
/// </summary>
/// <param name="obj">对象</param>
/// <returns>结果</returns>
public
override
bool
Equals
(
object
obj
)
{
if
(
obj
is
Card
)
return
Equals
((
Card
)
obj
);
// use Equals method below
else
return
false
;
}
/// <summary>
/// 字符串化
/// </summary>
public
override
string
ToString
()
{
return
string
.
Format
(
"{0} [{1}]"
,
id
.
ToString
(
"00000000"
),
name
);
}
/// <summary>
/// 比较卡片是否一致?
/// </summary>
/// <param name="other">比较的卡片</param>
/// <returns>结果</returns>
public
bool
Equals
(
Card
other
)
{
bool
equalBool
=
true
;
if
(
this
.
id
!=
other
.
id
)
equalBool
=
false
;
else
if
(
this
.
ot
!=
other
.
ot
)
equalBool
=
false
;
else
if
(
this
.
alias
!=
other
.
alias
)
equalBool
=
false
;
else
if
(
this
.
setcode
!=
other
.
setcode
)
equalBool
=
false
;
else
if
(
this
.
type
!=
other
.
type
)
equalBool
=
false
;
else
if
(
this
.
atk
!=
other
.
atk
)
equalBool
=
false
;
else
if
(
this
.
def
!=
other
.
def
)
equalBool
=
false
;
else
if
(
this
.
level
!=
other
.
level
)
equalBool
=
false
;
else
if
(
this
.
race
!=
other
.
race
)
equalBool
=
false
;
else
if
(
this
.
attribute
!=
other
.
attribute
)
equalBool
=
false
;
else
if
(
this
.
category
!=
other
.
category
)
equalBool
=
false
;
else
if
(!
this
.
name
.
Equals
(
other
.
name
))
equalBool
=
false
;
else
if
(!
this
.
desc
.
Equals
(
other
.
desc
))
equalBool
=
false
;
else
if
(
this
.
str
.
Length
!=
other
.
str
.
Length
)
equalBool
=
false
;
else
{
int
l
=
this
.
str
.
Length
;
for
(
int
i
=
0
;
i
<
l
;
i
++)
{
if
(!
this
.
str
[
i
].
Equals
(
other
.
str
[
i
]))
{
equalBool
=
false
;
break
;
}
}
}
return
equalBool
;
}
/// <summary>
/// 得到哈希值
/// </summary>
public
override
int
GetHashCode
()
{
// combine the hash codes of all members here (e.g. with XOR operator ^)
int
hashCode
=
id
.
GetHashCode
()
+
name
.
GetHashCode
();
return
hashCode
;
//member.GetHashCode();
}
/// <summary>
/// 比较卡片是否相等
/// </summary>
public
static
bool
operator
==(
Card
left
,
Card
right
)
{
return
left
.
Equals
(
right
);
}
/// <summary>
/// 卡片是否不相等
/// </summary>
public
static
bool
operator
!=(
Card
left
,
Card
right
)
{
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
}
}
DataEditorX/DataEditorX.csproj
View file @
987dec0c
...
@@ -40,6 +40,8 @@
...
@@ -40,6 +40,8 @@
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile
Include=
"Core\Card.cs"
/>
<Compile
Include=
"Core\CDB.cs"
/>
<Compile
Include=
"Interface\ICardView.cs"
/>
<Compile
Include=
"Interface\ICardView.cs"
/>
<Compile
Include=
"Interface\IEditor.cs"
/>
<Compile
Include=
"Interface\IEditor.cs"
/>
<Compile
Include=
"MainForm.cs"
/>
<Compile
Include=
"MainForm.cs"
/>
...
@@ -58,6 +60,7 @@
...
@@ -58,6 +60,7 @@
<Folder
Include=
"Data\ygopro"
/>
<Folder
Include=
"Data\ygopro"
/>
<Folder
Include=
"Interface"
/>
<Folder
Include=
"Interface"
/>
<Folder
Include=
"Data"
/>
<Folder
Include=
"Data"
/>
<Folder
Include=
"Core"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<None
Include=
"Data\ygopro\card-attribute.txt"
/>
<None
Include=
"Data\ygopro\card-attribute.txt"
/>
...
...
DataEditorX/Interface/ICardView.cs
View file @
987dec0c
...
@@ -6,16 +6,15 @@
...
@@ -6,16 +6,15 @@
*
*
*/
*/
using
System
;
using
System
;
using
DataEditorX.Core
;
namespace
DataEditorX.Interface
namespace
DataEditorX.Interface
{
{
/// <summary>
public
interface
ICardView
/// Description of ICardView.
/// </summary>
public
class
ICardView
{
{
public
ICardView
()
Card
m_oldcard
{
set
;
get
;}
{
}
Card
GetCard
();
bool
SetCard
();
}
}
}
}
DataEditorX/Interface/IEditor.cs
View file @
987dec0c
...
@@ -6,16 +6,28 @@
...
@@ -6,16 +6,28 @@
*
*
*/
*/
using
System
;
using
System
;
using
DataEditorX.Core
;
namespace
DataEditorX.Interface
namespace
DataEditorX.Interface
{
{
/// <summary>
public
interface
IEditor
/// Description of IEditor.
/// </summary>
public
class
IEditor
{
{
public
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
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment