Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Framework
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.Framework
Commits
0c4ca99f
Commit
0c4ca99f
authored
Aug 26, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 手动裁切
2. TCP 监听器
parent
f6e69ae5
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
432 additions
and
12 deletions
+432
-12
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
+1
-0
VIZ.Framework.Connection/ConnectionManager.cs
+6
-0
VIZ.Framework.Connection/Core/ConnListenerBase.cs
+24
-0
VIZ.Framework.Connection/Listener/TCP/TcpConnectionListener.cs
+106
-0
VIZ.Framework.Connection/Protocol/TCP/TcpEndpointManager.cs
+16
-2
VIZ.Framework.Connection/Provider/CommandLine/ConnCommandLinePackageProvider.cs
+1
-1
VIZ.Framework.Connection/VIZ.Framework.Connection.csproj
+2
-0
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DManager.cs
+3
-2
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DMapping.cs
+34
-0
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DModel.cs
+9
-3
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DSmooth.cs
+1
-1
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DTcpManager.cs
+29
-0
VIZ.Framework.Core/VIZ.Framework.Core.csproj
+2
-0
VIZ.Framework.Module/Setup/Provider/Setup/AppSetup_Navigation3D.cs
+6
-1
VIZ.Framework.Module/ThreeDMouse/TCP/Navigation3DCommandProvider.cs
+94
-0
VIZ.Framework.Module/ThreeDMouse/TCP/Navigation3DTcpListener.cs
+64
-0
VIZ.Framework.Module/VIZ.Framework.Module.csproj
+2
-0
VIZ.Framework.Storage/Ini/Config/ApplicationConfig.cs
+18
-0
VIZ.Framework.Storage/VIZ.Framework.Storage.csproj
+2
-0
VIZ.Framework.UnitTest/JsonTest.cs
+12
-2
No files found.
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
View file @
0c4ca99f
...
@@ -111,6 +111,7 @@ namespace VIZ.Framework.Common
...
@@ -111,6 +111,7 @@ namespace VIZ.Framework.Common
return
;
return
;
}
}
// 处理数据
this
.
triggerEvent
(
video
,
data
);
this
.
triggerEvent
(
video
,
data
);
this
.
VideoFrame
=
null
;
this
.
VideoFrame
=
null
;
this
.
DataFrame
=
null
;
this
.
DataFrame
=
null
;
...
...
VIZ.Framework.Connection/ConnectionManager.cs
View file @
0c4ca99f
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Net.Sockets
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -25,5 +26,10 @@ namespace VIZ.Framework.Connection
...
@@ -25,5 +26,10 @@ namespace VIZ.Framework.Connection
/// 串口连接
/// 串口连接
/// </summary>
/// </summary>
public
static
SerialPortConnection
SerialPortConnection
{
get
;
set
;
}
public
static
SerialPortConnection
SerialPortConnection
{
get
;
set
;
}
/// <summary>
/// TCP连接监听器
/// </summary>
public
static
Dictionary
<
string
,
TcpConnectionListener
>
TcpConnectionListeners
{
get
;
private
set
;
}
=
new
Dictionary
<
string
,
TcpConnectionListener
>();
}
}
}
}
VIZ.Framework.Connection/Core/ConnListenerBase.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Connection
{
/// <summary>
/// 连接监听基类
/// </summary>
public
abstract
class
ConnListenerBase
:
IDisposable
{
/// <summary>
/// 键
/// </summary>
public
string
Key
{
get
;
protected
set
;
}
/// <summary>
/// 销毁
/// </summary>
public
abstract
void
Dispose
();
}
}
VIZ.Framework.Connection/Listener/TCP/TcpConnectionListener.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
log4net
;
namespace
VIZ.Framework.Connection
{
/// <summary>
/// TCP连接监听
/// </summary>
public
abstract
class
TcpConnectionListener
:
ConnListenerBase
{
/// <summary>
/// 日志
/// </summary>
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
TcpConnectionListener
));
/// <summary>
/// TCP监听
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="port">端口</param>
public
TcpConnectionListener
(
string
ip
,
int
port
)
{
this
.
IP
=
ip
;
this
.
Port
=
port
;
IPEndPoint
endPoint
=
new
IPEndPoint
(
IPAddress
.
Parse
(
ip
),
port
);
this
.
Listener
=
new
TcpListener
(
endPoint
);
}
/// <summary>
/// IP地址
/// </summary>
public
string
IP
{
get
;
private
set
;
}
/// <summary>
/// 端口
/// </summary>
public
int
Port
{
get
;
set
;
}
/// <summary>
/// TCP监听
/// </summary>
public
TcpListener
Listener
{
get
;
private
set
;
}
/// <summary>
/// 连接的客户端终结点
/// </summary>
public
List
<
TcpEndpointManager
>
EndpointManagers
{
get
;
private
set
;
}
=
new
List
<
TcpEndpointManager
>();
/// <summary>
/// 开始监听
/// </summary>
public
void
Start
()
{
this
.
Listener
.
Start
();
this
.
Listener
.
BeginAcceptTcpClient
(
new
AsyncCallback
(
this
.
acceptTcpclient
),
this
.
Listener
);
}
/// <summary>
/// 销毁
/// </summary>
public
override
void
Dispose
()
{
this
.
EndpointManagers
?.
ForEach
(
p
=>
p
.
Dispose
());
this
.
Listener
?.
Stop
();
}
/// <summary>
/// 创建终结点管理器
/// </summary>
/// <param name="tcpClient">TCP客户端</param>
/// <returns>TCP终结点管理器</returns>
protected
abstract
TcpEndpointManager
CreateEndpointManager
(
TcpClient
tcpClient
);
/// <summary>
/// 接收到TCP连接请求
/// </summary>
private
void
acceptTcpclient
(
IAsyncResult
result
)
{
//获取监听事件,处理客户端请求
TcpListener
listerer
=
(
TcpListener
)
result
.
AsyncState
;
TcpClient
client
=
listerer
.
EndAcceptTcpClient
(
result
);
TcpEndpointManager
manager
=
this
.
CreateEndpointManager
(
client
);
lock
(
this
.
EndpointManagers
)
{
this
.
EndpointManagers
.
Add
(
manager
);
}
manager
.
StartRecvMessage
();
Debug
.
WriteLine
(
$"接收到TCP客户端连接,当前连接数:
{
this
.
EndpointManagers
.
Count
}
"
);
this
.
Listener
.
BeginAcceptTcpClient
(
new
AsyncCallback
(
this
.
acceptTcpclient
),
this
.
Listener
);
}
}
}
VIZ.Framework.Connection/Protocol/TCP/TcpEndpointManager.cs
View file @
0c4ca99f
...
@@ -34,14 +34,25 @@ namespace VIZ.Framework.Connection
...
@@ -34,14 +34,25 @@ namespace VIZ.Framework.Connection
/// TCP终结点管理器
/// TCP终结点管理器
/// </summary>
/// </summary>
/// <param name="key">网络终结点键</param>
/// <param name="key">网络终结点键</param>
/// <param name="ip">IP</param>
/// <param name="port">端口</param>
public
TcpEndpointManager
(
string
key
)
public
TcpEndpointManager
(
string
key
)
{
{
this
.
Key
=
key
;
this
.
Key
=
key
;
}
}
/// <summary>
/// <summary>
/// TCP终结点管理器
/// </summary>
/// <param name="key">网络终结点键</param>
/// <param name="tcpClient">TCP客户端</param>
public
TcpEndpointManager
(
string
key
,
TcpClient
tcpClient
)
{
this
.
Key
=
key
;
this
.
TcpClient
=
tcpClient
;
this
.
LocalIP
=
this
.
TcpClient
.
Client
.
LocalEndPoint
.
ToString
();
this
.
NetworkStream
=
this
.
TcpClient
.
GetStream
();
}
/// <summary>
/// 网络终结点键
/// 网络终结点键
/// </summary>
/// </summary>
public
string
Key
{
get
;
private
set
;
}
public
string
Key
{
get
;
private
set
;
}
...
@@ -108,6 +119,9 @@ namespace VIZ.Framework.Connection
...
@@ -108,6 +119,9 @@ namespace VIZ.Framework.Connection
/// <param name="remotePort">远程端口</param>
/// <param name="remotePort">远程端口</param>
public
void
Connect
(
string
remoteIP
,
int
remotePort
)
public
void
Connect
(
string
remoteIP
,
int
remotePort
)
{
{
if
(
this
.
TcpClient
!=
null
)
throw
new
Exception
(
"tcp client is already exists"
);
this
.
RemoteIP
=
remoteIP
;
this
.
RemoteIP
=
remoteIP
;
this
.
RemotePort
=
remotePort
;
this
.
RemotePort
=
remotePort
;
...
...
VIZ.Framework.Connection/Provider/CommandLine/ConnCommandLinePackageProvider.cs
View file @
0c4ca99f
...
@@ -42,7 +42,7 @@ namespace VIZ.Framework.Connection
...
@@ -42,7 +42,7 @@ namespace VIZ.Framework.Connection
str
=
this
.
lastCommandString
+
str
;
str
=
this
.
lastCommandString
+
str
;
this
.
lastCommandString
=
null
;
this
.
lastCommandString
=
null
;
string
[]
commands
=
str
.
Split
(
new
char
[]
{
'\r'
,
'\n'
});
string
[]
commands
=
str
.
Split
(
new
char
[]
{
'\r'
,
'\n'
}
,
StringSplitOptions
.
RemoveEmptyEntries
);
// 最后一个命令是否完整
// 最后一个命令是否完整
bool
isLastCommandComplete
=
str
.
EndsWith
(
"\n"
)
||
str
.
EndsWith
(
"\r"
);
bool
isLastCommandComplete
=
str
.
EndsWith
(
"\n"
)
||
str
.
EndsWith
(
"\r"
);
...
...
VIZ.Framework.Connection/VIZ.Framework.Connection.csproj
View file @
0c4ca99f
...
@@ -70,10 +70,12 @@
...
@@ -70,10 +70,12 @@
<Compile Include="ConnectionManager.cs" />
<Compile Include="ConnectionManager.cs" />
<Compile Include="Core\ConnBitLengthAttribute.cs" />
<Compile Include="Core\ConnBitLengthAttribute.cs" />
<Compile Include="Core\ConnInfoBase.cs" />
<Compile Include="Core\ConnInfoBase.cs" />
<Compile Include="Core\ConnListenerBase.cs" />
<Compile Include="Core\ConnMessageBase.cs" />
<Compile Include="Core\ConnMessageBase.cs" />
<Compile Include="Core\ConnPackageInfo.cs" />
<Compile Include="Core\ConnPackageInfo.cs" />
<Compile Include="Core\ConnPackageProviderAttribute.cs" />
<Compile Include="Core\ConnPackageProviderAttribute.cs" />
<Compile Include="Core\ConnSendMessage.cs" />
<Compile Include="Core\ConnSendMessage.cs" />
<Compile Include="Listener\TCP\TcpConnectionListener.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Protocol\SerialPort\SerialPortEndpointManagerExpand.cs" />
<Compile Include="Protocol\SerialPort\SerialPortEndpointManagerExpand.cs" />
<Compile Include="Protocol\SerialPort\SerialPortEndpointManager.cs" />
<Compile Include="Protocol\SerialPort\SerialPortEndpointManager.cs" />
...
...
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DManager.cs
View file @
0c4ca99f
...
@@ -45,9 +45,10 @@ namespace VIZ.Framework.Core
...
@@ -45,9 +45,10 @@ namespace VIZ.Framework.Core
/// </summary>
/// </summary>
/// <param name="profileName">3D鼠标配置名称</param>
/// <param name="profileName">3D鼠标配置名称</param>
/// <param name="maxX">X偏移量最大值</param>
/// <param name="maxX">X偏移量最大值</param>
public
static
void
Init
(
string
profileName
,
double
maxX
)
/// <param name="smoothCoefficient">平滑系数</param>
public
static
void
Init
(
string
profileName
,
double
maxX
,
double
smoothCoefficient
)
{
{
Navigation3DModel
=
new
Navigation3DModel
();
Navigation3DModel
=
new
Navigation3DModel
(
smoothCoefficient
);
Navigation3DModel
.
MaxX
=
maxX
;
Navigation3DModel
.
MaxX
=
maxX
;
Navigation3D
=
new
Navigation3D
(
Navigation3DModel
);
Navigation3D
=
new
Navigation3D
(
Navigation3DModel
);
...
...
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DMapping.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// 3D鼠标映射
/// </summary>
public
class
Navigation3DMapping
{
/// <summary>
/// 编号
/// </summary>
public
int
ID
{
get
;
set
;
}
/// <summary>
/// 最小值
/// </summary>
public
int
MinValue
{
get
;
set
;
}
/// <summary>
/// 最大值
/// </summary>
public
int
MaxValue
{
get
;
set
;
}
/// <summary>
/// 映射值
/// </summary>
public
int
MappingValue
{
get
;
set
;
}
}
}
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DModel.cs
View file @
0c4ca99f
...
@@ -16,9 +16,10 @@ namespace VIZ.Framework.Core
...
@@ -16,9 +16,10 @@ namespace VIZ.Framework.Core
/// <summary>
/// <summary>
/// 3D鼠标模型
/// 3D鼠标模型
/// </summary>
/// </summary>
public
Navigation3DModel
()
public
Navigation3DModel
(
double
smoothCoefficient
)
{
{
this
.
Smooth
.
Init
(
0
);
this
.
Smooth
.
Init
(
0
,
this
.
SmoothCoefficient
);
}
}
/// <summary>
/// <summary>
...
@@ -52,6 +53,11 @@ namespace VIZ.Framework.Core
...
@@ -52,6 +53,11 @@ namespace VIZ.Framework.Core
public
TimeSpan
RenderTime
{
get
;
set
;
}
=
TimeSpan
.
Zero
;
public
TimeSpan
RenderTime
{
get
;
set
;
}
=
TimeSpan
.
Zero
;
/// <summary>
/// <summary>
/// 平滑系数
/// </summary>
public
double
SmoothCoefficient
{
get
;
set
;
}
=
0.015
;
/// <summary>
/// 平滑处理器
/// 平滑处理器
/// </summary>
/// </summary>
private
Navigation3DSmooth
Smooth
=
new
Navigation3DSmooth
();
private
Navigation3DSmooth
Smooth
=
new
Navigation3DSmooth
();
...
@@ -85,7 +91,7 @@ namespace VIZ.Framework.Core
...
@@ -85,7 +91,7 @@ namespace VIZ.Framework.Core
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
-
x
,
0
,
5550
,
1
);
-
x
,
0
,
5550
,
1
);
this
.
Smooth
.
Init
(
x
);
this
.
Smooth
.
Init
(
x
,
0
,
this
.
SmoothCoefficient
);
}
}
}
}
}
}
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DSmooth.cs
View file @
0c4ca99f
...
@@ -34,7 +34,7 @@ namespace VIZ.Framework.Core
...
@@ -34,7 +34,7 @@ namespace VIZ.Framework.Core
/// <param name="min_cutoff">终止值</param>
/// <param name="min_cutoff">终止值</param>
/// <param name="beta"></param>
/// <param name="beta"></param>
/// <param name="d_cutoff"></param>
/// <param name="d_cutoff"></param>
public
void
Init
(
double
x0
,
double
dx0
=
0
,
double
min_cutoff
=
0.0
2
,
double
beta
=
0
,
double
d_cutoff
=
1
)
public
void
Init
(
double
x0
,
double
dx0
=
0
,
double
min_cutoff
=
0.0
15
,
double
beta
=
0
,
double
d_cutoff
=
1
)
{
{
this
.
min_cutoff
=
min_cutoff
;
this
.
min_cutoff
=
min_cutoff
;
this
.
beta
=
beta
;
this
.
beta
=
beta
;
...
...
VIZ.Framework.Core/Expand/ThreeDMouse/Navigation3DTcpManager.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// 3D鼠标TCP管理器
/// </summary>
public
static
class
Navigation3DTcpManager
{
/// <summary>
/// 命令
/// </summary>
public
static
string
Command
{
get
;
set
;
}
/// <summary>
/// 值
/// </summary>
public
static
int
Value
{
get
;
set
;
}
/// <summary>
/// 映射值
/// </summary>
public
static
int
MappingValue
{
get
;
set
;
}
}
}
VIZ.Framework.Core/VIZ.Framework.Core.csproj
View file @
0c4ca99f
...
@@ -131,7 +131,9 @@
...
@@ -131,7 +131,9 @@
<Compile Include="Expand\Monitor\System\Info\SystemMonitorInfo.cs" />
<Compile Include="Expand\Monitor\System\Info\SystemMonitorInfo.cs" />
<Compile Include="Expand\Monitor\System\SystemMonitorTask.cs" />
<Compile Include="Expand\Monitor\System\SystemMonitorTask.cs" />
<Compile Include="Core\Net\NetHelper.cs" />
<Compile Include="Core\Net\NetHelper.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DMapping.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DSmoothInner.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DSmoothInner.cs" />
<Compile Include="Expand\ThreeDMouse\Navigation3DTcpManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Expand\SharpDx\RawRectangleFExpand.cs" />
<Compile Include="Expand\SharpDx\RawRectangleFExpand.cs" />
<Compile Include="Expand\SharpDx\SharpDxColorHelper.cs" />
<Compile Include="Expand\SharpDx\SharpDxColorHelper.cs" />
...
...
VIZ.Framework.Module/Setup/Provider/Setup/AppSetup_Navigation3D.cs
View file @
0c4ca99f
...
@@ -28,6 +28,11 @@ namespace VIZ.Framework.Module
...
@@ -28,6 +28,11 @@ namespace VIZ.Framework.Module
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 3D鼠标"
;
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 3D鼠标"
;
/// <summary>
/// <summary>
/// 3D鼠标平滑系数
/// </summary>
private
static
readonly
double
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT
=
ApplicationDomain
.
IniStorage
.
GetValue
<
ApplicationConfig
,
double
>(
p
=>
p
.
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT
);
/// <summary>
/// 执行启动
/// 执行启动
/// </summary>
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <param name="context">应用程序启动上下文</param>
...
@@ -37,7 +42,7 @@ namespace VIZ.Framework.Module
...
@@ -37,7 +42,7 @@ namespace VIZ.Framework.Module
string
profileName
=
ApplicationDomain
.
IniStorage
.
GetValue
<
Navigation3DConfig
,
string
>(
p
=>
p
.
NAVIGATION3D_PROFILE_NAME
);
string
profileName
=
ApplicationDomain
.
IniStorage
.
GetValue
<
Navigation3DConfig
,
string
>(
p
=>
p
.
NAVIGATION3D_PROFILE_NAME
);
double
maxX
=
ApplicationDomain
.
IniStorage
.
GetValue
<
Navigation3DConfig
,
double
>(
p
=>
p
.
NAVIGATION3D_MAX_VALUE
);
double
maxX
=
ApplicationDomain
.
IniStorage
.
GetValue
<
Navigation3DConfig
,
double
>(
p
=>
p
.
NAVIGATION3D_MAX_VALUE
);
Navigation3DManager
.
Init
(
profileName
,
maxX
);
Navigation3DManager
.
Init
(
profileName
,
maxX
,
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT
);
return
true
;
return
true
;
}
}
...
...
VIZ.Framework.Module/ThreeDMouse/TCP/Navigation3DCommandProvider.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Connection
;
using
log4net
;
using
System.Diagnostics
;
using
VIZ.Framework.Core
;
namespace
VIZ.Framework.Module
{
/// <summary>
/// 3D鼠标命令行解释器
/// </summary>
public
class
Navigation3DCommandProvider
:
ConnCommandLinePackageProvider
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
Navigation3DCommandProvider
));
/// <summary>
/// 3D鼠标命令行解释器
/// </summary>
/// <param name="mappings">映射集合</param>
public
Navigation3DCommandProvider
(
List
<
Navigation3DMapping
>
mappings
)
{
this
.
Mappings
=
mappings
;
}
/// <summary>
/// 映射值
/// </summary>
public
List
<
Navigation3DMapping
>
Mappings
{
get
;
private
set
;
}
/// <summary>
/// 执行命令
/// </summary>
/// <param name="info">命令行信息</param>
protected
override
void
Execute
(
ConnCommandLineInfo
info
)
{
if
(
this
.
Mappings
==
null
||
this
.
Mappings
.
Count
==
0
)
return
;
string
[]
args
=
info
.
Command
.
Split
(
new
char
[]
{
' '
},
StringSplitOptions
.
RemoveEmptyEntries
);
string
cmd
=
null
;
int
value1
=
0
;
int
value2
=
0
;
if
(
args
.
Length
>=
1
)
{
cmd
=
args
[
0
];
}
if
(
args
.
Length
>=
2
)
{
int
.
TryParse
(
args
[
1
],
out
value1
);
}
if
(
args
.
Length
>=
3
)
{
int
.
TryParse
(
args
[
2
],
out
value2
);
}
int
temp
=
Math
.
Abs
(
value2
);
Navigation3DMapping
first
=
this
.
Mappings
.
FirstOrDefault
();
Navigation3DMapping
last
=
this
.
Mappings
.
LastOrDefault
();
Navigation3DTcpManager
.
Command
=
cmd
;
if
(
temp
==
0
||
temp
<
first
.
MinValue
)
{
Navigation3DTcpManager
.
Value
=
0
;
Navigation3DTcpManager
.
MappingValue
=
0
;
return
;
}
if
(
temp
>=
last
.
MaxValue
)
{
Navigation3DTcpManager
.
Value
=
value2
;
Navigation3DTcpManager
.
MappingValue
=
(
value2
>
0
?
1
:
-
1
)
*
last
.
MappingValue
;
return
;
}
Navigation3DMapping
mapping
=
this
.
Mappings
.
FirstOrDefault
(
p
=>
temp
>=
p
.
MinValue
&&
temp
<
p
.
MaxValue
);
if
(
mapping
==
null
)
return
;
Navigation3DTcpManager
.
Value
=
value2
;
Navigation3DTcpManager
.
MappingValue
=
(
value2
>
0
?
1
:
-
1
)
*
mapping
.
MappingValue
;
}
}
}
VIZ.Framework.Module/ThreeDMouse/TCP/Navigation3DTcpListener.cs
0 → 100644
View file @
0c4ca99f
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net.Sockets
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Connection
;
using
log4net
;
using
System.Runtime.Remoting.Messaging
;
using
VIZ.Framework.Core
;
namespace
VIZ.Framework.Module
{
/// <summary>
/// 3D鼠标TCP监听器
/// </summary>
public
class
Navigation3DTcpListener
:
TcpConnectionListener
{
/// <summary>
/// 日志
/// </summary>
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
Navigation3DTcpListener
));
/// <summary>
/// 监听器键
/// </summary>
public
const
string
LISTENER_KEY
=
"Navigation3DTcpListener"
;
/// <summary>
/// 监听器客户端键
/// </summary>
public
const
string
LISTENER_CLIENT_KEY
=
"Navigation3DTcpListener_CLIENT"
;
/// <summary>
/// 3D鼠标TCP监听器
/// </summary>
/// <param name="ip">IP地址</param>
/// <param name="port">端口</param>
/// <param name="mappings">映射集合</param>
public
Navigation3DTcpListener
(
string
ip
,
int
port
,
List
<
Navigation3DMapping
>
mappings
)
:
base
(
ip
,
port
)
{
this
.
Key
=
LISTENER_KEY
;
this
.
Mappings
=
mappings
;
}
/// <summary>
/// 映射集合
/// </summary>
public
List
<
Navigation3DMapping
>
Mappings
{
get
;
private
set
;
}
/// <summary>
/// 创建终结点管理器
/// </summary>
/// <param name="tcpClient">TCP客户端</param>
/// <returns>TCP终结点管理器</returns>
protected
override
TcpEndpointManager
CreateEndpointManager
(
TcpClient
tcpClient
)
{
TcpEndpointManager
manager
=
new
TcpEndpointManager
(
LISTENER_CLIENT_KEY
,
tcpClient
);
manager
.
PackageProvider
=
new
Navigation3DCommandProvider
(
this
.
Mappings
);
return
manager
;
}
}
}
VIZ.Framework.Module/VIZ.Framework.Module.csproj
View file @
0c4ca99f
...
@@ -107,6 +107,8 @@
...
@@ -107,6 +107,8 @@
<Compile Include="Setup\Provider\Setup\AppSetup_LogInit.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_LogInit.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_Monitor.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_Monitor.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Single.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Single.cs" />
<Compile Include="ThreeDMouse\TCP\Navigation3DCommandProvider.cs" />
<Compile Include="ThreeDMouse\TCP\Navigation3DTcpListener.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
...
...
VIZ.Framework.Storage/Ini/Config/ApplicationConfig.cs
View file @
0c4ca99f
...
@@ -16,5 +16,23 @@ namespace VIZ.Framework.Storage
...
@@ -16,5 +16,23 @@ namespace VIZ.Framework.Storage
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Application"
,
DefaultValue
=
"False"
,
Type
=
typeof
(
bool
))]
[
Ini
(
Section
=
"Application"
,
DefaultValue
=
"False"
,
Type
=
typeof
(
bool
))]
public
string
APPLICATION_IS_DEBUG
{
get
;
set
;
}
public
string
APPLICATION_IS_DEBUG
{
get
;
set
;
}
/// <summary>
/// 3D鼠标平滑系数
/// </summary>
[
Ini
(
Section
=
"Application"
,
DefaultValue
=
"0.015"
,
Type
=
typeof
(
bool
))]
public
string
APPLICATION_3D_MOUSE_SMOOTH_COEFFICIENT
{
get
;
set
;
}
/// <summary>
/// 3D鼠标TCP IP
/// </summary>
[
Ini
(
Section
=
"Application"
,
DefaultValue
=
"127.0.0.1"
,
Type
=
typeof
(
string
))]
public
string
APPLICATION_3D_MOUSE_TCP_IP
{
get
;
set
;
}
/// <summary>
/// 3D鼠标TCP 端口
/// </summary>
[
Ini
(
Section
=
"Application"
,
DefaultValue
=
"8201"
,
Type
=
typeof
(
int
))]
public
string
APPLICATION_3D_MOUSE_TCP_PORT
{
get
;
set
;
}
}
}
}
}
VIZ.Framework.Storage/VIZ.Framework.Storage.csproj
View file @
0c4ca99f
...
@@ -89,5 +89,6 @@
...
@@ -89,5 +89,6 @@
<ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config" />
</ItemGroup>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
VIZ.Framework.UnitTest/JsonTest.cs
View file @
0c4ca99f
...
@@ -44,8 +44,18 @@ namespace VIZ.Framework.UnitTest
...
@@ -44,8 +44,18 @@ namespace VIZ.Framework.UnitTest
{
{
// 16612406883518854
// 16612406883518854
long
begin
=
new
DateTime
(
1970
,
1
,
1
,
8
,
0
,
0
).
Ticks
;
long
begin
=
new
DateTime
(
1970
,
1
,
1
,
8
,
0
,
0
).
Ticks
;
DateTime
time
=
new
DateTime
(
16612406883518854
+
begin
);
// 16613510251790000
// 16612406883518854
// 16615034160040000
// 16615032962820000
// 2022-08-26 16-43-36.0040000
// 2022-08-26 16:43:36,094
//
// 2022-08-26 16-41-36.2820000
// 2022-08-26 16:41:36,370
DateTime
time
=
new
DateTime
(
16615032962820000
+
begin
);
string
str
=
time
.
ToString
(
"yyyy-MM-dd HH-mm-ss.fffffff"
);
}
}
}
}
}
}
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