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
alstroemeria-silentlove
windbot
Commits
35cd5e6d
Commit
35cd5e6d
authored
Nov 01, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove RunFromEnv and DebugMode commandline
parent
966ea6bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
56 deletions
+1
-56
Program.cs
Program.cs
+1
-56
No files found.
Program.cs
View file @
35cd5e6d
...
...
@@ -27,18 +27,9 @@ namespace WindBot
int
argc
=
args
.
Length
;
// If the first commandline parameter is DebugMode
if
(
argc
>
0
&&
args
[
0
]
==
"DebugMode"
)
{
DebugMode
=
true
;
// Shift the args array to skip the first parameter
argc
--;
Array
.
Copy
(
args
,
1
,
args
,
0
,
argc
);
}
// Only one parameter will make Windbot run as a server, use the parameter as port
// provide a http interface to create bot.
// eg. http://127.0.0.1:2399/?name=%E2%91%A8&deck=Blue-Eyes&host=127.0.0.1&port=7911&dialog=cirno.zh-CN&version=492
2
// eg. http://127.0.0.1:2399/?name=%E2%91%A8&deck=Blue-Eyes&host=127.0.0.1&port=7911&dialog=cirno.zh-CN&version=492
8
if
(
argc
==
1
)
{
RunAsServer
(
Int32
.
Parse
(
args
[
0
]));
...
...
@@ -50,33 +41,6 @@ namespace WindBot
else
if
(
argc
==
5
)
{
RunFromArgs
(
args
);
Logger
.
WriteLine
(
"WindBot ended."
);
}
// Use environment variables to run Windbot
// List of variables required:
// YGOPRO_HOST
// YGOPRO_PORT
// YGOPRO_NAME
//
// List of variables optional:
// YGOPRO_DECK
// YGOPRO_VERSION
// YGOPRO_DIALOG
// YGOPRO_PASSWORD
//
// eg. (cmd)
// set YGOPRO_VERSION=4922
// set YGOPRO_HOST=127.0.0.1
// set YGOPRO_PORT=7911
// set YGOPRO_NAME=Meow
// set YGOPRO_DECK=Blue-Eyes
// set YGOPRO_DIALOG=zh-CN
// WindBot.exe
else
if
(
Environment
.
GetEnvironmentVariable
(
"YGOPRO_NAME"
)
!=
null
)
{
RunFromEnv
();
Logger
.
WriteLine
(
"WindBot ended."
);
}
// Else, tell the user to run it correctly
...
...
@@ -111,25 +75,6 @@ namespace WindBot
Run
(
Info
);
}
private
static
void
RunFromEnv
()
{
WindBotInfo
Info
=
new
WindBotInfo
();
Info
.
Name
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_NAME"
);
Info
.
Deck
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_DECK"
);
Info
.
Host
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_HOST"
);
Info
.
Port
=
Int32
.
Parse
(
Environment
.
GetEnvironmentVariable
(
"YGOPRO_PORT"
));
string
EnvDialog
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_DIALOG"
);
if
(
EnvDialog
!=
null
)
Info
.
Dialog
=
EnvDialog
;
string
EnvVersion
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_VERSION"
);
if
(
EnvVersion
!=
null
)
Info
.
Version
=
Int16
.
Parse
(
EnvVersion
);
string
EnvPassword
=
Environment
.
GetEnvironmentVariable
(
"YGOPRO_PASSWORD"
);
if
(
EnvPassword
!=
null
)
Info
.
HostInfo
=
EnvPassword
;
Run
(
Info
);
}
private
static
void
RunAsServer
(
int
ServerPort
)
{
using
(
HttpListener
MainServer
=
new
HttpListener
())
...
...
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