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