Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
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
神之吹息
windbot
Commits
bbb765d1
Commit
bbb765d1
authored
Mar 18, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Program.ReadFile
parent
3e8635b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
Game/AI/Dialogs.cs
Game/AI/Dialogs.cs
+1
-1
Game/Deck.cs
Game/Deck.cs
+1
-1
Program.cs
Program.cs
+17
-0
No files found.
Game/AI/Dialogs.cs
View file @
bbb765d1
...
@@ -59,7 +59,7 @@ namespace WindBot.Game.AI
...
@@ -59,7 +59,7 @@ namespace WindBot.Game.AI
_game
=
game
;
_game
=
game
;
DataContractJsonSerializer
serializer
=
new
DataContractJsonSerializer
(
typeof
(
DialogsData
));
DataContractJsonSerializer
serializer
=
new
DataContractJsonSerializer
(
typeof
(
DialogsData
));
string
dialogfilename
=
game
.
Dialog
;
string
dialogfilename
=
game
.
Dialog
;
using
(
FileStream
fs
=
File
.
OpenRead
(
"Dialogs/"
+
dialogfilename
+
".
json"
))
using
(
FileStream
fs
=
Program
.
ReadFile
(
"Dialogs"
,
dialogfilename
,
"
json"
))
{
{
DialogsData
data
=
(
DialogsData
)
serializer
.
ReadObject
(
fs
);
DialogsData
data
=
(
DialogsData
)
serializer
.
ReadObject
(
fs
);
_welcome
=
data
.
welcome
;
_welcome
=
data
.
welcome
;
...
...
Game/Deck.cs
View file @
bbb765d1
...
@@ -43,7 +43,7 @@ namespace WindBot.Game
...
@@ -43,7 +43,7 @@ namespace WindBot.Game
StreamReader
reader
=
null
;
StreamReader
reader
=
null
;
try
try
{
{
reader
=
new
StreamReader
(
new
FileStream
(
"Decks/"
+
name
+
".ydk"
,
FileMode
.
Open
,
FileAccess
.
Read
));
reader
=
new
StreamReader
(
Program
.
ReadFile
(
"Decks"
,
name
,
"ydk"
));
Deck
deck
=
new
Deck
();
Deck
deck
=
new
Deck
();
bool
side
=
false
;
bool
side
=
false
;
...
...
Program.cs
View file @
bbb765d1
...
@@ -197,5 +197,22 @@ namespace WindBot
...
@@ -197,5 +197,22 @@ namespace WindBot
}
}
#endif
#endif
}
}
public
static
FileStream
ReadFile
(
string
directory
,
string
filename
,
string
extension
)
{
string
tryfilename
=
filename
+
"."
+
extension
;
string
fullpath
=
Path
.
Combine
(
directory
,
tryfilename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
filename
;
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../"
,
filename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../deck/"
,
filename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../"
,
tryfilename
);
if
(!
File
.
Exists
(
fullpath
))
fullpath
=
Path
.
Combine
(
"../deck/"
,
tryfilename
);
return
new
FileStream
(
fullpath
,
FileMode
.
Open
,
FileAccess
.
Read
);
}
}
}
}
}
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