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