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
747d0872
Commit
747d0872
authored
Dec 29, 2014
by
keyongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset
parent
719acedd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
494 additions
and
0 deletions
+494
-0
DataEditorX/Config/CodeConfig.cs
DataEditorX/Config/CodeConfig.cs
+225
-0
DataEditorX/Config/DataConfig.cs
DataEditorX/Config/DataConfig.cs
+77
-0
DataEditorX/Config/ImageSet.cs
DataEditorX/Config/ImageSet.cs
+48
-0
DataEditorX/Config/MSEConfig.cs
DataEditorX/Config/MSEConfig.cs
+144
-0
No files found.
DataEditorX/Config/CodeConfig.cs
0 → 100644
View file @
747d0872
using
System
;
using
System.Drawing
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Windows.Forms
;
using
System.Configuration
;
using
WeifenLuo.WinFormsUI.Docking
;
using
FastColoredTextBoxNS
;
using
DataEditorX.Language
;
using
DataEditorX.Core
;
using
System.Text
;
namespace
DataEditorX.Core
{
class
CodeConfig
{
public
CodeConfig
(
string
datapath
)
{
funtxt
=
MyPath
.
Combine
(
datapath
,
"_functions.txt"
);
conlua
=
MyPath
.
Combine
(
datapath
,
"constant.lua"
);
confstring
=
MyPath
.
Combine
(
datapath
,
"strings.conf"
);
tooltipDic
=
new
Dictionary
<
string
,
string
>();
funList
=
new
List
<
AutocompleteItem
>();
conList
=
new
List
<
AutocompleteItem
>();
}
//函数提示
Dictionary
<
string
,
string
>
tooltipDic
;
public
Dictionary
<
string
,
string
>
TooltipDic
{
get
{
return
tooltipDic
;
}
}
//自动完成
List
<
AutocompleteItem
>
funList
;
List
<
AutocompleteItem
>
conList
;
bool
isInit
;
public
bool
IsInit
{
get
{
return
isInit
;
}
}
public
AutocompleteItem
[]
FunList
{
get
{
return
funList
.
ToArray
();
}
}
public
AutocompleteItem
[]
ConList
{
get
{
return
conList
.
ToArray
();
}
}
public
string
funtxt
,
conlua
,
confstring
;
public
void
Init
()
{
isInit
=
true
;
tooltipDic
.
Clear
();
funList
.
Clear
();
conList
.
Clear
();
AddFunction
(
funtxt
);
AddConstant
(
conlua
);
}
#
region
setnames
strings
public
void
SetNames
(
Dictionary
<
long
,
string
>
dic
)
{
foreach
(
long
k
in
dic
.
Keys
)
{
string
key
=
"0x"
+
k
.
ToString
(
"x"
);
if
(!
tooltipDic
.
ContainsKey
(
key
))
{
AddConToolTip
(
key
,
dic
[
k
]);
}
}
}
public
void
AddStrings
(
string
str
)
{
if
(
File
.
Exists
(
str
))
{
string
[]
lines
=
File
.
ReadAllLines
(
str
);
foreach
(
string
line
in
lines
)
{
if
(
line
.
StartsWith
(
"!victory"
)
||
line
.
StartsWith
(
"!counter"
))
{
string
[]
ws
=
line
.
Split
(
' '
);
if
(
ws
.
Length
>
2
)
{
AddConToolTip
(
ws
[
1
],
ws
[
2
]);
}
}
}
}
}
public
void
AddStrings
()
{
AddStrings
(
confstring
);
}
#
endregion
#
region
function
void
AddFunction
(
string
funtxt
)
{
if
(
File
.
Exists
(
funtxt
))
{
string
[]
lines
=
File
.
ReadAllLines
(
funtxt
);
bool
isFind
=
false
;
string
name
=
""
;
string
desc
=
""
;
foreach
(
string
line
in
lines
)
{
if
(
string
.
IsNullOrEmpty
(
line
)
||
line
.
StartsWith
(
"=="
)
||
line
.
StartsWith
(
"#"
))
continue
;
if
(
line
.
StartsWith
(
"●"
))
{
//add
AddFuncTooltip
(
name
,
desc
);
int
w
=
line
.
IndexOf
(
"("
);
int
t
=
line
.
IndexOf
(
" "
);
if
(
t
<
w
&&
t
>
0
)
{
name
=
line
.
Substring
(
t
+
1
,
w
-
t
-
1
);
isFind
=
true
;
desc
=
line
;
}
}
else
if
(
isFind
)
{
desc
+=
Environment
.
NewLine
+
line
;
}
}
AddFuncTooltip
(
name
,
desc
);
}
}
string
GetFunName
(
string
str
)
{
int
t
=
str
.
IndexOf
(
"."
);
if
(
t
>
0
)
return
str
.
Substring
(
t
+
1
);
return
str
;
}
void
AddFuncTooltip
(
string
name
,
string
desc
)
{
if
(!
string
.
IsNullOrEmpty
(
name
))
{
string
fname
=
GetFunName
(
name
);
AddAutoMenuItem
(
funList
,
fname
,
desc
);
if
(!
tooltipDic
.
ContainsKey
(
fname
))
{
tooltipDic
.
Add
(
fname
,
desc
);
}
else
tooltipDic
[
fname
]
+=
Environment
.
NewLine
+
Environment
.
NewLine
+
desc
;
}
}
#
endregion
#
region
constant
void
AddAutoMenuItem
(
List
<
AutocompleteItem
>
list
,
string
key
,
string
desc
)
{
bool
isExists
=
false
;
foreach
(
AutocompleteItem
ai
in
list
)
{
if
(
ai
.
Text
==
key
)
{
isExists
=
true
;
ai
.
ToolTipText
+=
Environment
.
NewLine
+
Environment
.
NewLine
+
desc
;
}
}
if
(!
isExists
)
{
AutocompleteItem
aitem
=
new
AutocompleteItem
(
key
);
aitem
.
ToolTipTitle
=
key
;
aitem
.
ToolTipText
=
desc
;
list
.
Add
(
aitem
);
}
}
void
AddConToolTip
(
string
key
,
string
desc
)
{
AddAutoMenuItem
(
conList
,
key
,
desc
);
if
(
tooltipDic
.
ContainsKey
(
key
))
tooltipDic
[
key
]
+=
Environment
.
NewLine
+
Environment
.
NewLine
+
desc
;
else
{
tooltipDic
.
Add
(
key
,
desc
);
}
}
void
AddConstant
(
string
conlua
)
{
//conList.Add("con");
if
(
File
.
Exists
(
conlua
))
{
string
[]
lines
=
File
.
ReadAllLines
(
conlua
);
foreach
(
string
line
in
lines
)
{
if
(
line
.
StartsWith
(
"--"
))
continue
;
string
k
=
line
,
desc
=
line
;
int
t
=
line
.
IndexOf
(
"="
);
int
t2
=
line
.
IndexOf
(
"--"
);
k
=
(
t
>
0
)
?
line
.
Substring
(
0
,
t
).
TrimEnd
(
new
char
[]
{
' '
,
'\t'
})
:
line
;
desc
=
(
t
>
0
)
?
line
.
Substring
(
t
+
1
).
Replace
(
"--"
,
"\n"
)
:
line
;
if
(!
tooltipDic
.
ContainsKey
(
k
))
{
AddConToolTip
(
k
,
desc
);
}
else
tooltipDic
[
k
]
+=
Environment
.
NewLine
+
Environment
.
NewLine
+
desc
;
}
}
}
#
endregion
}
}
DataEditorX/Config/DataConfig.cs
0 → 100644
View file @
747d0872
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 2014-10-23
* 时间: 7:54
*
*/
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
namespace
DataEditorX.Core
{
/// <summary>
/// Description of DataConfig.
/// </summary>
public
class
DataConfig
{
public
DataConfig
()
{
InitMember
(
System
.
Windows
.
Forms
.
Application
.
StartupPath
);
}
public
DataConfig
(
string
datapath
)
{
InitMember
(
datapath
);
}
void
InitMember
(
string
datapath
)
{
this
.
datapath
=
datapath
;
confrule
=
Path
.
Combine
(
datapath
,
"card-rule.txt"
);
confattribute
=
Path
.
Combine
(
datapath
,
"card-attribute.txt"
);
confrace
=
Path
.
Combine
(
datapath
,
"card-race.txt"
);
conflevel
=
Path
.
Combine
(
datapath
,
"card-level.txt"
);
confsetname
=
Path
.
Combine
(
datapath
,
"card-setname.txt"
);
conftype
=
Path
.
Combine
(
datapath
,
"card-type.txt"
);
confcategory
=
Path
.
Combine
(
datapath
,
"card-category.txt"
);
dicCardRules
=
new
Dictionary
<
long
,
string
>();
dicSetnames
=
new
Dictionary
<
long
,
string
>();
dicCardTypes
=
new
Dictionary
<
long
,
string
>();
dicCardcategorys
=
new
Dictionary
<
long
,
string
>();
dicCardAttributes
=
new
Dictionary
<
long
,
string
>();
dicCardRaces
=
new
Dictionary
<
long
,
string
>();
dicCardLevels
=
new
Dictionary
<
long
,
string
>();
}
Dictionary
<
long
,
string
>
CopyDic
(
Dictionary
<
long
,
string
>
dic
)
{
Dictionary
<
long
,
string
>
ndic
=
new
Dictionary
<
long
,
string
>();
foreach
(
long
k
in
dic
.
Keys
)
{
ndic
.
Add
(
k
,
dic
[
k
]);
}
return
ndic
;
}
public
void
Init
()
{
dicCardRules
=
DataManager
.
Read
(
confrule
);
dicSetnames
=
DataManager
.
Read
(
confsetname
);
dicCardTypes
=
DataManager
.
Read
(
conftype
);
dicCardcategorys
=
DataManager
.
Read
(
confcategory
);
dicCardAttributes
=
DataManager
.
Read
(
confattribute
);
dicCardRaces
=
DataManager
.
Read
(
confrace
);
dicCardLevels
=
DataManager
.
Read
(
conflevel
);
}
string
datapath
;
public
string
confrule
,
confattribute
,
confrace
,
conflevel
;
public
string
confsetname
,
conftype
,
confcategory
;
public
Dictionary
<
long
,
string
>
dicCardRules
=
null
;
public
Dictionary
<
long
,
string
>
dicCardAttributes
=
null
;
public
Dictionary
<
long
,
string
>
dicCardRaces
=
null
;
public
Dictionary
<
long
,
string
>
dicCardLevels
=
null
;
public
Dictionary
<
long
,
string
>
dicSetnames
=
null
;
public
Dictionary
<
long
,
string
>
dicCardTypes
=
null
;
public
Dictionary
<
long
,
string
>
dicCardcategorys
=
null
;
}
}
DataEditorX/Config/ImageSet.cs
0 → 100644
View file @
747d0872
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 2014-10-13
* 时间: 9:02
*
*/
using
System
;
using
System.Configuration
;
using
DataEditorX.Config
;
using
DataEditorX.Common
;
namespace
DataEditorX.Core
{
public
class
ImageSet
{
bool
isInit
;
public
ImageSet
(){
isInit
=
false
;
}
public
void
Init
()
{
if
(
isInit
)
return
;
isInit
=
true
;
this
.
normalArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_OTHER
);
this
.
xyzArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_XYZ
);
this
.
pendulumArea
=
MyConfig
.
readArea
(
MyConfig
.
TAG_IMAGE_PENDULUM
);
int
[]
ints
=
MyConfig
.
readIntegers
(
MyConfig
.
TAG_IMAGE_SIZE
,
4
);
this
.
w
=
ints
[
0
];
this
.
h
=
ints
[
1
];
this
.
W
=
ints
[
2
];
this
.
H
=
ints
[
3
];
this
.
quilty
=
MyConfig
.
readInteger
(
MyConfig
.
TAG_IMAGE_QUILTY
,
95
);
}
public
int
quilty
;
public
int
w
,
h
,
W
,
H
;
public
Area
normalArea
;
public
Area
xyzArea
;
public
Area
pendulumArea
;
}
}
DataEditorX/Config/MSEConfig.cs
0 → 100644
View file @
747d0872
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 2014-10-15
* 时间: 15:47
*
*/
using
System
;
using
System.Configuration
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Text
;
using
DataEditorX.Language
;
namespace
DataEditorX.Core
{
public
class
RegStr
{
public
RegStr
(
string
p
,
string
r
)
{
pstr
=
Re
(
p
);
rstr
=
Re
(
r
);
}
string
Re
(
string
str
)
{
return
str
.
Replace
(
"\\n"
,
"\n"
).
Replace
(
"\\t"
,
"\t"
).
Replace
(
"\\s"
,
" "
);
}
public
string
pstr
;
public
string
rstr
;
}
/// <summary>
/// Description of MSEConfig.
/// </summary>
public
class
MSEConfig
{
string
_path
;
public
MSEConfig
(
string
path
)
{
Iscn2tw
=
false
;
_path
=
path
;
regx_monster
=
"(\\s\\S*?)"
;
regx_pendulum
=
"(\\s\\S*?)"
;
head
=
read
(
path
,
"mse-head.txt"
);
monster
=
read
(
path
,
"mse-monster.txt"
);
pendulum
=
read
(
path
,
"mse-pendulum.txt"
);
spelltrap
=
read
(
path
,
"mse-spelltrap.txt"
);
string
tmp
=
Path
.
Combine
(
path
,
"mse-config.txt"
);
replaces
=
new
List
<
RegStr
>();
if
(
File
.
Exists
(
tmp
))
{
string
[]
lines
=
File
.
ReadAllLines
(
tmp
,
Encoding
.
UTF8
);
foreach
(
string
line
in
lines
)
{
if
(
string
.
IsNullOrEmpty
(
line
)
||
line
.
StartsWith
(
"#"
))
continue
;
if
(
line
.
StartsWith
(
"cn2tw"
))
Iscn2tw
=(
getValue
(
line
).
ToLower
()==
"true"
)?
true
:
false
;
else
if
(
line
.
StartsWith
(
"spell"
))
str_spell
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"trap"
))
str_trap
=
getValue
(
line
);
else
if
(
line
.
StartsWith
(
"pendulum-text"
))
regx_pendulum
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"monster-text"
))
regx_monster
=
getRegex
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"maxcount"
))
int
.
TryParse
(
getValue
(
line
),
out
maxcount
);
else
if
(
line
.
StartsWith
(
"imagepath"
))
imagepath
=
CheckDir
(
getValue
(
line
));
else
if
(
line
.
StartsWith
(
"replace"
)){
string
word
=
getValue
(
line
);
int
t
=
word
.
IndexOf
(
" "
);
if
(
t
>
0
){
string
p
=
word
.
Substring
(
0
,
t
);
string
r
=
word
.
Substring
(
t
+
1
);
if
(!
string
.
IsNullOrEmpty
(
p
))
replaces
.
Add
(
new
RegStr
(
p
,
r
));
}
}
}
if
(
str_spell
==
"%%"
&&
str_trap
==
"%%"
)
st_is_symbol
=
true
;
else
st_is_symbol
=
false
;
}
else
{
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"
);
}
string
getValue
(
string
line
)
{
int
t
=
line
.
IndexOf
(
'='
);
if
(
t
>
0
)
return
line
.
Substring
(
t
+
1
).
Trim
();
return
""
;
}
string
read
(
string
path
,
string
name
)
{
string
tmp
=
Path
.
Combine
(
path
,
name
);
return
File
.
Exists
(
tmp
)?
File
.
ReadAllText
(
tmp
):
""
;
}
public
int
maxcount
;
public
string
imagepath
;
public
bool
st_is_symbol
;
public
string
str_spell
;
public
string
str_trap
;
public
bool
Iscn2tw
;
public
List
<
RegStr
>
replaces
;
public
string
regx_pendulum
;
public
string
regx_monster
;
public
string
head
;
public
string
monster
;
public
string
pendulum
;
public
string
spelltrap
;
}
}
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