Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
YGOPRO-520DIY
ygopro
Commits
14c5632c
Commit
14c5632c
authored
Jun 25, 2025
by
xiaoye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a29afe20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+62
-0
gframe/data_manager.h
gframe/data_manager.h
+8
-0
No files found.
gframe/data_manager.cpp
View file @
14c5632c
...
...
@@ -243,6 +243,68 @@ void DataManager::ReadServerConfLine(const char* linebuf) {
}
}
}
bool
DataManager
::
LoadINI
(
const
char
*
file
)
{
FILE
*
fp
=
myfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadINI
(
linebuf
);
}
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadINI
(
const
wchar_t
*
file
)
{
FILE
*
fp
=
mywfopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
TEXT_LINE_SIZE
]{};
while
(
std
::
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadINI
(
linebuf
);
}
std
::
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadINI
(
irr
::
io
::
IReadFile
*
reader
)
{
char
ch
{};
std
::
string
linebuf
;
while
(
reader
->
read
(
&
ch
,
1
))
{
if
(
ch
==
'\0'
)
break
;
linebuf
.
push_back
(
ch
);
if
(
ch
==
'\n'
||
linebuf
.
size
()
>=
TEXT_LINE_SIZE
-
1
)
{
ReadINI
(
linebuf
.
data
());
linebuf
.
clear
();
}
}
reader
->
drop
();
return
true
;
}
void
DataManager
::
ReadINI
(
const
char
*
linebuf
)
{
iniPort
=
GetINIValue
(
linebuf
,
"ServerPort = "
);
iniHost
=
GetINIValue
(
linebuf
,
"ServerHost = "
);
iniName
=
GetINIValue
(
linebuf
,
"ServerName = "
);
if
(
iniName
!=
""
&&
iniHost
!=
""
)
{
std
::
string
combined
=
std
::
string
(
iniName
)
+
'|'
+
iniHost
;
if
(
iniPort
!=
""
)
combined
+=
':'
+
iniPort
;
const
char
*
result
=
combined
.
c_str
();
ReadServerConfLine
(
result
);
}
}
const
char
*
GetINIValue
(
const
char
*
line
,
const
char
*
key
)
{
if
(
!
line
||
!
key
)
return
""
;
const
char
*
keyPos
=
strstr
(
line
,
key
);
if
(
!
keyPos
)
return
""
;
const
char
*
valStart
=
keyPos
+
strlen
(
key
);
while
(
*
valStart
==
' '
)
valStart
++
;
const
char
*
valEnd
=
valStart
;
while
(
*
valEnd
&&
*
valEnd
!=
'\n'
&&
*
valEnd
!=
'\r'
)
valEnd
++
;
return
std
::
string
(
valStart
,
valEnd
).
c_str
();
}
bool
DataManager
::
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
std
::
snprintf
(
errmsg
,
sizeof
errmsg
,
"%s"
,
sqlite3_errmsg
(
pDB
));
if
(
pStmt
)
...
...
gframe/data_manager.h
View file @
14c5632c
...
...
@@ -54,6 +54,11 @@ public:
bool
LoadServerList
(
const
wchar_t
*
file
);
bool
LoadServerList
(
irr
::
io
::
IReadFile
*
reader
);
void
ReadServerConfLine
(
const
char
*
linebuf
);
bool
LoadINI
(
const
char
*
file
);
bool
LoadINI
(
const
wchar_t
*
file
);
bool
LoadINI
(
irr
::
io
::
IReadFile
*
reader
);
void
ReadINI
(
const
char
*
linebuf
);
const
char
*
GetINIValue
(
const
char
*
line
,
const
char
*
key
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
code_pointer
GetCodePointer
(
unsigned
int
code
)
const
;
...
...
@@ -109,6 +114,9 @@ private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
std
::
vector
<
uint16_t
>>
extra_setcode
;
const
char
*
iniName
;
const
char
*
iniHost
;
const
char
*
iniPort
;
};
extern
DataManager
dataManager
;
...
...
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