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
mercury233
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
Show 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
...
@@ -34,11 +34,13 @@ public static class GameStringManager
return
return_value
;
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
text
=
System
.
IO
.
File
.
ReadAllText
(
path
);
string
st
=
text
.
Replace
(
"\r"
,
""
);
string
st
=
text
.
Replace
(
"\r"
,
""
);
string
[]
lines
=
st
.
Split
(
new
string
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
string
[]
lines
=
st
.
Split
(
new
string
[]
{
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
bool
success
=
true
;
bool
found
=
false
;
foreach
(
string
line
in
lines
)
foreach
(
string
line
in
lines
)
{
{
if
(
line
.
Length
>
1
&&
line
.
Substring
(
0
,
1
)
==
"!"
)
if
(
line
.
Length
>
1
&&
line
.
Substring
(
0
,
1
)
==
"!"
)
...
@@ -46,6 +48,7 @@ public static class GameStringManager
...
@@ -46,6 +48,7 @@ public static class GameStringManager
string
[]
mats
=
line
.
Substring
(
1
,
line
.
Length
-
1
).
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
string
[]
mats
=
line
.
Substring
(
1
,
line
.
Length
-
1
).
Split
(
new
string
[]
{
" "
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
mats
.
Length
>
2
)
if
(
mats
.
Length
>
2
)
{
{
found
=
true
;
hashedString
a
=
new
hashedString
();
hashedString
a
=
new
hashedString
();
a
.
region
=
mats
[
0
];
a
.
region
=
mats
[
0
];
try
try
...
@@ -54,6 +57,7 @@ public static class GameStringManager
...
@@ -54,6 +57,7 @@ public static class GameStringManager
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
success
=
false
;
Program
.
DEBUGLOG
(
e
);
Program
.
DEBUGLOG
(
e
);
}
}
a
.
content
=
""
;
a
.
content
=
""
;
...
@@ -62,6 +66,7 @@ public static class GameStringManager
...
@@ -62,6 +66,7 @@ public static class GameStringManager
a
.
content
+=
mats
[
i
]
+
" "
;
a
.
content
+=
mats
[
i
]
+
" "
;
}
}
a
.
content
=
a
.
content
.
Substring
(
0
,
a
.
content
.
Length
-
1
);
a
.
content
=
a
.
content
.
Substring
(
0
,
a
.
content
.
Length
-
1
);
if
(!
test
)
{
hashedStrings
.
Add
(
a
);
hashedStrings
.
Add
(
a
);
if
(
a
.
region
==
"setname"
)
if
(
a
.
region
==
"setname"
)
{
{
...
@@ -71,6 +76,8 @@ public static class GameStringManager
...
@@ -71,6 +76,8 @@ public static class GameStringManager
}
}
}
}
}
}
return
(
success
&&
found
);
}
public
static
string
get
(
string
region
,
int
hashCode
)
public
static
string
get
(
string
region
,
int
hashCode
)
{
{
...
@@ -148,4 +155,3 @@ public static class GameStringManager
...
@@ -148,4 +155,3 @@ public static class GameStringManager
return
formatLocation
(
gps
.
location
,
gps
.
sequence
);
return
formatLocation
(
gps
.
location
,
gps
.
sequence
);
}
}
}
}
Assets/YGOSharp/BanlistManager.cs
View file @
7afdb8f4
...
@@ -7,11 +7,12 @@ namespace YGOSharp
...
@@ -7,11 +7,12 @@ namespace YGOSharp
{
{
public
static
List
<
Banlist
>
Banlists
{
get
;
private
set
;
}
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
;
Banlist
current
=
null
;
StreamReader
reader
=
new
StreamReader
(
fileName
);
StreamReader
reader
=
new
StreamReader
(
fileName
);
bool
success
=
true
;
while
(!
reader
.
EndOfStream
)
while
(!
reader
.
EndOfStream
)
{
{
string
line
=
reader
.
ReadLine
();
string
line
=
reader
.
ReadLine
();
...
@@ -25,7 +26,7 @@ namespace YGOSharp
...
@@ -25,7 +26,7 @@ namespace YGOSharp
{
{
current
=
new
Banlist
();
current
=
new
Banlist
();
current
.
Name
=
line
.
Substring
(
1
,
line
.
Length
-
1
);
current
.
Name
=
line
.
Substring
(
1
,
line
.
Length
-
1
);
Banlists
.
Add
(
current
);
new_list
.
Add
(
current
);
continue
;
continue
;
}
}
if
(!
line
.
Contains
(
" "
))
if
(!
line
.
Contains
(
" "
))
...
@@ -39,13 +40,18 @@ namespace YGOSharp
...
@@ -39,13 +40,18 @@ namespace YGOSharp
}
}
catch
(
System
.
Exception
e
)
catch
(
System
.
Exception
e
)
{
{
success
=
false
;
UnityEngine
.
Debug
.
Log
(
line
);
UnityEngine
.
Debug
.
Log
(
line
);
UnityEngine
.
Debug
.
Log
(
e
);
UnityEngine
.
Debug
.
Log
(
e
);
}
}
}
}
current
=
new
Banlist
();
current
=
new
Banlist
();
current
.
Name
=
"N/A"
;
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
)
public
static
int
GetIndex
(
uint
hash
)
...
...
Assets/YGOSharp/CardsManager.cs
View file @
7afdb8f4
...
@@ -16,8 +16,9 @@ namespace YGOSharp
...
@@ -16,8 +16,9 @@ namespace YGOSharp
public
static
string
nullString
=
""
;
public
static
string
nullString
=
""
;
internal
static
bool
initialize
(
string
databaseFullPath
)
internal
static
bool
initialize
(
string
databaseFullPath
,
bool
test
=
false
)
{
{
if
(!
test
)
{
nullName
=
InterString
.
Get
(
"未知卡片"
);
nullName
=
InterString
.
Get
(
"未知卡片"
);
nullString
=
""
;
nullString
=
""
;
nullString
+=
"欢迎使用 KoishiPro2 iOS,本软件免责声明:[url=http://koishi.222diy.gdn/lab.html][u]http://koishi.222diy.gdn/lab.html[/u][/url]"
;
nullString
+=
"欢迎使用 KoishiPro2 iOS,本软件免责声明:[url=http://koishi.222diy.gdn/lab.html][u]http://koishi.222diy.gdn/lab.html[/u][/url]"
;
...
@@ -27,6 +28,7 @@ namespace YGOSharp
...
@@ -27,6 +28,7 @@ namespace YGOSharp
nullString
+=
"更多关于电脑/安卓版KoishiPro及7210服务器的信息可加QQ群338443272"
;
nullString
+=
"更多关于电脑/安卓版KoishiPro及7210服务器的信息可加QQ群338443272"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"\r\n\r\n"
;
nullString
+=
"喜欢游戏王DIY的朋友欢迎来222服QQ群642043095"
;
nullString
+=
"喜欢游戏王DIY的朋友欢迎来222服QQ群642043095"
;
}
bool
success
=
true
;
bool
success
=
true
;
try
{
try
{
using
(
SqliteConnection
connection
=
new
SqliteConnection
(
"Data Source="
+
databaseFullPath
))
using
(
SqliteConnection
connection
=
new
SqliteConnection
(
"Data Source="
+
databaseFullPath
))
...
@@ -39,7 +41,7 @@ namespace YGOSharp
...
@@ -39,7 +41,7 @@ namespace YGOSharp
{
{
while
(
reader
.
Read
())
while
(
reader
.
Read
())
{
{
LoadCard
(
reader
);
LoadCard
(
reader
,
test
);
}
}
}
}
}
}
...
@@ -86,10 +88,10 @@ namespace YGOSharp
...
@@ -86,10 +88,10 @@ namespace YGOSharp
return
returnValue
;
return
returnValue
;
}
}
private
static
void
LoadCard
(
IDataRecord
reader
)
private
static
void
LoadCard
(
IDataRecord
reader
,
bool
test
=
false
)
{
{
Card
card
=
new
Card
(
reader
);
Card
card
=
new
Card
(
reader
);
if
(!
_cards
.
ContainsKey
(
card
.
Id
))
if
(!
_cards
.
ContainsKey
(
card
.
Id
)
&&
!
test
)
{
{
_cards
.
Add
(
card
.
Id
,
card
);
_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