Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro2
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
Xu Chenxi
ygopro2
Commits
7afdb8f4
Commit
7afdb8f4
authored
Apr 14, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test methods
parent
1b31d771
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
24 deletions
+38
-24
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
+12
-6
Assets/YGOSharp/BanlistManager.cs
Assets/YGOSharp/BanlistManager.cs
+11
-5
Assets/YGOSharp/CardsManager.cs
Assets/YGOSharp/CardsManager.cs
+15
-13
No files found.
Assets/SibylSystem/ResourceManagers/GameStringManager.cs
View file @
7afdb8f4
...
...
@@ -34,11 +34,13 @@ public static class GameStringManager
return
return_value
;
}
public
static
void
initialize
(
string
path
)
public
static
bool
initialize
(
string
path
,
bool
test
=
false
)
{
string
text
=
System
.
IO
.
File
.
ReadAllText
(
path
);
string
st
=
text
.
Replace
(
"\r"
,
""
);
string
[]
lines
=
st
.
Split
(
new
string
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
bool
success
=
true
;
bool
found
=
false
;
foreach
(
string
line
in
lines
)
{
if
(
line
.
Length
>
1
&&
line
.
Substring
(
0
,
1
)
==
"!"
)
...
...
@@ -46,6 +48,7 @@ public static class GameStringManager
string
[]
mats
=
line
.
Substring
(
1
,
line
.
Length
-
1
).
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
mats
.
Length
>
2
)
{
found
=
true
;
hashedString
a
=
new
hashedString
();
a
.
region
=
mats
[
0
];
try
...
...
@@ -54,6 +57,7 @@ public static class GameStringManager
}
catch
(
Exception
e
)
{
success
=
false
;
Program
.
DEBUGLOG
(
e
);
}
a
.
content
=
""
;
...
...
@@ -62,14 +66,17 @@ public static class GameStringManager
a
.
content
+=
mats
[
i
]
+
" "
;
}
a
.
content
=
a
.
content
.
Substring
(
0
,
a
.
content
.
Length
-
1
);
hashedStrings
.
Add
(
a
);
if
(
a
.
region
==
"setname"
)
{
xilies
.
Add
(
a
);
if
(!
test
)
{
hashedStrings
.
Add
(
a
);
if
(
a
.
region
==
"setname"
)
{
xilies
.
Add
(
a
);
}
}
}
}
}
return
(
success
&&
found
);
}
public
static
string
get
(
string
region
,
int
hashCode
)
...
...
@@ -148,4 +155,3 @@ public static class GameStringManager
return
formatLocation
(
gps
.
location
,
gps
.
sequence
);
}
}
Assets/YGOSharp/BanlistManager.cs
View file @
7afdb8f4
...
...
@@ -7,11 +7,12 @@ namespace YGOSharp
{
public
static
List
<
Banlist
>
Banlists
{
get
;
private
set
;
}
public
static
void
initialize
(
string
fileNam
e
)
public
static
bool
initialize
(
string
fileName
,
bool
test
=
fals
e
)
{
Banlists
=
new
List
<
Banlist
>();
List
<
Banlist
>
new_list
=
new
List
<
Banlist
>();
Banlist
current
=
null
;
StreamReader
reader
=
new
StreamReader
(
fileName
);
bool
success
=
true
;
while
(!
reader
.
EndOfStream
)
{
string
line
=
reader
.
ReadLine
();
...
...
@@ -25,7 +26,7 @@ namespace YGOSharp
{
current
=
new
Banlist
();
current
.
Name
=
line
.
Substring
(
1
,
line
.
Length
-
1
);
Banlists
.
Add
(
current
);
new_list
.
Add
(
current
);
continue
;
}
if
(!
line
.
Contains
(
" "
))
...
...
@@ -39,13 +40,18 @@ namespace YGOSharp
}
catch
(
System
.
Exception
e
)
{
success
=
false
;
UnityEngine
.
Debug
.
Log
(
line
);
UnityEngine
.
Debug
.
Log
(
e
);
}
}
current
=
new
Banlist
();
current
.
Name
=
"N/A"
;
Banlists
.
Add
(
current
);
new_list
.
Add
(
current
);
if
(!
test
)
{
Banlists
=
new_list
;
}
return
(
success
&&
new_list
.
Count
>
1
);
}
public
static
int
GetIndex
(
uint
hash
)
...
...
@@ -101,4 +107,4 @@ namespace YGOSharp
}
}
}
\ No newline at end of file
}
Assets/YGOSharp/CardsManager.cs
View file @
7afdb8f4
...
...
@@ -16,17 +16,19 @@ namespace YGOSharp
public
static
string
nullString
=
""
;
internal
static
bool
initialize
(
string
databaseFullPath
)
internal
static
bool
initialize
(
string
databaseFullPath
,
bool
test
=
false
)
{
nullName
=
InterString
.
Get
(
"未知卡片"
);
nullString
=
""
;
nullString
+=
"欢迎使用 KoishiPro2 iOS,本软件免责声明:[url=http://koishi.222diy.gdn/lab.html][u]http://koishi.222diy.gdn/lab.html[/u][/url]"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"KoishiPro2 iOS的用户QQ群627975038,游戏中遇到任何bug欢迎提交"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"更多关于电脑/安卓版KoishiPro及7210服务器的信息可加QQ群338443272"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"喜欢游戏王DIY的朋友欢迎来222服QQ群642043095"
;
if
(!
test
)
{
nullName
=
InterString
.
Get
(
"未知卡片"
);
nullString
=
""
;
nullString
+=
"欢迎使用 KoishiPro2 iOS,本软件免责声明:[url=http://koishi.222diy.gdn/lab.html][u]http://koishi.222diy.gdn/lab.html[/u][/url]"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"KoishiPro2 iOS的用户QQ群627975038,游戏中遇到任何bug欢迎提交"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"更多关于电脑/安卓版KoishiPro及7210服务器的信息可加QQ群338443272"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"喜欢游戏王DIY的朋友欢迎来222服QQ群642043095"
;
}
bool
success
=
true
;
try
{
using
(
SqliteConnection
connection
=
new
SqliteConnection
(
"Data Source="
+
databaseFullPath
))
...
...
@@ -39,7 +41,7 @@ namespace YGOSharp
{
while
(
reader
.
Read
())
{
LoadCard
(
reader
);
LoadCard
(
reader
,
test
);
}
}
}
...
...
@@ -86,10 +88,10 @@ namespace YGOSharp
return
returnValue
;
}
private
static
void
LoadCard
(
IDataRecord
reader
)
private
static
void
LoadCard
(
IDataRecord
reader
,
bool
test
=
false
)
{
Card
card
=
new
Card
(
reader
);
if
(!
_cards
.
ContainsKey
(
card
.
Id
))
if
(!
_cards
.
ContainsKey
(
card
.
Id
)
&&
!
test
)
{
_cards
.
Add
(
card
.
Id
,
card
);
}
...
...
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