Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
7978abc0
Commit
7978abc0
authored
Jul 26, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 为了调试通讯内容,FObjSys 添加 NLog, logger分别为 FObjSysOfServer 与 FObjSysOfClient
parent
c5be3a15
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
FObjBase.csproj
Project.FLY.FObjSys/FObjSys/FObjBase.csproj
+8
-0
FObjSys.cs
Project.FLY.FObjSys/FObjSys/FObjSys.cs
+31
-2
No files found.
Project.FLY.FObjSys/FObjSys/FObjBase.csproj
View file @
7978abc0
...
@@ -68,6 +68,14 @@
...
@@ -68,6 +68,14 @@
<Name>
Misc
</Name>
<Name>
Misc
</Name>
</ProjectReference>
</ProjectReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"Newtonsoft.Json"
>
<Version>
12.0.2
</Version>
</PackageReference>
<PackageReference
Include=
"NLog"
>
<Version>
4.6.6
</Version>
</PackageReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
Project.FLY.FObjSys/FObjSys/FObjSys.cs
View file @
7978abc0
...
@@ -19,6 +19,11 @@ namespace FObjBase
...
@@ -19,6 +19,11 @@ namespace FObjBase
/// </summary>
/// </summary>
public
class
FObjSys
:
IFObjSysAsClient
,
IFObjSysAsServer
public
class
FObjSys
:
IFObjSysAsClient
,
IFObjSysAsServer
{
{
/// <summary>
/// nlog调试信息
/// </summary>
static
NLog
.
Logger
loggerServer
=
NLog
.
LogManager
.
GetLogger
(
"FObjSysOfServer"
);
static
NLog
.
Logger
loggerClient
=
NLog
.
LogManager
.
GetLogger
(
"FObjSysOfClient"
);
/// <summary>
/// <summary>
/// 全局 当前正在操作的 fobj系统
/// 全局 当前正在操作的 fobj系统
/// </summary>
/// </summary>
...
@@ -782,6 +787,10 @@ namespace FObjBase
...
@@ -782,6 +787,10 @@ namespace FObjBase
void
CConnConnectAction
(
IFConn
conn
)
void
CConnConnectAction
(
IFConn
conn
)
{
{
TCPCConn
cc
=
(
TCPCConn
)
conn
;
TCPCConn
cc
=
(
TCPCConn
)
conn
;
if
(
loggerClient
.
IsDebugEnabled
)
{
loggerClient
.
Debug
(
$"CConnConnectAction
{
cc
.
sock
.
RemoteEndPoint
}
conn.IsConnected=
{
conn
.
IsConnected
}
"
);
}
KeyValuePair
<
TCPCConn
,
List
<
UInt32
>>
cc_kv
;
KeyValuePair
<
TCPCConn
,
List
<
UInt32
>>
cc_kv
;
try
try
...
@@ -806,6 +815,14 @@ namespace FObjBase
...
@@ -806,6 +815,14 @@ namespace FObjBase
/// <param name="conn"></param>
/// <param name="conn"></param>
void
SConnConnectAction
(
IFConn
conn
)
void
SConnConnectAction
(
IFConn
conn
)
{
{
if
(
loggerServer
.
IsDebugEnabled
)
{
if
(
conn
is
TCPConn
)
{
loggerServer
.
Debug
(
$"SConnConnectAction
{(
conn
as
TCPConn
).
sock
.
RemoteEndPoint
}
IsConnected=
{
conn
.
IsConnected
}
"
);
}
}
//通知obj 连接状态
//通知obj 连接状态
foreach
(
UInt32
objid
in
m_serverConnectedNotifyObjID
)
foreach
(
UInt32
objid
in
m_serverConnectedNotifyObjID
)
{
{
...
@@ -1000,6 +1017,14 @@ namespace FObjBase
...
@@ -1000,6 +1017,14 @@ namespace FObjBase
if
(!
p
.
TryParse
(
packet
))
if
(!
p
.
TryParse
(
packet
))
return
false
;
return
false
;
if
(
loggerClient
.
IsDebugEnabled
)
{
string
p_json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
,
Newtonsoft
.
Json
.
Formatting
.
Indented
);
loggerClient
.
Debug
(
$"ParsePacketInClient
{(
conn
as
TCPConn
).
sock
.
RemoteEndPoint
}
packet=
{
p_json
}
"
);
}
conn
.
TranID
=
p
.
magic
;
conn
.
TranID
=
p
.
magic
;
{
{
if
(
Process
(
conn
,
p
.
srcid
,
p
.
destid
,
p
.
magic
,
p
.
info
,
p
.
buf
,
out
byte
[]
retdata
)
==
0
)
if
(
Process
(
conn
,
p
.
srcid
,
p
.
destid
,
p
.
magic
,
p
.
info
,
p
.
buf
,
out
byte
[]
retdata
)
==
0
)
...
@@ -1071,11 +1096,15 @@ namespace FObjBase
...
@@ -1071,11 +1096,15 @@ namespace FObjBase
/// <returns></returns>
/// <returns></returns>
bool
ParsePacketInServer
(
byte
[]
packet
,
IFConn
conn
)
bool
ParsePacketInServer
(
byte
[]
packet
,
IFConn
conn
)
{
{
//DateTime dt2 = DateTime.Now;
Pack_Proto
p
=
new
Pack_Proto
();
Pack_Proto
p
=
new
Pack_Proto
();
if
(!
p
.
TryParse
(
packet
))
if
(!
p
.
TryParse
(
packet
))
return
false
;
return
false
;
if
(
loggerServer
.
IsDebugEnabled
)
{
string
p_json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
,
Newtonsoft
.
Json
.
Formatting
.
Indented
);
loggerClient
.
Debug
(
$"ParsePacketInServer
{(
conn
as
TCPConn
).
sock
.
RemoteEndPoint
}
packet=
{
p_json
}
"
);
}
conn
.
TranID
=
p
.
magic
;
conn
.
TranID
=
p
.
magic
;
{
{
if
(
Process
(
conn
,
p
.
srcid
,
p
.
destid
,
p
.
magic
,
p
.
info
,
p
.
buf
,
out
byte
[]
retdata
)
==
0
)
if
(
Process
(
conn
,
p
.
srcid
,
p
.
destid
,
p
.
magic
,
p
.
info
,
p
.
buf
,
out
byte
[]
retdata
)
==
0
)
...
...
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