Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
Windbot-408
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-408
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
...
@@ -261,15 +261,10 @@ namespace WindBot.Game
{
{
int
player
=
packet
.
ReadInt16
();
int
player
=
packet
.
ReadInt16
();
string
message
=
packet
.
ReadUnicode
(
256
);
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
];
string
myName
=
_room
.
Position
==
0
?
_room
.
Names
[
0
]
:
_room
.
Names
[
1
];
if
(
player
<
4
)
string
otherName
=
_room
.
Position
==
0
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
Logger
.
DebugWriteLine
(
otherName
+
" say to "
+
myName
+
": "
+
message
);
if
(
player
<
4
)
Logger
.
WriteLine
(
otherName
+
" say to "
+
myName
+
": "
+
message
);
//else
// Logger.WriteLine(myName + " System or Watch : " + message);
}
}
}
private
void
OnErrorMsg
(
BinaryReader
packet
)
private
void
OnErrorMsg
(
BinaryReader
packet
)
...
...
Logger.cs
View file @
360bfea5
...
@@ -10,8 +10,9 @@ namespace WindBot
...
@@ -10,8 +10,9 @@ namespace WindBot
}
}
public
static
void
DebugWriteLine
(
string
message
)
public
static
void
DebugWriteLine
(
string
message
)
{
{
if
(
Program
.
DebugMode
)
#if DEBUG
Console
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"yy-MM-dd HH:mm:ss"
)
+
"] "
+
message
);
Console
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"yy-MM-dd HH:mm:ss"
)
+
"] "
+
message
);
#endif
}
}
public
static
void
WriteErrorLine
(
string
message
)
public
static
void
WriteErrorLine
(
string
message
)
{
{
...
...
Program.cs
View file @
360bfea5
...
@@ -11,10 +11,11 @@ namespace WindBot
...
@@ -11,10 +11,11 @@ namespace WindBot
{
{
public
class
Program
public
class
Program
{
{
// in safe mode, all errors will be catched instead of causing the program to crash.
#if DEBUG
#if DEBUG
public
static
bool
DebugMode
=
tru
e
;
public
static
bool
SafeMode
=
fals
e
;
#else
#else
public
static
bool
DebugMode
=
fals
e
;
public
static
bool
SafeMode
=
tru
e
;
#endif
#endif
internal
static
Random
Rand
;
internal
static
Random
Rand
;
...
@@ -122,7 +123,7 @@ namespace WindBot
...
@@ -122,7 +123,7 @@ namespace WindBot
Thread
workThread
=
new
Thread
(
new
ParameterizedThreadStart
(
Run
));
Thread
workThread
=
new
Thread
(
new
ParameterizedThreadStart
(
Run
));
workThread
.
Start
(
Info
);
workThread
.
Start
(
Info
);
}
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
{
Logger
.
WriteErrorLine
(
"Start Thread Error: "
+
ex
);
Logger
.
WriteErrorLine
(
"Start Thread Error: "
+
ex
);
}
}
...
@@ -130,7 +131,7 @@ namespace WindBot
...
@@ -130,7 +131,7 @@ namespace WindBot
ctx
.
Response
.
Close
();
ctx
.
Response
.
Close
();
}
}
}
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
{
Logger
.
WriteErrorLine
(
"Parse Http Request Error: "
+
ex
);
Logger
.
WriteErrorLine
(
"Parse Http Request Error: "
+
ex
);
}
}
...
@@ -153,14 +154,14 @@ namespace WindBot
...
@@ -153,14 +154,14 @@ namespace WindBot
client
.
Tick
();
client
.
Tick
();
Thread
.
Sleep
(
30
);
Thread
.
Sleep
(
30
);
}
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
{
Logger
.
WriteErrorLine
(
"Tick Error: "
+
ex
);
Logger
.
WriteErrorLine
(
"Tick Error: "
+
ex
);
}
}
}
}
Logger
.
DebugWriteLine
(
client
.
Username
+
" end."
);
Logger
.
DebugWriteLine
(
client
.
Username
+
" end."
);
}
}
catch
(
Exception
ex
)
when
(
!
Debug
Mode
)
catch
(
Exception
ex
)
when
(
Safe
Mode
)
{
{
Logger
.
WriteErrorLine
(
"Run Error: "
+
ex
);
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