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
Tang Xinwei
windbot
Commits
360bfea5
Commit
360bfea5
authored
Nov 03, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename debug mode to safe mode
parent
62286326
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
16 deletions
+13
-16
Game/GameBehavior.cs
Game/GameBehavior.cs
+4
-9
Logger.cs
Logger.cs
+2
-1
Program.cs
Program.cs
+7
-6
No files found.
Game/GameBehavior.cs
View file @
360bfea5
...
...
@@ -261,15 +261,10 @@ namespace WindBot.Game
{
int
player
=
packet
.
ReadInt16
();
string
message
=
packet
.
ReadUnicode
(
256
);
if
(!
Program
.
DebugMode
)
{
string
myName
=
_room
.
Position
==
0
?
_room
.
Names
[
0
]
:
_room
.
Names
[
1
];
string
otherName
=
_room
.
Position
==
0
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
if
(
player
<
4
)
Logger
.
WriteLine
(
otherName
+
" say to "
+
myName
+
": "
+
message
);
//else
// Logger.WriteLine(myName + " System or Watch : " + message);
}
string
myName
=
_room
.
Position
==
0
?
_room
.
Names
[
0
]
:
_room
.
Names
[
1
];
string
otherName
=
_room
.
Position
==
0
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
if
(
player
<
4
)
Logger
.
DebugWriteLine
(
otherName
+
" say to "
+
myName
+
": "
+
message
);
}
private
void
OnErrorMsg
(
BinaryReader
packet
)
...
...
Logger.cs
View file @
360bfea5
...
...
@@ -10,8 +10,9 @@ namespace WindBot
}
public
static
void
DebugWriteLine
(
string
message
)
{
if
(
Program
.
DebugMode
)
#if DEBUG
Console
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"yy-MM-dd HH:mm:ss"
)
+
"] "
+
message
);
#endif
}
public
static
void
WriteErrorLine
(
string
message
)
{
...
...
Program.cs
View file @
360bfea5
...
...
@@ -11,10 +11,11 @@ namespace WindBot
{
public
class
Program
{
// in safe mode, all errors will be catched instead of causing the program to crash.
#if DEBUG
public
static
bool
DebugMode
=
tru
e
;
public
static
bool
SafeMode
=
fals
e
;
#else
public
static
bool
DebugMode
=
fals
e
;
public
static
bool
SafeMode
=
tru
e
;
#endif
internal
static
Random
Rand
;
...
...
@@ -122,7 +123,7 @@ namespace WindBot
Thread
workThread
=
new
Thread
(
new
ParameterizedThreadStart
(
Run
));
workThread
.
Start
(
Info
);
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
Logger
.
WriteErrorLine
(
"Start Thread Error: "
+
ex
);
}
...
...
@@ -130,7 +131,7 @@ namespace WindBot
ctx
.
Response
.
Close
();
}
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
Logger
.
WriteErrorLine
(
"Parse Http Request Error: "
+
ex
);
}
...
...
@@ -153,14 +154,14 @@ namespace WindBot
client
.
Tick
();
Thread
.
Sleep
(
30
);
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
Logger
.
WriteErrorLine
(
"Tick Error: "
+
ex
);
}
}
Logger
.
DebugWriteLine
(
client
.
Username
+
" end."
);
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
Logger
.
WriteErrorLine
(
"Run Error: "
+
ex
);
}
...
...
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