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
2
Issues
2
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
nanahira
DataEditorX
Commits
346dfc10
Commit
346dfc10
authored
Dec 30, 2014
by
keyongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
const
parent
1a300ffb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
810 additions
and
750 deletions
+810
-750
DataEditorX/CodeEditForm.cs
DataEditorX/CodeEditForm.cs
+379
-370
DataEditorX/Common/CheckUpdate.cs
DataEditorX/Common/CheckUpdate.cs
+38
-32
DataEditorX/Common/MyPath.cs
DataEditorX/Common/MyPath.cs
+19
-0
DataEditorX/Config/CodeConfig.cs
DataEditorX/Config/CodeConfig.cs
+7
-0
DataEditorX/Config/DataConfig.cs
DataEditorX/Config/DataConfig.cs
+16
-8
DataEditorX/Config/ImageSet.cs
DataEditorX/Config/ImageSet.cs
+10
-5
DataEditorX/Config/MSEConfig.cs
DataEditorX/Config/MSEConfig.cs
+6
-25
DataEditorX/Config/MyConfig.cs
DataEditorX/Config/MyConfig.cs
+3
-25
DataEditorX/Core/TaskHelper.cs
DataEditorX/Core/TaskHelper.cs
+331
-284
DataEditorX/MainForm.cs
DataEditorX/MainForm.cs
+1
-1
No files found.
DataEditorX/CodeEditForm.cs
View file @
346dfc10
...
...
@@ -22,85 +22,85 @@
namespace
DataEditorX
{
/// <summary>
/// Description of CodeEditForm.
/// </summary>
/// <summary>
/// Description of CodeEditForm.
/// </summary>
public
partial
class
CodeEditForm
:
DockContent
,
IEditForm
{
#
region
Style
SortedDictionary
<
long
,
string
>
cardlist
;
MarkerStyle
SameWordsStyle
=
new
MarkerStyle
(
new
SolidBrush
(
Color
.
FromArgb
(
40
,
Color
.
White
)));
#
endregion
#
region
init
AutocompleteMenu
popupMenu
;
AutocompleteMenu
popupMenu_fun
;
AutocompleteMenu
popupMenu_con
;
AutocompleteMenu
popupMenu_find
;
string
nowFile
;
string
title
;
string
oldtext
;
Dictionary
<
string
,
string
>
tooltipDic
;
{
#
region
Style
SortedDictionary
<
long
,
string
>
cardlist
;
MarkerStyle
SameWordsStyle
=
new
MarkerStyle
(
new
SolidBrush
(
Color
.
FromArgb
(
40
,
Color
.
White
)));
#
endregion
#
region
init
AutocompleteMenu
popupMenu
;
AutocompleteMenu
popupMenu_fun
;
AutocompleteMenu
popupMenu_con
;
AutocompleteMenu
popupMenu_find
;
string
nowFile
;
string
title
;
string
oldtext
;
Dictionary
<
string
,
string
>
tooltipDic
;
bool
tabisspaces
=
false
;
string
nowcdb
;
public
CodeEditForm
()
{
InitForm
();
}
void
InitForm
()
{
cardlist
=
new
SortedDictionary
<
long
,
string
>();
tooltipDic
=
new
Dictionary
<
string
,
string
>();
InitializeComponent
();
Font
ft
=
new
Font
(
fctb
.
Font
.
Name
,
fctb
.
Font
.
Size
/
1.2f
,
FontStyle
.
Regular
);
popupMenu
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu
.
MinFragmentLength
=
2
;
popupMenu
.
Items
.
Font
=
ft
;
popupMenu
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu
.
Items
.
Width
=
300
;
popupMenu_fun
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_fun
.
MinFragmentLength
=
2
;
popupMenu_fun
.
Items
.
Font
=
ft
;
popupMenu_fun
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_fun
.
Items
.
Width
=
300
;
popupMenu_con
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_con
.
MinFragmentLength
=
2
;
popupMenu_con
.
Items
.
Font
=
ft
;
popupMenu_con
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_con
.
Items
.
Width
=
300
;
popupMenu_find
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_find
.
MinFragmentLength
=
2
;
popupMenu_find
.
Items
.
Font
=
ft
;
popupMenu_find
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_find
.
Items
.
Width
=
300
;
title
=
this
.
Text
;
string
fontname
=
MyConfig
.
readString
(
My
Config
.
TAG_FONT_NAME
);
float
fontsize
=
MyConfig
.
readFloat
(
My
Config
.
TAG_FONT_SIZE
,
14
);
fctb
.
Font
=
new
Font
(
fontname
,
fontsize
);
if
(
MyConfig
.
readBoolean
(
My
Config
.
TAG_IME
))
fctb
.
ImeMode
=
ImeMode
.
On
;
if
(
MyConfig
.
readBoolean
(
My
Config
.
TAG_WORDWRAP
))
public
CodeEditForm
()
{
InitForm
();
}
void
InitForm
()
{
cardlist
=
new
SortedDictionary
<
long
,
string
>();
tooltipDic
=
new
Dictionary
<
string
,
string
>();
InitializeComponent
();
Font
ft
=
new
Font
(
fctb
.
Font
.
Name
,
fctb
.
Font
.
Size
/
1.2f
,
FontStyle
.
Regular
);
popupMenu
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu
.
MinFragmentLength
=
2
;
popupMenu
.
Items
.
Font
=
ft
;
popupMenu
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu
.
Items
.
Width
=
300
;
popupMenu_fun
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_fun
.
MinFragmentLength
=
2
;
popupMenu_fun
.
Items
.
Font
=
ft
;
popupMenu_fun
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_fun
.
Items
.
Width
=
300
;
popupMenu_con
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_con
.
MinFragmentLength
=
2
;
popupMenu_con
.
Items
.
Font
=
ft
;
popupMenu_con
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_con
.
Items
.
Width
=
300
;
popupMenu_find
=
new
FastColoredTextBoxNS
.
AutocompleteMenu
(
fctb
);
popupMenu_find
.
MinFragmentLength
=
2
;
popupMenu_find
.
Items
.
Font
=
ft
;
popupMenu_find
.
Items
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
200
,
400
);
popupMenu_find
.
Items
.
Width
=
300
;
title
=
this
.
Text
;
string
fontname
=
MyConfig
.
readString
(
Code
Config
.
TAG_FONT_NAME
);
float
fontsize
=
MyConfig
.
readFloat
(
Code
Config
.
TAG_FONT_SIZE
,
14
);
fctb
.
Font
=
new
Font
(
fontname
,
fontsize
);
if
(
MyConfig
.
readBoolean
(
Code
Config
.
TAG_IME
))
fctb
.
ImeMode
=
ImeMode
.
On
;
if
(
MyConfig
.
readBoolean
(
Code
Config
.
TAG_WORDWRAP
))
fctb
.
WordWrap
=
true
;
else
fctb
.
WordWrap
=
false
;
if
(
MyConfig
.
readBoolean
(
My
Config
.
TAG_TAB2SPACES
))
if
(
MyConfig
.
readBoolean
(
Code
Config
.
TAG_TAB2SPACES
))
tabisspaces
=
true
;
else
tabisspaces
=
false
;
}
public
void
LoadXml
(
string
xmlfile
)
{
fctb
.
DescriptionFile
=
xmlfile
;
}
#
endregion
#
region
Open
}
public
void
LoadXml
(
string
xmlfile
)
{
fctb
.
DescriptionFile
=
xmlfile
;
}
#
endregion
#
region
Open
public
void
SetActived
()
{
this
.
Activate
();
...
...
@@ -117,187 +117,192 @@ public bool Create(string file)
{
return
Open
(
file
);
}
public
bool
Open
(
string
file
)
{
if
(!
string
.
IsNullOrEmpty
(
file
))
{
if
(!
File
.
Exists
(
file
))
{
FileStream
fs
=
new
FileStream
(
file
,
FileMode
.
Create
);
fs
.
Close
();
}
nowFile
=
file
;
string
cdb
=
MyPath
.
Combine
(
Path
.
GetDirectoryName
(
file
),
"../cards.cdb"
);
public
bool
Open
(
string
file
)
{
if
(!
string
.
IsNullOrEmpty
(
file
))
{
if
(!
File
.
Exists
(
file
))
{
FileStream
fs
=
new
FileStream
(
file
,
FileMode
.
Create
);
fs
.
Close
();
}
nowFile
=
file
;
string
cdb
=
MyPath
.
Combine
(
Path
.
GetDirectoryName
(
file
),
"../cards.cdb"
);
SetCardDB
(
cdb
);
fctb
.
OpenFile
(
nowFile
,
new
UTF8Encoding
(
false
));
oldtext
=
fctb
.
Text
;
SetTitle
();
fctb
.
OpenFile
(
nowFile
,
new
UTF8Encoding
(
false
));
oldtext
=
fctb
.
Text
;
SetTitle
();
return
true
;
}
}
return
false
;
}
void
HideMenu
()
{
if
(
this
.
MdiParent
==
null
)
return
;
mainMenu
.
Visible
=
false
;
menuitem_file
.
Visible
=
false
;
menuitem_file
.
Enabled
=
false
;
}
void
CodeEditFormLoad
(
object
sender
,
EventArgs
e
)
{
HideMenu
();
fctb
.
OnTextChangedDelayed
(
fctb
.
Range
);
}
#
endregion
#
region
doc
map
void
ShowMapToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
if
(
menuitem_showmap
.
Checked
)
{
documentMap1
.
Visible
=
false
;
menuitem_showmap
.
Checked
=
false
;
fctb
.
Width
+=
documentMap1
.
Width
;
}
else
{
documentMap1
.
Visible
=
true
;
menuitem_showmap
.
Checked
=
true
;
fctb
.
Width
-=
documentMap1
.
Width
;
}
}
#
endregion
#
region
title
void
SetTitle
()
{
string
str
=
title
;
if
(
string
.
IsNullOrEmpty
(
nowFile
))
str
=
title
;
else
str
=
nowFile
+
"-"
+
title
;
if
(
this
.
MdiParent
!=
null
)
{
if
(
string
.
IsNullOrEmpty
(
nowFile
))
this
.
Text
=
title
;
else
this
.
Text
=
Path
.
GetFileName
(
nowFile
);
this
.
MdiParent
.
Text
=
str
;
}
else
this
.
Text
=
str
;
}
void
CodeEditFormEnter
(
object
sender
,
EventArgs
e
)
{
SetTitle
();
}
#
endregion
#
region
tooltip
public
void
InitTooltip
(
CodeConfig
codeconfig
)
{
}
void
HideMenu
()
{
if
(
this
.
MdiParent
==
null
)
return
;
mainMenu
.
Visible
=
false
;
menuitem_file
.
Visible
=
false
;
menuitem_file
.
Enabled
=
false
;
}
void
CodeEditFormLoad
(
object
sender
,
EventArgs
e
)
{
HideMenu
();
fctb
.
OnTextChangedDelayed
(
fctb
.
Range
);
}
#
endregion
#
region
doc
map
void
ShowMapToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
if
(
menuitem_showmap
.
Checked
)
{
documentMap1
.
Visible
=
false
;
menuitem_showmap
.
Checked
=
false
;
fctb
.
Width
+=
documentMap1
.
Width
;
}
else
{
documentMap1
.
Visible
=
true
;
menuitem_showmap
.
Checked
=
true
;
fctb
.
Width
-=
documentMap1
.
Width
;
}
}
#
endregion
#
region
title
void
SetTitle
()
{
string
str
=
title
;
if
(
string
.
IsNullOrEmpty
(
nowFile
))
str
=
title
;
else
str
=
nowFile
+
"-"
+
title
;
if
(
this
.
MdiParent
!=
null
)
{
if
(
string
.
IsNullOrEmpty
(
nowFile
))
this
.
Text
=
title
;
else
this
.
Text
=
Path
.
GetFileName
(
nowFile
);
this
.
MdiParent
.
Text
=
str
;
}
else
this
.
Text
=
str
;
}
void
CodeEditFormEnter
(
object
sender
,
EventArgs
e
)
{
SetTitle
();
}
#
endregion
#
region
tooltip
public
void
InitTooltip
(
CodeConfig
codeconfig
)
{
this
.
tooltipDic
=
codeconfig
.
TooltipDic
;
List
<
AutocompleteItem
>
items
=
new
List
<
AutocompleteItem
>();
List
<
AutocompleteItem
>
items
=
new
List
<
AutocompleteItem
>();
items
.
AddRange
(
codeconfig
.
FunList
);
items
.
AddRange
(
codeconfig
.
ConList
);
popupMenu
.
Items
.
SetAutocompleteItems
(
items
);
popupMenu
.
Items
.
SetAutocompleteItems
(
items
);
popupMenu_con
.
Items
.
SetAutocompleteItems
(
codeconfig
.
ConList
);
popupMenu_fun
.
Items
.
SetAutocompleteItems
(
codeconfig
.
FunList
);
}
string
FindTooltip
(
string
word
)
{
string
desc
=
""
;
foreach
(
string
v
in
tooltipDic
.
Keys
)
{
int
t
=
v
.
IndexOf
(
"."
);
string
k
=
v
;
if
(
t
>
0
)
k
=
v
.
Substring
(
t
+
1
);
if
(
word
==
k
)
desc
=
tooltipDic
[
v
];
}
return
desc
;
}
void
FctbToolTipNeeded
(
object
sender
,
ToolTipNeededEventArgs
e
)
{
if
(!
string
.
IsNullOrEmpty
(
e
.
HoveredWord
))
{
long
tl
=
0
;
string
name
=
e
.
HoveredWord
;
string
desc
=
""
;
if
(!
name
.
StartsWith
(
"0x"
)
&&
name
.
Length
<=
9
)
{
name
=
name
.
Replace
(
"c"
,
""
);
long
.
TryParse
(
name
,
out
tl
);
}
if
(
tl
>
0
){
if
(
cardlist
.
ContainsKey
(
tl
))
desc
=
cardlist
[
tl
];
}
else
desc
=
FindTooltip
(
e
.
HoveredWord
);
if
(!
string
.
IsNullOrEmpty
(
desc
))
{
e
.
ToolTipTitle
=
e
.
HoveredWord
;
e
.
ToolTipText
=
desc
;
}
}
}
#
endregion
#
region
Key
void
FctbKeyDown
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyData
==
(
Keys
.
K
|
Keys
.
Control
))
{
//forced show (MinFragmentLength will be ignored)
popupMenu_fun
.
Show
(
true
);
e
.
Handled
=
true
;
}
else
if
(
e
.
KeyData
==
(
Keys
.
T
|
Keys
.
Control
))
{
//forced show (MinFragmentLength will be ignored)
popupMenu_con
.
Show
(
true
);
e
.
Handled
=
true
;
}
//else if(e.KeyData == Keys(Keys.Control | Keys
}
#
endregion
#
region
input
void
Menuitem_showinputClick
(
object
sender
,
EventArgs
e
)
{
if
(
menuitem_showinput
.
Checked
)
{
menuitem_showinput
.
Checked
=
false
;
tb_input
.
Visible
=
false
;
}
else
{
menuitem_showinput
.
Checked
=
true
;
tb_input
.
Visible
=
true
;
}
}
#
endregion
#
region
menu
void
Menuitem_findClick
(
object
sender
,
EventArgs
e
)
{
fctb
.
ShowFindDialog
();
}
void
Menuitem_replaceClick
(
object
sender
,
EventArgs
e
)
{
fctb
.
ShowReplaceDialog
();
}
}
string
FindTooltip
(
string
word
)
{
string
desc
=
""
;
foreach
(
string
v
in
tooltipDic
.
Keys
)
{
int
t
=
v
.
IndexOf
(
"."
);
string
k
=
v
;
if
(
t
>
0
)
k
=
v
.
Substring
(
t
+
1
);
if
(
word
==
k
)
desc
=
tooltipDic
[
v
];
}
return
desc
;
}
void
FctbToolTipNeeded
(
object
sender
,
ToolTipNeededEventArgs
e
)
{
if
(!
string
.
IsNullOrEmpty
(
e
.
HoveredWord
))
{
long
tl
=
0
;
string
name
=
e
.
HoveredWord
;
string
desc
=
""
;
if
(!
name
.
StartsWith
(
"0x"
)
&&
name
.
Length
<=
9
)
{
name
=
name
.
Replace
(
"c"
,
""
);
long
.
TryParse
(
name
,
out
tl
);
}
if
(
tl
>
0
)
{
if
(
cardlist
.
ContainsKey
(
tl
))
desc
=
cardlist
[
tl
];
}
else
desc
=
FindTooltip
(
e
.
HoveredWord
);
if
(!
string
.
IsNullOrEmpty
(
desc
))
{
e
.
ToolTipTitle
=
e
.
HoveredWord
;
e
.
ToolTipText
=
desc
;
}
}
}
#
endregion
#
region
Key
void
FctbKeyDown
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyData
==
(
Keys
.
K
|
Keys
.
Control
))
{
//forced show (MinFragmentLength will be ignored)
popupMenu_fun
.
Show
(
true
);
e
.
Handled
=
true
;
}
else
if
(
e
.
KeyData
==
(
Keys
.
T
|
Keys
.
Control
))
{
//forced show (MinFragmentLength will be ignored)
popupMenu_con
.
Show
(
true
);
e
.
Handled
=
true
;
}
//else if(e.KeyData == Keys(Keys.Control | Keys
}
#
endregion
#
region
input
void
Menuitem_showinputClick
(
object
sender
,
EventArgs
e
)
{
if
(
menuitem_showinput
.
Checked
)
{
menuitem_showinput
.
Checked
=
false
;
tb_input
.
Visible
=
false
;
}
else
{
menuitem_showinput
.
Checked
=
true
;
tb_input
.
Visible
=
true
;
}
}
#
endregion
#
region
menu
void
Menuitem_findClick
(
object
sender
,
EventArgs
e
)
{
fctb
.
ShowFindDialog
();
}
void
Menuitem_replaceClick
(
object
sender
,
EventArgs
e
)
{
fctb
.
ShowReplaceDialog
();
}
bool
savefile
(
bool
saveas
)
{
string
alltext
=
fctb
.
Text
;
if
(!
tabisspaces
)
if
(!
tabisspaces
)
alltext
=
alltext
.
Replace
(
" "
,
"\t"
);
if
(
saveas
)
{
...
...
@@ -317,119 +322,123 @@ bool savefile(bool saveas)
return
true
;
}
public
bool
Save
()
{
return
savefile
(
string
.
IsNullOrEmpty
(
nowFile
));
}
{
return
savefile
(
string
.
IsNullOrEmpty
(
nowFile
));
}
public
bool
SaveAs
()
{
{
return
savefile
(
true
);
}
void
SaveToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
Save
();
}
void
SaveAsToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
SaveAs
();
}
void
QuitToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
this
.
Close
();
}
void
AboutToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
MyMsg
.
Show
(
LANG
.
GetMsg
(
LMSG
.
About
)+
"\t"
+
Application
.
ProductName
+
"\n"
+
LANG
.
GetMsg
(
LMSG
.
Version
)+
"\t1.1.0.0\n"
}
void
SaveToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
Save
();
}
void
SaveAsToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
SaveAs
();
}
void
QuitToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
this
.
Close
();
}
void
AboutToolStripMenuItemClick
(
object
sender
,
EventArgs
e
)
{
MyMsg
.
Show
(
LANG
.
GetMsg
(
LMSG
.
About
)
+
"\t"
+
Application
.
ProductName
+
"\n"
+
LANG
.
GetMsg
(
LMSG
.
Version
)
+
"\t1.1.0.0\n"
+
LANG
.
GetMsg
(
LMSG
.
Author
)
+
"\t柯永裕\n"
+
"Email:\t247321453@qq.com"
);
}
void
Menuitem_openClick
(
object
sender
,
EventArgs
e
)
{
using
(
OpenFileDialog
sfdlg
=
new
OpenFileDialog
())
{
sfdlg
.
Filter
=
"Script(*.lua)|*.lua|All Files(*.*)|*.*"
;
if
(
sfdlg
.
ShowDialog
()==
DialogResult
.
OK
)
{
nowFile
=
sfdlg
.
FileName
;
fctb
.
OpenFile
(
nowFile
,
new
UTF8Encoding
(
false
));
}
}
}
#
endregion
#
region
find
void
Tb_inputKeyDown
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyCode
==
Keys
.
Enter
)
{
//
string
key
=
tb_input
.
Text
;
List
<
AutocompleteItem
>
tlist
=
new
List
<
AutocompleteItem
>();
foreach
(
string
k
in
tooltipDic
.
Keys
)
{
if
(
tooltipDic
[
k
].
IndexOf
(
key
)>=
0
)
{
AutocompleteItem
ai
=
new
AutocompleteItem
(
k
);
ai
.
ToolTipTitle
=
k
;
ai
.
ToolTipText
=
tooltipDic
[
k
];
tlist
.
Add
(
ai
);
}
}
popupMenu_find
.
Items
.
SetAutocompleteItems
(
tlist
.
ToArray
());
popupMenu_find
.
Show
(
true
);
}
}
#
endregion
+
"Email:\t247321453@qq.com"
);
}
void
Menuitem_openClick
(
object
sender
,
EventArgs
e
)
{
using
(
OpenFileDialog
sfdlg
=
new
OpenFileDialog
())
{
sfdlg
.
Filter
=
"Script(*.lua)|*.lua|All Files(*.*)|*.*"
;
if
(
sfdlg
.
ShowDialog
()
==
DialogResult
.
OK
)
{
nowFile
=
sfdlg
.
FileName
;
fctb
.
OpenFile
(
nowFile
,
new
UTF8Encoding
(
false
));
}
}
}
#
endregion
#
region
find
void
Tb_inputKeyDown
(
object
sender
,
KeyEventArgs
e
)
{
if
(
e
.
KeyCode
==
Keys
.
Enter
)
{
//
string
key
=
tb_input
.
Text
;
List
<
AutocompleteItem
>
tlist
=
new
List
<
AutocompleteItem
>();
foreach
(
string
k
in
tooltipDic
.
Keys
)
{
if
(
tooltipDic
[
k
].
IndexOf
(
key
)
>=
0
)
{
AutocompleteItem
ai
=
new
AutocompleteItem
(
k
);
ai
.
ToolTipTitle
=
k
;
ai
.
ToolTipText
=
tooltipDic
[
k
];
tlist
.
Add
(
ai
);
}
}
popupMenu_find
.
Items
.
SetAutocompleteItems
(
tlist
.
ToArray
());
popupMenu_find
.
Show
(
true
);
}
}
#
endregion
#
region
close
void
CodeEditFormFormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
if
(!
string
.
IsNullOrEmpty
(
oldtext
))
{
if
(
fctb
.
Text
!=
oldtext
){
if
(
MyMsg
.
Question
(
LMSG
.
IfSaveScript
))
Save
();
}
}
else
if
(
fctb
.
Text
.
Length
>
0
){
if
(
MyMsg
.
Question
(
LMSG
.
IfSaveScript
))
Save
();
}
}
{
if
(!
string
.
IsNullOrEmpty
(
oldtext
))
{
if
(
fctb
.
Text
!=
oldtext
)
{
if
(
MyMsg
.
Question
(
LMSG
.
IfSaveScript
))
Save
();
}
}
else
if
(
fctb
.
Text
.
Length
>
0
)
{
if
(
MyMsg
.
Question
(
LMSG
.
IfSaveScript
))
Save
();
}
}
#
endregion
#
region
card
tooltip
public
void
SetCDBList
(
string
[]
cdbs
)
{
if
(
cdbs
==
null
)
return
;
foreach
(
string
cdb
in
cdbs
)
{
ToolStripMenuItem
tsmi
=
new
ToolStripMenuItem
(
cdb
);
tsmi
.
Click
+=
MenuItem_Click
;
menuitem_setcard
.
DropDownItems
.
Add
(
tsmi
);
}
}
void
MenuItem_Click
(
object
sender
,
EventArgs
e
)
{
ToolStripMenuItem
tsmi
=
sender
as
ToolStripMenuItem
;
if
(
tsmi
!=
null
){
string
file
=
tsmi
.
Text
;
SetCardDB
(
file
);
}
}
public
void
SetCardDB
(
string
name
)
{
{
if
(
cdbs
==
null
)
return
;
foreach
(
string
cdb
in
cdbs
)
{
ToolStripMenuItem
tsmi
=
new
ToolStripMenuItem
(
cdb
);
tsmi
.
Click
+=
MenuItem_Click
;
menuitem_setcard
.
DropDownItems
.
Add
(
tsmi
);
}
}
void
MenuItem_Click
(
object
sender
,
EventArgs
e
)
{
ToolStripMenuItem
tsmi
=
sender
as
ToolStripMenuItem
;
if
(
tsmi
!=
null
)
{
string
file
=
tsmi
.
Text
;
SetCardDB
(
file
);
}
}
public
void
SetCardDB
(
string
name
)
{
nowcdb
=
name
;
if
(!
backgroundWorker1
.
IsBusy
)
backgroundWorker1
.
RunWorkerAsync
();
}
}
private
void
backgroundWorker1_DoWork
(
object
sender
,
System
.
ComponentModel
.
DoWorkEventArgs
e
)
{
if
(
nowcdb
!=
null
&&
File
.
Exists
(
nowcdb
))
...
...
@@ -449,40 +458,40 @@ public void SetCards(Card[] cards)
#
region
selection
void
FctbSelectionChangedDelayed
(
object
sender
,
EventArgs
e
)
{
tb_input
.
Text
=
fctb
.
SelectedText
;
fctb
.
VisibleRange
.
ClearStyle
(
SameWordsStyle
);
if
(!
fctb
.
Selection
.
IsEmpty
)
return
;
//user selected diapason
//get fragment around caret
var
fragment
=
fctb
.
Selection
.
GetFragment
(
@"\w"
);
string
text
=
fragment
.
Text
;
if
(
text
.
Length
==
0
)
return
;
//highlight same words
var
ranges
=
fctb
.
VisibleRange
.
GetRanges
(
"\\b"
+
text
+
"\\b"
);
foreach
(
var
r
in
ranges
)
r
.
SetStyle
(
SameWordsStyle
);
}
{
tb_input
.
Text
=
fctb
.
SelectedText
;
fctb
.
VisibleRange
.
ClearStyle
(
SameWordsStyle
);
if
(!
fctb
.
Selection
.
IsEmpty
)
return
;
//user selected diapason
//get fragment around caret
var
fragment
=
fctb
.
Selection
.
GetFragment
(
@"\w"
);
string
text
=
fragment
.
Text
;
if
(
text
.
Length
==
0
)
return
;
//highlight same words
var
ranges
=
fctb
.
VisibleRange
.
GetRanges
(
"\\b"
+
text
+
"\\b"
);
foreach
(
var
r
in
ranges
)
r
.
SetStyle
(
SameWordsStyle
);
}
#
endregion
#
region
goto
function
define
void
FctbMouseClick
(
object
sender
,
MouseEventArgs
e
)
{
var
fragment
=
fctb
.
Selection
.
GetFragment
(
@"\w"
);
string
text
=
fragment
.
Text
;
if
(
text
.
Length
==
0
)
return
;
if
(
e
.
Button
==
MouseButtons
.
Left
&&
Control
.
ModifierKeys
==
Keys
.
Control
)
{
List
<
int
>
linenums
=
fctb
.
FindLines
(
@"function\s+?\S+?\."
+
text
+
@"\("
,
RegexOptions
.
Singleline
);
if
(
linenums
.
Count
>
0
)
{
fctb
.
Navigate
(
linenums
[
0
]);
//MessageBox.Show(linenums[0].ToString());
}
}
{
var
fragment
=
fctb
.
Selection
.
GetFragment
(
@"\w"
);
string
text
=
fragment
.
Text
;
if
(
text
.
Length
==
0
)
return
;
if
(
e
.
Button
==
MouseButtons
.
Left
&&
Control
.
ModifierKeys
==
Keys
.
Control
)
{
List
<
int
>
linenums
=
fctb
.
FindLines
(
@"function\s+?\S+?\."
+
text
+
@"\("
,
RegexOptions
.
Singleline
);
if
(
linenums
.
Count
>
0
)
{
fctb
.
Navigate
(
linenums
[
0
]);
//MessageBox.Show(linenums[0].ToString());
}
}
}
#
endregion
...
...
DataEditorX/Common/CheckUpdate.cs
View file @
346dfc10
...
...
@@ -18,51 +18,54 @@ namespace DataEditorX
/// </summary>
public
static
class
CheckUpdate
{
static
CheckUpdate
()
{
ServicePointManager
.
DefaultConnectionLimit
=
255
;
}
public
static
string
URL
=
""
;
static
string
HEAD
=
"[DataEditorX]"
,
HEAD2
=
"[URL]"
;
public
static
bool
isOK
=
false
;
static
CheckUpdate
()
{
ServicePointManager
.
DefaultConnectionLimit
=
255
;
}
public
static
string
URL
=
""
;
static
string
HEAD
=
"[DataEditorX]"
,
HEAD2
=
"[URL]"
;
public
static
bool
isOK
=
false
;
#
region
检查版本
public
static
string
Check
(
string
VERURL
)
{
string
urlver
=
"0.0.0.0"
;
string
html
=
GetHtmlContentByUrl
(
VERURL
);
if
(!
string
.
IsNullOrEmpty
(
html
))
string
urlver
=
"0.0.0.0"
;
string
html
=
GetHtmlContentByUrl
(
VERURL
);
if
(!
string
.
IsNullOrEmpty
(
html
))
{
int
t
,
w
;
t
=
html
.
IndexOf
(
HEAD
);
w
=(
t
>
0
)?
html
.
IndexOf
(
HEAD
,
t
+
HEAD
.
Length
):
0
;
if
(
w
>
0
)
int
t
,
w
;
t
=
html
.
IndexOf
(
HEAD
);
w
=
(
t
>
0
)
?
html
.
IndexOf
(
HEAD
,
t
+
HEAD
.
Length
)
:
0
;
if
(
w
>
0
)
{
urlver
=
html
.
Substring
(
t
+
HEAD
.
Length
,
w
-
t
-
HEAD
.
Length
);
urlver
=
html
.
Substring
(
t
+
HEAD
.
Length
,
w
-
t
-
HEAD
.
Length
);
}
t
=
html
.
IndexOf
(
HEAD2
);
w
=(
t
>
0
)?
html
.
IndexOf
(
HEAD2
,
t
+
HEAD2
.
Length
):
0
;
if
(
w
>
0
)
t
=
html
.
IndexOf
(
HEAD2
);
w
=
(
t
>
0
)
?
html
.
IndexOf
(
HEAD2
,
t
+
HEAD2
.
Length
)
:
0
;
if
(
w
>
0
)
{
URL
=
html
.
Substring
(
t
+
HEAD2
.
Length
,
w
-
t
-
HEAD2
.
Length
);
URL
=
html
.
Substring
(
t
+
HEAD2
.
Length
,
w
-
t
-
HEAD2
.
Length
);
}
}
return
urlver
;
}
#
endregion
#
region
获取网址内容
public
static
string
GetHtmlContentByUrl
(
string
url
)
{
string
htmlContent
=
string
.
Empty
;
try
{
try
{
HttpWebRequest
httpWebRequest
=
(
HttpWebRequest
)
WebRequest
.
Create
(
url
);
httpWebRequest
.
Timeout
=
15000
;
using
(
HttpWebResponse
httpWebResponse
=
using
(
HttpWebResponse
httpWebResponse
=
(
HttpWebResponse
)
httpWebRequest
.
GetResponse
())
{
using
(
Stream
stream
=
httpWebResponse
.
GetResponseStream
())
using
(
Stream
stream
=
httpWebResponse
.
GetResponseStream
())
{
using
(
StreamReader
streamReader
=
using
(
StreamReader
streamReader
=
new
StreamReader
(
stream
,
Encoding
.
UTF8
))
{
htmlContent
=
streamReader
.
ReadToEnd
();
...
...
@@ -74,13 +77,15 @@ public static string GetHtmlContentByUrl(string url)
}
return
htmlContent
;
}
catch
{
catch
{
}
return
""
;
}
#
endregion
#
region
下载文件
public
static
bool
DownLoad
(
string
filename
)
{
try
...
...
@@ -88,9 +93,9 @@ public static bool DownLoad(string filename)
HttpWebRequest
Myrq
=
(
HttpWebRequest
)
System
.
Net
.
HttpWebRequest
.
Create
(
URL
);
HttpWebResponse
myrp
=
(
HttpWebResponse
)
Myrq
.
GetResponse
();
long
totalBytes
=
myrp
.
ContentLength
;
Stream
st
=
myrp
.
GetResponseStream
();
Stream
so
=
new
System
.
IO
.
FileStream
(
filename
+
".tmp"
,
FileMode
.
Create
);
Stream
so
=
new
System
.
IO
.
FileStream
(
filename
+
".tmp"
,
FileMode
.
Create
);
long
totalDownloadedByte
=
0
;
byte
[]
by
=
new
byte
[
2048
];
int
osize
=
st
.
Read
(
by
,
0
,
(
int
)
by
.
Length
);
...
...
@@ -103,14 +108,15 @@ public static bool DownLoad(string filename)
}
so
.
Close
();
st
.
Close
();
File
.
Move
(
filename
+
".tmp"
,
filename
);
File
.
Move
(
filename
+
".tmp"
,
filename
);
}
catch
(
System
.
Exception
)
{
isOK
=
false
;
isOK
=
false
;
}
isOK
=
true
;
isOK
=
true
;
return
isOK
;
}
#
endregion
}
}
DataEditorX/Common/MyPath.cs
View file @
346dfc10
...
...
@@ -68,5 +68,24 @@ public static string Combine(params string[] paths)
return
builder
.
ToString
();
}
}
//检查目录是否合法
public
static
string
CheckDir
(
string
dir
,
string
defalut
)
{
DirectoryInfo
fo
;
try
{
fo
=
new
DirectoryInfo
(
MyPath
.
GetFullPath
(
dir
));
}
catch
{
//路径不合法
fo
=
new
DirectoryInfo
(
defalut
);
}
if
(!
fo
.
Exists
)
fo
.
Create
();
dir
=
fo
.
FullName
;
return
dir
;
}
}
}
DataEditorX/Config/CodeConfig.cs
View file @
346dfc10
...
...
@@ -11,6 +11,13 @@ namespace DataEditorX.Config
/// </summary>
public
class
CodeConfig
{
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"
;
#
region
成员
public
CodeConfig
()
{
...
...
DataEditorX/Config/DataConfig.cs
View file @
346dfc10
...
...
@@ -16,9 +16,17 @@ namespace DataEditorX.Config
/// </summary>
public
class
DataConfig
{
public
const
string
FILE_INFO
=
"card-info.txt"
;
public
const
string
TAG_RULE
=
"rule"
;
public
const
string
TAG_RACE
=
"race"
;
public
const
string
TAG_ATTRIBUTE
=
"attribute"
;
public
const
string
TAG_LEVEL
=
"level"
;
public
const
string
TAG_CATEGORY
=
"category"
;
public
const
string
TAG_TYPE
=
"type"
;
public
const
string
TAG_SETNAME
=
"setname"
;
public
DataConfig
()
{
InitMember
(
MyPath
.
Combine
(
Application
.
StartupPath
,
MyConfig
.
FILE_INFO
));
InitMember
(
MyPath
.
Combine
(
Application
.
StartupPath
,
FILE_INFO
));
}
public
DataConfig
(
string
conf
)
{
...
...
@@ -40,13 +48,13 @@ public void InitMember(string conf)
}
//提取内容
string
text
=
File
.
ReadAllText
(
conf
);
dicCardRules
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_RULE
);
dicSetnames
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_SETNAME
);
dicCardTypes
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_TYPE
);
dicCardcategorys
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_CATEGORY
);
dicCardAttributes
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_ATTRIBUTE
);
dicCardRaces
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_RACE
);
dicCardLevels
=
DataManager
.
Read
(
text
,
MyConfig
.
TAG_LEVEL
);
dicCardRules
=
DataManager
.
Read
(
text
,
TAG_RULE
);
dicSetnames
=
DataManager
.
Read
(
text
,
TAG_SETNAME
);
dicCardTypes
=
DataManager
.
Read
(
text
,
TAG_TYPE
);
dicCardcategorys
=
DataManager
.
Read
(
text
,
TAG_CATEGORY
);
dicCardAttributes
=
DataManager
.
Read
(
text
,
TAG_ATTRIBUTE
);
dicCardRaces
=
DataManager
.
Read
(
text
,
TAG_RACE
);
dicCardLevels
=
DataManager
.
Read
(
text
,
TAG_LEVEL
);
}
...
...
DataEditorX/Config/ImageSet.cs
View file @
346dfc10
...
...
@@ -15,6 +15,11 @@ namespace DataEditorX.Config
public
class
ImageSet
{
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"
;
bool
isInit
;
public
ImageSet
(){
isInit
=
false
;
...
...
@@ -24,20 +29,20 @@ public void Init()
if
(
isInit
)
return
;
isInit
=
true
;
this
.
normalArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_OTHER
);
this
.
normalArea
=
MyConfig
.
readArea
(
TAG_IMAGE_OTHER
);
this
.
xyzArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_XYZ
);
this
.
xyzArea
=
MyConfig
.
readArea
(
TAG_IMAGE_XYZ
);
this
.
pendulumArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_PENDULUM
);
this
.
pendulumArea
=
MyConfig
.
readArea
(
TAG_IMAGE_PENDULUM
);
int
[]
ints
=
MyConfig
.
readIntegers
(
MyConfig
.
TAG_IMAGE_SIZE
,
4
);
int
[]
ints
=
MyConfig
.
readIntegers
(
TAG_IMAGE_SIZE
,
4
);
this
.
w
=
ints
[
0
];
this
.
h
=
ints
[
1
];
this
.
W
=
ints
[
2
];
this
.
H
=
ints
[
3
];
this
.
quilty
=
MyConfig
.
readInteger
(
MyConfig
.
TAG_IMAGE_QUILTY
,
95
);
this
.
quilty
=
MyConfig
.
readInteger
(
TAG_IMAGE_QUILTY
,
95
);
}
public
int
quilty
;
public
int
w
,
h
,
W
,
H
;
...
...
DataEditorX/Config/MSEConfig.cs
View file @
346dfc10
...
...
@@ -37,16 +37,16 @@ public class MSEConfig
public
const
string
TAG_MONSTER
=
"monster"
;
public
const
string
TAG_PENDULUM
=
"pendulum"
;
public
const
string
TAG_SPELL_TRAP
=
"spelltrap"
;
public
const
string
FILE_CONFIG
=
"mse-config.txt"
;
public
const
string
FILE_TEMPLATE
=
"mse-template.txt"
;
string
_path
;
public
MSEConfig
(
string
path
)
{
Iscn2tw
=
false
;
_path
=
path
;
regx_monster
=
"(\\s\\S*?)"
;
regx_pendulum
=
"(\\s\\S*?)"
;
string
file
=
MyPath
.
Combine
(
path
,
MyConfig
.
TAG_MS
E_TEMPLATE
);
string
file
=
MyPath
.
Combine
(
path
,
FIL
E_TEMPLATE
);
if
(
File
.
Exists
(
file
))
{
string
content
=
File
.
ReadAllText
(
file
,
Encoding
.
UTF8
);
...
...
@@ -56,8 +56,8 @@ public MSEConfig(string path)
spelltrap
=
DataManager
.
subString
(
content
,
TAG_SPELL_TRAP
);
}
string
tmp
=
Path
.
Combine
(
path
,
"mse-config.txt"
);
string
tmp
=
MyPath
.
Combine
(
path
,
FILE_CONFIG
);
replaces
=
new
List
<
RegStr
>();
if
(
File
.
Exists
(
tmp
))
...
...
@@ -80,7 +80,7 @@ public MSEConfig(string path)
else
if
(
line
.
StartsWith
(
"maxcount"
))
int
.
TryParse
(
getValue
(
line
),
out
maxcount
);
else
if
(
line
.
StartsWith
(
"imagepath"
))
imagepath
=
CheckDir
(
getValue
(
line
));
imagepath
=
MyPath
.
CheckDir
(
getValue
(
line
),
MyPath
.
Combine
(
path
,
"Images"
));
else
if
(
line
.
StartsWith
(
"replace"
)){
string
word
=
getValue
(
line
);
int
t
=
word
.
IndexOf
(
" "
);
...
...
@@ -103,25 +103,6 @@ public MSEConfig(string path)
Iscn2tw
=
false
;
}
}
string
CheckDir
(
string
dir
)
{
DirectoryInfo
fo
;
try
{
fo
=
new
DirectoryInfo
(
MyPath
.
GetFullPath
(
dir
));
}
catch
{
//路径不合法
dir
=
MyPath
.
Combine
(
_path
,
"Images"
);
fo
=
new
DirectoryInfo
(
dir
);
}
if
(!
fo
.
Exists
)
fo
.
Create
();
dir
=
fo
.
FullName
;
return
dir
;
}
string
getRegex
(
string
word
)
{
return
word
.
Replace
(
"\\n"
,
"\n"
).
Replace
(
"\\t"
,
"\t"
);
...
...
DataEditorX/Config/MyConfig.cs
View file @
346dfc10
...
...
@@ -12,38 +12,16 @@ class MyConfig
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_HISTORY
=
"history.txt"
;
public
const
string
FILE_INFO
=
"card-info.txt"
;
public
const
string
FILE_FUNCTION
=
"_functions.txt"
;
public
const
string
FILE_CONSTANT
=
"constant.lua"
;
public
const
string
FILE_STRINGS
=
"strings.conf"
;
public
const
string
TAG_RULE
=
"rule"
;
public
const
string
TAG_RACE
=
"race"
;
public
const
string
TAG_ATTRIBUTE
=
"attribute"
;
public
const
string
TAG_LEVEL
=
"level"
;
public
const
string
TAG_CATEGORY
=
"category"
;
public
const
string
TAG_TYPE
=
"type"
;
public
const
string
TAG_SETNAME
=
"setname"
;
public
const
string
TAG_MSE_CONFIG
=
"mse-config.txt"
;
public
const
string
TAG_MSE_TEMPLATE
=
"mse-template.txt"
;
public
const
string
TAG_SOURCE_URL
=
"sourceURL"
;
public
const
string
TAG_UPDATE_URL
=
"updateURL"
;
public
static
string
readString
(
string
key
)
{
...
...
DataEditorX/Core/TaskHelper.cs
View file @
346dfc10
...
...
@@ -21,57 +21,77 @@
namespace
DataEditorX.Core
{
public
enum
MyTask
{
NONE
,
CheckUpdate
,
ExportData
,
SaveAsMSE
,
CutImages
,
ConvertImages
,
}
/// <summary>
/// Description of TaskHelper.
/// </summary>
public
class
TaskHelper
{
private
MyTask
nowTask
=
MyTask
.
NONE
;
private
MyTask
lastTask
=
MyTask
.
NONE
;
private
Card
[]
cardlist
;
private
string
[]
mArgs
;
private
ImageSet
imgSet
=
new
ImageSet
();
private
MSE
mseHelper
;
private
bool
isCancel
=
false
;
private
bool
isRun
=
false
;
private
BackgroundWorker
worker
;
public
enum
MyTask
{
NONE
,
CheckUpdate
,
ExportData
,
SaveAsMSE
,
CutImages
,
ConvertImages
,
}
/// <summary>
/// Description of TaskHelper.
/// </summary>
public
class
TaskHelper
{
#
region
Member
private
MyTask
nowTask
=
MyTask
.
NONE
;
private
MyTask
lastTask
=
MyTask
.
NONE
;
private
Card
[]
cardlist
;
private
string
[]
mArgs
;
private
ImageSet
imgSet
=
new
ImageSet
();
private
MSE
mseHelper
;
private
bool
isCancel
=
false
;
private
bool
isRun
=
false
;
private
BackgroundWorker
worker
;
public
TaskHelper
(
string
datapath
,
BackgroundWorker
worker
,
Dictionary
<
long
,
string
>
typedic
,
Dictionary
<
long
,
string
>
racedic
)
{
this
.
worker
=
worker
;
mseHelper
=
new
MSE
(
datapath
,
typedic
,
racedic
);
imgSet
.
Init
();
}
public
bool
IsRuning
()
{
return
isRun
;
}
public
bool
IsCancel
()
{
return
isCancel
;
}
public
void
Cancel
()
{
isCancel
=
true
;
}
public
MyTask
getLastTask
(){
return
lastTask
;
}
public
void
SetTask
(
MyTask
myTask
,
Card
[]
cards
,
params
string
[]
args
){
nowTask
=
myTask
;
cardlist
=
cards
;
mArgs
=
args
;
}
public
TaskHelper
(
string
datapath
,
BackgroundWorker
worker
,
Dictionary
<
long
,
string
>
typedic
,
Dictionary
<
long
,
string
>
racedic
)
{
this
.
worker
=
worker
;
mseHelper
=
new
MSE
(
datapath
,
typedic
,
racedic
);
imgSet
.
Init
();
}
public
bool
IsRuning
()
{
return
isRun
;
}
public
bool
IsCancel
()
{
return
isCancel
;
}
public
void
Cancel
()
{
isCancel
=
true
;
}
public
MyTask
getLastTask
()
{
return
lastTask
;
}
#
endregion
#
region
Other
public
void
SetTask
(
MyTask
myTask
,
Card
[]
cards
,
params
string
[]
args
)
{
nowTask
=
myTask
;
cardlist
=
cards
;
mArgs
=
args
;
}
public
void
ToImg
(
string
img
,
string
saveimg1
,
string
saveimg2
)
{
if
(!
File
.
Exists
(
img
))
return
;
Bitmap
bmp
=
new
Bitmap
(
img
);
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
W
,
imgSet
.
H
),
saveimg1
,
imgSet
.
quilty
);
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
w
,
imgSet
.
h
),
saveimg2
,
imgSet
.
quilty
);
}
#
endregion
#
region
检查更新
public
static
void
CheckVersion
(
bool
showNew
)
{
string
newver
=
CheckUpdate
.
Check
(
MyConfig
.
readString
(
MyConfig
.
TAG_UPDATE_URL
));
...
...
@@ -79,19 +99,19 @@ public static void CheckVersion(bool showNew)
int
.
TryParse
(
Application
.
ProductVersion
.
Replace
(
"."
,
""
),
out
iver
);
int
.
TryParse
(
newver
.
Replace
(
"."
,
""
),
out
iver2
);
if
(
iver2
>
iver
)
{
//
has new version
{
//
有最新版本
if
(!
MyMsg
.
Question
(
LMSG
.
HaveNewVersion
))
return
;
}
else
if
(
iver2
>
0
)
{
//
now is last version
{
//
现在就是最新版本
if
(!
showNew
)
return
;
if
(!
MyMsg
.
Question
(
LMSG
.
NowIsNewVersion
))
return
;
}
else
{
{
//检查失败
if
(!
showNew
)
return
;
MyMsg
.
Error
(
LMSG
.
CheckUpdateFail
);
...
...
@@ -103,239 +123,266 @@ public static void CheckVersion(bool showNew)
else
MyMsg
.
Show
(
LMSG
.
DownloadFail
);
}
public
void
OnCheckUpdate
(
bool
showNew
){
public
void
OnCheckUpdate
(
bool
showNew
)
{
TaskHelper
.
CheckVersion
(
showNew
);
}
public
void
CutImages
(
string
imgpath
,
bool
isreplace
)
{
int
count
=
cardlist
.
Length
;
int
i
=
0
;
foreach
(
Card
c
in
cardlist
)
{
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
((
i
/
count
),
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
string
jpg
=
MyPath
.
Combine
(
imgpath
,
c
.
id
+
".jpg"
);
string
savejpg
=
MyPath
.
Combine
(
mseHelper
.
ImagePath
,
c
.
id
+
".jpg"
);
if
(
File
.
Exists
(
jpg
)
&&
(
isreplace
||
!
File
.
Exists
(
savejpg
))){
Bitmap
bp
=
new
Bitmap
(
jpg
);
Bitmap
bmp
=
null
;
if
(
c
.
IsType
(
CardType
.
TYPE_XYZ
)){
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
xyzArea
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
)){
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
pendulumArea
);
}
else
{
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
normalArea
);
}
MyBitmap
.
SaveAsJPEG
(
bmp
,
savejpg
,
imgSet
.
quilty
);
//bmp.Save(savejpg, ImageFormat.Png);
}
}
}
public
void
ToImg
(
string
img
,
string
saveimg1
,
string
saveimg2
){
if
(!
File
.
Exists
(
img
))
return
;
Bitmap
bmp
=
new
Bitmap
(
img
);
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
W
,
imgSet
.
H
),
saveimg1
,
imgSet
.
quilty
);
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
w
,
imgSet
.
h
),
saveimg2
,
imgSet
.
quilty
);
}
public
void
ConvertImages
(
string
imgpath
,
string
gamepath
,
bool
isreplace
)
{
string
picspath
=
MyPath
.
Combine
(
gamepath
,
"pics"
);
string
thubpath
=
MyPath
.
Combine
(
picspath
,
"thumbnail"
);
string
[]
files
=
Directory
.
GetFiles
(
imgpath
);
int
i
=
0
;
int
count
=
files
.
Length
;
foreach
(
string
f
in
files
){
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
string
ex
=
Path
.
GetExtension
(
f
).
ToLower
();
string
name
=
Path
.
GetFileNameWithoutExtension
(
f
);
string
jpg_b
=
MyPath
.
Combine
(
picspath
,
name
+
".jpg"
);
string
jpg_s
=
MyPath
.
Combine
(
thubpath
,
name
+
".jpg"
);
if
(
ex
==
".jpg"
||
ex
==
".png"
||
ex
==
".bmp"
){
if
(
File
.
Exists
(
f
)){
//存在大图
Bitmap
bmp
=
new
Bitmap
(
f
);
if
(
isreplace
||
!
File
.
Exists
(
jpg_b
)){
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
W
,
imgSet
.
H
),
jpg_b
,
imgSet
.
quilty
);
}
if
(
isreplace
||
!
File
.
Exists
(
jpg_s
)){
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
w
,
imgSet
.
h
),
jpg_s
,
imgSet
.
quilty
);
}
}
}
}
}
public
string
MSEImage
{
get
{
return
mseHelper
.
ImagePath
;}
}
public
void
SaveMSEs
(
string
file
,
Card
[]
cards
,
bool
isUpdate
){
if
(
mseHelper
.
MaxNum
==
0
)
SaveMSE
(
1
,
file
,
cards
,
isUpdate
);
else
{
int
c
=
cards
.
Length
;
int
nums
=
c
/
mseHelper
.
MaxNum
;
if
(
nums
*
mseHelper
.
MaxNum
<
c
)
nums
++;
List
<
Card
>
clist
=
new
List
<
Card
>();
for
(
int
i
=
0
;
i
<
nums
;
i
++)
{
clist
.
Clear
();
for
(
int
j
=
0
;
j
<
mseHelper
.
MaxNum
;
j
++)
{
int
index
=
i
*
mseHelper
.
MaxNum
+
j
;
if
(
index
<
c
)
clist
.
Add
(
cards
[
index
]);
}
int
t
=
file
.
LastIndexOf
(
".mse-set"
);
string
fname
=(
t
>
0
)?
file
.
Substring
(
0
,
t
):
file
;
fname
=
fname
+
string
.
Format
(
"_{0}.mse-set"
,
i
+
1
);
SaveMSE
(
i
+
1
,
fname
,
clist
.
ToArray
(),
isUpdate
);
}
}
}
public
void
SaveMSE
(
int
num
,
string
file
,
Card
[]
cards
,
bool
isUpdate
){
string
setFile
=
file
+
".txt"
;
string
[]
images
=
mseHelper
.
WriteSet
(
setFile
,
cards
);
if
(
isUpdate
)
//仅更新文字
return
;
int
i
=
0
;
int
count
=
images
.
Length
;
using
(
ZipStorer
zips
=
ZipStorer
.
Create
(
file
,
""
))
{
zips
.
EncodeUTF8
=
true
;
zips
.
AddFile
(
setFile
,
"set"
,
""
);
foreach
(
string
img
in
images
)
{
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}-{2}"
,
i
,
count
,
num
));
zips
.
AddFile
(
img
,
Path
.
GetFileName
(
img
),
""
);
}
}
File
.
Delete
(
setFile
);
}
public
void
ExportData
(
string
zipname
)
{
int
i
=
0
;
Card
[]
cards
=
cardlist
;
if
(
cards
==
null
||
cards
.
Length
==
0
)
return
;
int
count
=
cards
.
Length
;
string
path
=
Path
.
GetDirectoryName
(
zipname
);
string
name
=
Path
.
GetFileNameWithoutExtension
(
zipname
);
string
cdbfile
=
zipname
+
".cdb"
;
string
readme
=
MyPath
.
Combine
(
path
,
name
+
".txt"
);
string
deckydk
=
MyPath
.
Combine
(
path
,
"deck/"
+
name
+
".ydk"
);
string
pics
=
MyPath
.
Combine
(
path
,
"pics"
);
string
thumb
=
MyPath
.
Combine
(
pics
,
"thumbnail"
);
string
script
=
MyPath
.
Combine
(
path
,
"script"
);
File
.
Delete
(
cdbfile
);
DataBase
.
Create
(
cdbfile
);
DataBase
.
CopyDB
(
cdbfile
,
false
,
cardlist
);
}
#
endregion
if
(
File
.
Exists
(
zipname
))
File
.
Delete
(
zipname
);
using
(
ZipStorer
zips
=
ZipStorer
.
Create
(
zipname
,
""
))
{
zips
.
AddFile
(
cdbfile
,
name
+
".cdb"
,
""
);
if
(
File
.
Exists
(
readme
))
zips
.
AddFile
(
readme
,
"readme_"
+
name
+
".txt"
,
""
);
if
(
File
.
Exists
(
deckydk
))
zips
.
AddFile
(
deckydk
,
"deck/"
+
name
+
".ydk"
,
""
);
foreach
(
Card
c
in
cards
)
{
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
//zips.AddFile(
string
jpg1
=
MyPath
.
Combine
(
pics
,
c
.
id
.
ToString
()+
".jpg"
);
string
jpg2
=
MyPath
.
Combine
(
thumb
,
c
.
id
.
ToString
()+
".jpg"
);
string
lua
=
MyPath
.
Combine
(
script
,
"c"
+
c
.
id
.
ToString
()+
".lua"
);
if
(
File
.
Exists
(
jpg1
))
zips
.
AddFile
(
jpg1
,
"pics/"
+
c
.
id
.
ToString
()+
".jpg"
,
""
);
if
(
File
.
Exists
(
jpg2
))
zips
.
AddFile
(
jpg2
,
"pics/thumbnail/"
+
c
.
id
.
ToString
()+
".jpg"
,
""
);
if
(
File
.
Exists
(
lua
))
zips
.
AddFile
(
lua
,
"script/c"
+
c
.
id
.
ToString
()+
".lua"
,
""
);
}
}
#
region
裁剪图片
public
void
CutImages
(
string
imgpath
,
bool
isreplace
)
{
int
count
=
cardlist
.
Length
;
int
i
=
0
;
foreach
(
Card
c
in
cardlist
)
{
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
((
i
/
count
),
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
string
jpg
=
MyPath
.
Combine
(
imgpath
,
c
.
id
+
".jpg"
);
string
savejpg
=
MyPath
.
Combine
(
mseHelper
.
ImagePath
,
c
.
id
+
".jpg"
);
if
(
File
.
Exists
(
jpg
)
&&
(
isreplace
||
!
File
.
Exists
(
savejpg
)))
{
Bitmap
bp
=
new
Bitmap
(
jpg
);
Bitmap
bmp
=
null
;
if
(
c
.
IsType
(
CardType
.
TYPE_XYZ
))
{
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
xyzArea
);
}
else
if
(
c
.
IsType
(
CardType
.
TYPE_PENDULUM
))
{
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
pendulumArea
);
}
else
{
bmp
=
MyBitmap
.
Cut
(
bp
,
imgSet
.
normalArea
);
}
MyBitmap
.
SaveAsJPEG
(
bmp
,
savejpg
,
imgSet
.
quilty
);
//bmp.Save(savejpg, ImageFormat.Png);
}
}
}
#
endregion
#
region
转换图片
public
void
ConvertImages
(
string
imgpath
,
string
gamepath
,
bool
isreplace
)
{
string
picspath
=
MyPath
.
Combine
(
gamepath
,
"pics"
);
string
thubpath
=
MyPath
.
Combine
(
picspath
,
"thumbnail"
);
string
[]
files
=
Directory
.
GetFiles
(
imgpath
);
int
i
=
0
;
int
count
=
files
.
Length
;
foreach
(
string
f
in
files
)
{
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
string
ex
=
Path
.
GetExtension
(
f
).
ToLower
();
string
name
=
Path
.
GetFileNameWithoutExtension
(
f
);
string
jpg_b
=
MyPath
.
Combine
(
picspath
,
name
+
".jpg"
);
string
jpg_s
=
MyPath
.
Combine
(
thubpath
,
name
+
".jpg"
);
if
(
ex
==
".jpg"
||
ex
==
".png"
||
ex
==
".bmp"
)
{
if
(
File
.
Exists
(
f
))
{
//存在大图
Bitmap
bmp
=
new
Bitmap
(
f
);
if
(
isreplace
||
!
File
.
Exists
(
jpg_b
))
{
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
W
,
imgSet
.
H
),
jpg_b
,
imgSet
.
quilty
);
}
if
(
isreplace
||
!
File
.
Exists
(
jpg_s
))
{
MyBitmap
.
SaveAsJPEG
(
MyBitmap
.
Zoom
(
bmp
,
imgSet
.
w
,
imgSet
.
h
),
jpg_s
,
imgSet
.
quilty
);
}
}
}
}
}
#
endregion
#
region
MSE
存档
public
string
MSEImage
{
get
{
return
mseHelper
.
ImagePath
;
}
}
public
void
SaveMSEs
(
string
file
,
Card
[]
cards
,
bool
isUpdate
)
{
if
(
mseHelper
.
MaxNum
==
0
)
SaveMSE
(
1
,
file
,
cards
,
isUpdate
);
else
{
int
c
=
cards
.
Length
;
int
nums
=
c
/
mseHelper
.
MaxNum
;
if
(
nums
*
mseHelper
.
MaxNum
<
c
)
nums
++;
List
<
Card
>
clist
=
new
List
<
Card
>();
for
(
int
i
=
0
;
i
<
nums
;
i
++)
{
clist
.
Clear
();
for
(
int
j
=
0
;
j
<
mseHelper
.
MaxNum
;
j
++)
{
int
index
=
i
*
mseHelper
.
MaxNum
+
j
;
if
(
index
<
c
)
clist
.
Add
(
cards
[
index
]);
}
int
t
=
file
.
LastIndexOf
(
".mse-set"
);
string
fname
=
(
t
>
0
)
?
file
.
Substring
(
0
,
t
)
:
file
;
fname
=
fname
+
string
.
Format
(
"_{0}.mse-set"
,
i
+
1
);
SaveMSE
(
i
+
1
,
fname
,
clist
.
ToArray
(),
isUpdate
);
}
}
}
public
void
SaveMSE
(
int
num
,
string
file
,
Card
[]
cards
,
bool
isUpdate
)
{
string
setFile
=
file
+
".txt"
;
string
[]
images
=
mseHelper
.
WriteSet
(
setFile
,
cards
);
if
(
isUpdate
)
//仅更新文字
return
;
int
i
=
0
;
int
count
=
images
.
Length
;
using
(
ZipStorer
zips
=
ZipStorer
.
Create
(
file
,
""
))
{
zips
.
EncodeUTF8
=
true
;
zips
.
AddFile
(
setFile
,
"set"
,
""
);
foreach
(
string
img
in
images
)
{
if
(
isCancel
)
break
;
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}-{2}"
,
i
,
count
,
num
));
zips
.
AddFile
(
img
,
Path
.
GetFileName
(
img
),
""
);
}
}
File
.
Delete
(
setFile
);
}
#
endregion
#
region
导出数据
public
void
ExportData
(
string
zipname
)
{
int
i
=
0
;
Card
[]
cards
=
cardlist
;
if
(
cards
==
null
||
cards
.
Length
==
0
)
return
;
int
count
=
cards
.
Length
;
string
path
=
Path
.
GetDirectoryName
(
zipname
);
string
name
=
Path
.
GetFileNameWithoutExtension
(
zipname
);
string
cdbfile
=
zipname
+
".cdb"
;
string
readme
=
MyPath
.
Combine
(
path
,
name
+
".txt"
);
string
deckydk
=
MyPath
.
Combine
(
path
,
"deck/"
+
name
+
".ydk"
);
string
pics
=
MyPath
.
Combine
(
path
,
"pics"
);
string
thumb
=
MyPath
.
Combine
(
pics
,
"thumbnail"
);
string
script
=
MyPath
.
Combine
(
path
,
"script"
);
File
.
Delete
(
cdbfile
);
DataBase
.
Create
(
cdbfile
);
DataBase
.
CopyDB
(
cdbfile
,
false
,
cardlist
);
if
(
File
.
Exists
(
zipname
))
File
.
Delete
(
zipname
);
using
(
ZipStorer
zips
=
ZipStorer
.
Create
(
zipname
,
""
))
{
zips
.
AddFile
(
cdbfile
,
name
+
".cdb"
,
""
);
if
(
File
.
Exists
(
readme
))
zips
.
AddFile
(
readme
,
"readme_"
+
name
+
".txt"
,
""
);
if
(
File
.
Exists
(
deckydk
))
zips
.
AddFile
(
deckydk
,
"deck/"
+
name
+
".ydk"
,
""
);
foreach
(
Card
c
in
cards
)
{
i
++;
worker
.
ReportProgress
(
i
/
count
,
string
.
Format
(
"{0}/{1}"
,
i
,
count
));
//zips.AddFile(
string
jpg1
=
MyPath
.
Combine
(
pics
,
c
.
id
.
ToString
()
+
".jpg"
);
string
jpg2
=
MyPath
.
Combine
(
thumb
,
c
.
id
.
ToString
()
+
".jpg"
);
string
lua
=
MyPath
.
Combine
(
script
,
"c"
+
c
.
id
.
ToString
()
+
".lua"
);
if
(
File
.
Exists
(
jpg1
))
zips
.
AddFile
(
jpg1
,
"pics/"
+
c
.
id
.
ToString
()
+
".jpg"
,
""
);
if
(
File
.
Exists
(
jpg2
))
zips
.
AddFile
(
jpg2
,
"pics/thumbnail/"
+
c
.
id
.
ToString
()
+
".jpg"
,
""
);
if
(
File
.
Exists
(
lua
))
zips
.
AddFile
(
lua
,
"script/c"
+
c
.
id
.
ToString
()
+
".lua"
,
""
);
}
}
File
.
Delete
(
cdbfile
);
}
public
void
Run
(){
isCancel
=
false
;
isRun
=
true
;
bool
replace
;
bool
showNew
;
switch
(
nowTask
){
case
MyTask
.
ExportData
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
1
){
ExportData
(
mArgs
[
0
]);
}
break
;
case
MyTask
.
CheckUpdate
:
showNew
=
false
;
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
1
){
showNew
=(
mArgs
[
0
]==
Boolean
.
TrueString
)?
true
:
false
;
}
OnCheckUpdate
(
showNew
);
break
;
case
MyTask
.
CutImages
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
){
replace
=
true
;
if
(
mArgs
.
Length
>=
2
){
if
(
mArgs
[
1
]==
Boolean
.
FalseString
)
replace
=
false
;
}
CutImages
(
mArgs
[
0
],
replace
);
}
break
;
case
MyTask
.
SaveAsMSE
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
){
replace
=
false
;
if
(
mArgs
.
Length
>=
2
){
if
(
mArgs
[
1
]==
Boolean
.
TrueString
)
replace
=
true
;
}
SaveMSEs
(
mArgs
[
0
],
cardlist
,
replace
);
}
break
;
case
MyTask
.
ConvertImages
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
){
replace
=
true
;
if
(
mArgs
.
Length
>=
3
){
if
(
mArgs
[
2
]==
Boolean
.
FalseString
)
replace
=
false
;
}
ConvertImages
(
mArgs
[
0
],
mArgs
[
1
],
replace
);
}
break
;
}
isRun
=
false
;
lastTask
=
nowTask
;
nowTask
=
MyTask
.
NONE
;
cardlist
=
null
;
mArgs
=
null
;
}
}
}
#
endregion
#
region
运行
public
void
Run
()
{
isCancel
=
false
;
isRun
=
true
;
bool
replace
;
bool
showNew
;
switch
(
nowTask
)
{
case
MyTask
.
ExportData
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
1
)
{
ExportData
(
mArgs
[
0
]);
}
break
;
case
MyTask
.
CheckUpdate
:
showNew
=
false
;
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
1
)
{
showNew
=
(
mArgs
[
0
]
==
Boolean
.
TrueString
)
?
true
:
false
;
}
OnCheckUpdate
(
showNew
);
break
;
case
MyTask
.
CutImages
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
)
{
replace
=
true
;
if
(
mArgs
.
Length
>=
2
)
{
if
(
mArgs
[
1
]
==
Boolean
.
FalseString
)
replace
=
false
;
}
CutImages
(
mArgs
[
0
],
replace
);
}
break
;
case
MyTask
.
SaveAsMSE
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
)
{
replace
=
false
;
if
(
mArgs
.
Length
>=
2
)
{
if
(
mArgs
[
1
]
==
Boolean
.
TrueString
)
replace
=
true
;
}
SaveMSEs
(
mArgs
[
0
],
cardlist
,
replace
);
}
break
;
case
MyTask
.
ConvertImages
:
if
(
mArgs
!=
null
&&
mArgs
.
Length
>=
2
)
{
replace
=
true
;
if
(
mArgs
.
Length
>=
3
)
{
if
(
mArgs
[
2
]
==
Boolean
.
FalseString
)
replace
=
false
;
}
ConvertImages
(
mArgs
[
0
],
mArgs
[
1
],
replace
);
}
break
;
}
isRun
=
false
;
lastTask
=
nowTask
;
nowTask
=
MyTask
.
NONE
;
cardlist
=
null
;
mArgs
=
null
;
}
#
endregion
}
}
DataEditorX/MainForm.cs
View file @
346dfc10
...
...
@@ -53,7 +53,7 @@ public void SetLanguage(string language)
//文件路径
conflang
=
MyPath
.
Combine
(
datapath
,
MyConfig
.
FILE_LANGUAGE
);
//游戏数据
datacfg
=
new
DataConfig
(
MyPath
.
Combine
(
datapath
,
My
Config
.
FILE_INFO
));
datacfg
=
new
DataConfig
(
MyPath
.
Combine
(
datapath
,
Data
Config
.
FILE_INFO
));
//初始化YGOUtil的数据
YGOUtil
.
SetConfig
(
datacfg
);
...
...
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