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
76940085
Commit
76940085
authored
Sep 16, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mac 地址获取逻辑修改
parent
06f6305b
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
349 additions
and
75 deletions
+349
-75
VIZ.Framework.Common/VideoControl/Control/Plugin/CenterAxis/CenterAxisPlugin.cs
+3
-2
VIZ.Framework.Core/Core/Helper/CmdHelper.cs
+51
-0
VIZ.Framework.Core/Core/Helper/KeepSymbolHelper.cs
+83
-0
VIZ.Framework.Core/Core/Net/NetHelper.cs
+49
-54
VIZ.Framework.Core/Core/Net/NetHelperMacInfo.cs
+60
-0
VIZ.Framework.Core/VIZ.Framework.Core.csproj
+3
-0
VIZ.Framework.Domain/ApplicationDomain.cs
+15
-0
VIZ.Framework.MacTool/MainWindow.xaml
+21
-4
VIZ.Framework.MacTool/MainWindow.xaml.cs
+15
-5
VIZ.Framework.Module/Setup/Provider/Setup/AppSetup_ApplicationSafe.cs
+24
-1
VIZ.Framework.UnitTest/Mouse3DTest.cs
+21
-1
VIZ.Framework.UnitTest/NetTest.cs
+1
-5
VIZ.Framework.UnitTest/VIZ.Framework.UnitTest.csproj
+3
-3
No files found.
VIZ.Framework.Common/VideoControl/Control/Plugin/CenterAxis/CenterAxisPlugin.cs
View file @
76940085
...
@@ -65,12 +65,12 @@ namespace VIZ.Framework.Common
...
@@ -65,12 +65,12 @@ namespace VIZ.Framework.Common
// X轴
// X轴
RawVector2
x1
=
new
RawVector2
((
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Left
,
drawCenter
.
Y
);
RawVector2
x1
=
new
RawVector2
((
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Left
,
drawCenter
.
Y
);
RawVector2
x2
=
new
RawVector2
((
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Right
,
drawCenter
.
Y
);
RawVector2
x2
=
new
RawVector2
((
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Right
,
drawCenter
.
Y
);
context
.
Target
.
DrawLine
(
x1
,
x2
,
brush
);
context
.
Target
.
DrawLine
(
x1
,
x2
,
brush
,
(
float
)
info
.
AxisWidth
);
// Y轴
// Y轴
RawVector2
y1
=
new
RawVector2
(
drawCenter
.
X
,
(
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Top
);
RawVector2
y1
=
new
RawVector2
(
drawCenter
.
X
,
(
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Top
);
RawVector2
y2
=
new
RawVector2
(
drawCenter
.
X
,
(
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Bottom
);
RawVector2
y2
=
new
RawVector2
(
drawCenter
.
X
,
(
float
)
context
.
VideoRenderInfo
.
DrawingRect
.
Bottom
);
context
.
Target
.
DrawLine
(
y1
,
y2
,
brush
);
context
.
Target
.
DrawLine
(
y1
,
y2
,
brush
,
(
float
)
info
.
AxisWidth
);
}
}
}
}
}
}
\ No newline at end of file
VIZ.Framework.Core/Core/Helper/CmdHelper.cs
0 → 100644
View file @
76940085
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// CMD 辅助类
/// </summary>
public
static
class
CmdHelper
{
/// <summary>
/// CMD路径
/// </summary>
private
const
string
CMD_PATH
=
@"C:\Windows\System32\cmd.exe"
;
/// <summary>
/// 执行
/// </summary>
/// <param name="command">命令</param>
/// <param name="waitMilliseconds">等待命令返回时间</param>
/// <returns>命令返回数据</returns>
public
static
string
Run
(
string
command
,
int
waitMilliseconds
=
5000
)
{
using
(
Process
process
=
new
Process
())
{
process
.
StartInfo
.
FileName
=
CMD_PATH
;
process
.
StartInfo
.
UseShellExecute
=
false
;
//是否使用操作系统shell启动
process
.
StartInfo
.
RedirectStandardInput
=
true
;
//接受来自调用程序的输入信息
process
.
StartInfo
.
RedirectStandardOutput
=
true
;
//由调用程序获取输出信息
process
.
StartInfo
.
RedirectStandardError
=
true
;
//重定向标准错误输出
process
.
StartInfo
.
CreateNoWindow
=
true
;
//不显示程序窗口
process
.
Start
();
//启动程序
//向cmd窗口写入命令
process
.
StandardInput
.
WriteLine
(
command
);
process
.
StandardInput
.
AutoFlush
=
true
;
//获取cmd窗口的输出信息
string
output
=
process
.
StandardOutput
.
ReadToEnd
();
process
.
WaitForExit
(
waitMilliseconds
);
//等待程序执行完退出进程
process
.
Close
();
return
output
;
}
}
}
}
VIZ.Framework.Core/Core/Helper/KeepSymbolHelper.cs
0 → 100644
View file @
76940085
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Runtime.CompilerServices
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// 保持符号辅助类
/// </summary>
public
class
KeepSymbolHelper
{
/// <summary>
/// 参照队列长度
/// </summary>
/// <param name="queueLength">参照值队列长度</param>
/// <param name="confidenceLength">置信数据长度</param>
public
KeepSymbolHelper
(
int
queueLength
,
int
confidenceLength
)
{
if
(
queueLength
<=
0
)
throw
new
ArgumentException
(
nameof
(
queueLength
));
if
(
confidenceLength
<=
0
||
confidenceLength
>
queueLength
)
throw
new
ArgumentException
(
nameof
(
confidenceLength
));
this
.
QueueLength
=
queueLength
;
this
.
ConfidenceLength
=
confidenceLength
;
}
/// <summary>
/// 参照值队列长度
/// </summary>
private
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
double
>
queue
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
double
>();
/// <summary>
/// 参照队列长度
/// </summary>
public
int
QueueLength
{
get
;
private
set
;
}
/// <summary>
/// 置信数据长度
/// </summary>
public
int
ConfidenceLength
{
get
;
private
set
;
}
/// <summary>
/// 之前的符号值
/// </summary>
private
int
prevSymbol
;
/// <summary>
/// 获取符号
/// </summary>
/// <param name="value">值</param>
/// <returns>符号 (1 or -1)</returns>
public
int
GetSymbol
(
double
value
)
{
int
symbol
=
value
>
0
?
1
:
-
1
;
this
.
queue
.
Enqueue
(
value
);
if
(
this
.
queue
.
Count
<
this
.
ConfidenceLength
)
{
this
.
prevSymbol
=
symbol
;
return
symbol
;
}
if
(
this
.
queue
.
Count
>
this
.
QueueLength
)
{
this
.
queue
.
TryDequeue
(
out
_
);
}
int
count
=
this
.
queue
.
Count
(
p
=>
(
p
>
0
?
1
:
-
1
)
==
symbol
);
if
(
count
>
this
.
ConfidenceLength
)
{
this
.
prevSymbol
=
symbol
;
return
symbol
;
}
return
this
.
prevSymbol
;
}
}
}
VIZ.Framework.Core/Core/Net/NetHelper.cs
View file @
76940085
...
@@ -6,6 +6,7 @@ using System.Linq;
...
@@ -6,6 +6,7 @@ using System.Linq;
using
System.Management
;
using
System.Management
;
using
System.Net
;
using
System.Net
;
using
System.Net.NetworkInformation
;
using
System.Net.NetworkInformation
;
using
System.Runtime.CompilerServices
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -17,83 +18,77 @@ namespace VIZ.Framework.Core
...
@@ -17,83 +18,77 @@ namespace VIZ.Framework.Core
public
static
class
NetHelper
public
static
class
NetHelper
{
{
/// <summary>
/// <summary>
/// 获取
当前使用的网卡或排序最后的有效网卡
地址
/// 获取
所有的Mac
地址
/// </summary>
/// </summary>
/// <returns>获取当前使用的或最后一个网卡地址</returns>
/// <returns>Mac地址</returns>
public
static
string
GetUsedOrLastMacAddress
()
public
static
List
<
NetHelperMacInfo
>
GetAllMacAddress
()
{
try
{
{
List
<
string
>
list
=
new
List
<
string
>();
List
<
NetHelperMacInfo
>
list
=
new
List
<
NetHelperMacInfo
>();
ManagementClass
mc
=
new
ManagementClass
(
"Win32_NetworkAdapterConfiguration"
);
string
output
=
CmdHelper
.
Run
(
"chcp 437 & ipconfig /all & exit"
);
ManagementObjectCollection
moc
=
mc
.
GetInstances
();
foreach
(
ManagementObject
mo
in
moc
)
NetHelperMacInfo
info
=
null
;
{
bool
mac_ipEnabled
=
(
bool
)
mo
[
"IPEnabled"
];
string
mac_address
=
mo
[
"MacAddress"
]?.
ToString
()?.
ToUpper
();
string
mac_description
=
mo
[
"Description"
]?.
ToString
()?.
ToLower
();
if
(
string
.
IsNullOrWhiteSpace
(
mac_address
)
||
string
.
IsNullOrWhiteSpace
(
mac_description
))
foreach
(
var
line
in
output
.
Split
(
Environment
.
NewLine
.
ToCharArray
(),
StringSplitOptions
.
RemoveEmptyEntries
))
{
if
(
string
.
IsNullOrWhiteSpace
(
line
))
continue
;
continue
;
if
(
mac_description
.
Contains
(
"debug"
)
||
mac_description
.
Contains
(
"virtual"
)
||
mac_description
.
Contains
(
"miniport"
))
if
(!
line
.
StartsWith
(
" "
))
{
info
=
new
NetHelperMacInfo
();
info
.
Name
=
line
.
Trim
();
if
(
info
.
Name
.
EndsWith
(
":"
))
{
info
.
Name
=
info
.
Name
.
Remove
(
info
.
Name
.
Length
-
1
,
1
);
}
list
.
Add
(
info
);
continue
;
continue
;
}
if
(
mac_ipEnabled
)
string
cmd
=
line
.
Trim
();
return
mac_address
;
list
.
Add
(
mac_address
);
if
(
cmd
.
StartsWith
(
"Description"
))
{
info
.
Description
=
cmd
.
Substring
(
cmd
.
IndexOf
(
':'
)
+
1
).
Trim
();
continue
;
}
}
moc
.
Dispose
();
mc
.
Dispose
();
moc
=
null
;
mc
=
null
;
return
list
.
LastOrDefault
()
??
string
.
Empty
;
if
(
cmd
.
StartsWith
(
"Physical Address"
))
{
info
.
PhysicalAddress
=
cmd
.
Substring
(
cmd
.
IndexOf
(
':'
)
+
1
).
Trim
();
continue
;
}
}
catch
if
(
cmd
.
StartsWith
(
"DHCPv6 Client DUID"
))
{
{
return
string
.
Empty
;
info
.
DHCPv6ClientDUID
=
cmd
.
Substring
(
cmd
.
IndexOf
(
':'
)
+
1
).
Trim
();
continue
;
}
}
}
list
=
list
.
Where
(
p
=>
p
.
IsAvailable
()).
ToList
();
return
list
;
}
}
/// <summary>
/// <summary>
/// 获取所有
有效的Mac地址
/// 获取所有
的Mac地址, 采用默认的过滤器
/// </summary>
/// </summary>
/// <remarks>
/// 网络描述中包含:debug、virtual、miniport 关键字的将会被过滤
/// </remarks>
/// <returns>Mac地址</returns>
/// <returns>Mac地址</returns>
public
static
List
<
string
>
GetAllMacAddress
()
public
static
List
<
NetHelperMacInfo
>
GetAllMacAddressWithDefaultFilter
()
{
List
<
string
>
result
=
new
List
<
string
>();
try
{
ManagementClass
mc
=
new
ManagementClass
(
"Win32_NetworkAdapterConfiguration"
);
ManagementObjectCollection
moc
=
mc
.
GetInstances
();
foreach
(
ManagementObject
mo
in
moc
)
{
{
string
mac_address
=
mo
[
"MacAddress"
]?.
ToString
()?.
ToUpper
();
List
<
string
>
filter
=
new
List
<
string
>
{
"debug"
,
"virtual"
,
"miniport"
};
string
mac_description
=
mo
[
"Description"
]?.
ToString
()?.
ToLower
();
if
(
string
.
IsNullOrWhiteSpace
(
mac_address
)
||
string
.
IsNullOrWhiteSpace
(
mac_description
))
List
<
NetHelperMacInfo
>
list
=
GetAllMacAddress
();
continue
;
if
(
mac_description
.
Contains
(
"debug"
)
||
mac_description
.
Contains
(
"virtual"
)
||
mac_description
.
Contains
(
"miniport"
))
continue
;
result
.
Add
(
mac_address
);
list
=
list
.
Where
(
p
=>
!
filter
.
Contains
(
p
.
Description
.
ToLower
())).
ToList
();
}
moc
.
Dispose
();
mc
.
Dispose
();
moc
=
null
;
mc
=
null
;
return
result
;
return
list
;
}
catch
{
return
result
;
}
}
}
/// <summary>
/// <summary>
...
...
VIZ.Framework.Core/Core/Net/NetHelperMacInfo.cs
0 → 100644
View file @
76940085
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// 网络辅助类 Mac信息
/// </summary>
public
class
NetHelperMacInfo
{
/// <summary>
/// 名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 物理地址
/// </summary>
public
string
PhysicalAddress
{
get
;
set
;
}
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// DHCPv6 客户端 DUID
/// </summary>
public
string
DHCPv6ClientDUID
{
get
;
set
;
}
/// <summary>
/// 是否可用
/// </summary>
/// <returns>是否可用</returns>
public
bool
IsAvailable
()
{
return
!
string
.
IsNullOrWhiteSpace
(
this
.
PhysicalAddress
)
||
!
string
.
IsNullOrWhiteSpace
(
this
.
DHCPv6ClientDUID
);
}
/// <summary>
/// 转化为字符串
/// </summary>
/// <returns>字符串</returns>
public
override
string
ToString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
AppendLine
(
$"Name . . . . . . . . . . :
{
this
.
Name
}
"
);
sb
.
AppendLine
(
$"Description. . . . . . . :
{
this
.
Description
}
"
);
sb
.
AppendLine
(
$"Physical Address . . . . :
{
this
.
PhysicalAddress
}
"
);
sb
.
AppendLine
(
$"DHCPv6 Client DUID . . . :
{
this
.
DHCPv6ClientDUID
}
"
);
return
sb
.
ToString
();
}
}
}
VIZ.Framework.Core/VIZ.Framework.Core.csproj
View file @
76940085
...
@@ -93,8 +93,11 @@
...
@@ -93,8 +93,11 @@
<Compile Include="Core\Converter\StringAppendConverter.cs" />
<Compile Include="Core\Converter\StringAppendConverter.cs" />
<Compile Include="Core\Enum\EnumHelper.cs" />
<Compile Include="Core\Enum\EnumHelper.cs" />
<Compile Include="Core\Helper\ByteHelper.cs" />
<Compile Include="Core\Helper\ByteHelper.cs" />
<Compile Include="Core\Helper\CmdHelper.cs" />
<Compile Include="Core\Helper\KeepSymbolHelper.cs" />
<Compile Include="Core\Helper\ProcessHelper.cs" />
<Compile Include="Core\Helper\ProcessHelper.cs" />
<Compile Include="Core\Helper\FPSHelper.cs" />
<Compile Include="Core\Helper\FPSHelper.cs" />
<Compile Include="Core\Net\NetHelperMacInfo.cs" />
<Compile Include="Core\Safe\ApplicationMacCheckAttribute.cs" />
<Compile Include="Core\Safe\ApplicationMacCheckAttribute.cs" />
<Compile Include="Core\Safe\ApplicationTimeCheckAttribute.cs" />
<Compile Include="Core\Safe\ApplicationTimeCheckAttribute.cs" />
<Compile Include="Expand\GPI\GPIManager.cs" />
<Compile Include="Expand\GPI\GPIManager.cs" />
...
...
VIZ.Framework.Domain/ApplicationDomain.cs
View file @
76940085
...
@@ -50,9 +50,24 @@ namespace VIZ.Framework.Domain
...
@@ -50,9 +50,24 @@ namespace VIZ.Framework.Domain
/// </summary>
/// </summary>
public
static
bool
IS_DEBUG
{
get
;
private
set
;
}
public
static
bool
IS_DEBUG
{
get
;
private
set
;
}
/// <summary>
/// 本机逻辑MAC
/// </summary>
public
static
string
LOCAL_LOGIC_MAC
{
get
;
private
set
;
}
static
ApplicationDomain
()
static
ApplicationDomain
()
{
{
// 是否是调试模式
IS_DEBUG
=
IniStorage
.
GetValue
<
ApplicationConfig
,
bool
>(
p
=>
p
.
APPLICATION_IS_DEBUG
);
IS_DEBUG
=
IniStorage
.
GetValue
<
ApplicationConfig
,
bool
>(
p
=>
p
.
APPLICATION_IS_DEBUG
);
// 本机使用的逻辑MAC地址
NetHelperMacInfo
macInfo
=
NetHelper
.
GetAllMacAddressWithDefaultFilter
().
FirstOrDefault
(
p
=>
p
.
IsAvailable
());
string
mac
=
macInfo
.
DHCPv6ClientDUID
;
if
(!
string
.
IsNullOrWhiteSpace
(
macInfo
.
PhysicalAddress
))
{
mac
=
macInfo
.
PhysicalAddress
;
}
LOCAL_LOGIC_MAC
=
mac
;
}
}
}
}
}
}
VIZ.Framework.MacTool/MainWindow.xaml
View file @
76940085
...
@@ -4,10 +4,27 @@
...
@@ -4,10 +4,27 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VIZ.Framework.MacTool"
xmlns:local="clr-namespace:VIZ.Framework.MacTool"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="MainWindow" Height="450" Width="800">
Title="Mac地址工具"
mc:Ignorable="d" Height="800" Width="1300">
<Grid>
<Grid>
<TextBox x:Name="tb" Width="400" Height="300" IsReadOnly="True" FontSize="24" VerticalContentAlignment="Top" Loaded="tb_Loaded"
<Grid.ColumnDefinitions>
TextWrapping="Wrap"></TextBox>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<GroupBox Margin="20" Padding="5">
<GroupBox.Header>
<TextBlock Text="过滤 mac" FontSize="16" Margin="5"></TextBlock>
</GroupBox.Header>
<TextBox x:Name="tb_filter" IsReadOnly="True" FontSize="14" Padding="5" VerticalScrollBarVisibility="Visible"
VerticalContentAlignment="Top" TextWrapping="Wrap"></TextBox>
</GroupBox>
<GroupBox Margin="20" Padding="5" Grid.Column="1">
<GroupBox.Header>
<TextBlock Text="所有 mac" FontSize="16" Margin="5"></TextBlock>
</GroupBox.Header>
<TextBox x:Name="tb_all" IsReadOnly="True" FontSize="14" Padding="5" VerticalScrollBarVisibility="Visible"
VerticalContentAlignment="Top" TextWrapping="Wrap"></TextBox>
</GroupBox>
</Grid>
</Grid>
</Window>
</Window>
VIZ.Framework.MacTool/MainWindow.xaml.cs
View file @
76940085
...
@@ -24,17 +24,27 @@ namespace VIZ.Framework.MacTool
...
@@ -24,17 +24,27 @@ namespace VIZ.Framework.MacTool
public
MainWindow
()
public
MainWindow
()
{
{
InitializeComponent
();
InitializeComponent
();
this
.
Loaded
+=
MainWindow_Loaded
;
}
}
private
void
tb_Loaded
(
object
sender
,
RoutedEventArgs
e
)
private
void
MainWindow_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
StringBuilder
sb_all
=
new
StringBuilder
();
StringBuilder
sb_filter
=
new
StringBuilder
();
foreach
(
NetHelperMacInfo
info
in
NetHelper
.
GetAllMacAddress
())
{
{
StringBuilder
sb
=
new
StringBuilder
();
sb_all
.
AppendLine
(
info
.
ToString
());
foreach
(
string
mac
in
NetHelper
.
GetAllMacAddress
())
}
foreach
(
NetHelperMacInfo
info
in
NetHelper
.
GetAllMacAddressWithDefaultFilter
())
{
{
sb
.
AppendLine
(
mac
);
sb
_filter
.
AppendLine
(
info
.
ToString
()
);
}
}
this
.
tb
.
Text
=
sb
.
ToString
();
this
.
tb_filter
.
Text
=
sb_filter
.
ToString
();
this
.
tb_all
.
Text
=
sb_all
.
ToString
();
}
}
}
}
}
}
VIZ.Framework.Module/Setup/Provider/Setup/AppSetup_ApplicationSafe.cs
View file @
76940085
...
@@ -47,7 +47,7 @@ namespace VIZ.Framework.Module
...
@@ -47,7 +47,7 @@ namespace VIZ.Framework.Module
}
}
// Step 2. 应用程序MAC地址校验
// Step 2. 应用程序MAC地址校验
List
<
string
>
mac_address_list
=
NetHelper
.
GetAllMacAddress
();
List
<
string
>
mac_address_list
=
this
.
getAllMacAddressForCheck
();
IEnumerable
<
ApplicationMacCheckAttribute
>
mac_check_list
=
assembly
.
GetCustomAttributes
<
ApplicationMacCheckAttribute
>();
IEnumerable
<
ApplicationMacCheckAttribute
>
mac_check_list
=
assembly
.
GetCustomAttributes
<
ApplicationMacCheckAttribute
>();
if
(
mac_check_list
!=
null
&&
mac_check_list
.
Count
()
>
0
&&
!
mac_check_list
.
Any
(
p
=>
mac_address_list
.
Contains
(
p
.
MacAddress
)))
if
(
mac_check_list
!=
null
&&
mac_check_list
.
Count
()
>
0
&&
!
mac_check_list
.
Any
(
p
=>
mac_address_list
.
Contains
(
p
.
MacAddress
)))
{
{
...
@@ -66,5 +66,28 @@ namespace VIZ.Framework.Module
...
@@ -66,5 +66,28 @@ namespace VIZ.Framework.Module
{
{
}
}
/// <summary>
/// 获取所有用于MAC地址校验的值
/// </summary>
/// <returns>用于MAC地址校验的值</returns>
private
List
<
string
>
getAllMacAddressForCheck
()
{
List
<
string
>
list
=
new
List
<
string
>();
foreach
(
NetHelperMacInfo
info
in
NetHelper
.
GetAllMacAddressWithDefaultFilter
())
{
if
(!
string
.
IsNullOrWhiteSpace
(
info
.
PhysicalAddress
))
{
list
.
Add
(
info
.
PhysicalAddress
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
info
.
DHCPv6ClientDUID
))
{
list
.
Add
(
info
.
DHCPv6ClientDUID
);
}
}
return
list
;
}
}
}
}
}
VIZ.Framework.UnitTest/Mouse3DTest.cs
View file @
76940085
...
@@ -12,12 +12,32 @@ namespace VIZ.Framework.UnitTest
...
@@ -12,12 +12,32 @@ namespace VIZ.Framework.UnitTest
public
class
Mouse3DTest
public
class
Mouse3DTest
{
{
/// <summary>
/// <summary>
///
系统监视
测试
///
平滑
测试
/// </summary>
/// </summary>
[
TestMethod
]
[
TestMethod
]
public
void
SmoothTest
()
public
void
SmoothTest
()
{
{
KeepSymbolHelper
helper
=
new
KeepSymbolHelper
(
5
,
3
);
int
symbol
=
0
;
symbol
=
helper
.
GetSymbol
(
1
);
symbol
=
helper
.
GetSymbol
(
2
);
symbol
=
helper
.
GetSymbol
(-
3
);
symbol
=
helper
.
GetSymbol
(
4
);
symbol
=
helper
.
GetSymbol
(
5
);
symbol
=
helper
.
GetSymbol
(
6
);
symbol
=
helper
.
GetSymbol
(-
7
);
symbol
=
helper
.
GetSymbol
(
8
);
symbol
=
helper
.
GetSymbol
(
9
);
symbol
=
helper
.
GetSymbol
(-
10
);
symbol
=
helper
.
GetSymbol
(-
11
);
symbol
=
helper
.
GetSymbol
(-
12
);
symbol
=
helper
.
GetSymbol
(-
13
);
symbol
=
helper
.
GetSymbol
(
14
);
symbol
=
helper
.
GetSymbol
(-
15
);
symbol
=
helper
.
GetSymbol
(-
16
);
symbol
=
helper
.
GetSymbol
(-
17
);
Assert
.
IsTrue
(
symbol
>
0
);
}
}
}
}
}
}
VIZ.Framework.UnitTest/NetTest.cs
View file @
76940085
...
@@ -7,7 +7,6 @@ using System.Net.Sockets;
...
@@ -7,7 +7,6 @@ using System.Net.Sockets;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.H2V.Connection
;
namespace
VIZ.Framework.UnitTest
namespace
VIZ.Framework.UnitTest
{
{
...
@@ -23,9 +22,7 @@ namespace VIZ.Framework.UnitTest
...
@@ -23,9 +22,7 @@ namespace VIZ.Framework.UnitTest
[
TestMethod
]
[
TestMethod
]
public
void
GetMacTest
()
public
void
GetMacTest
()
{
{
string
str
=
NetHelper
.
GetUsedOrLastMacAddress
();
Assert
.
IsTrue
(!
string
.
IsNullOrWhiteSpace
(
str
));
}
}
/// <summary>
/// <summary>
...
@@ -53,13 +50,12 @@ namespace VIZ.Framework.UnitTest
...
@@ -53,13 +50,12 @@ namespace VIZ.Framework.UnitTest
public
void
JosnTest
()
public
void
JosnTest
()
{
{
string
str
=
"{'signal': 'detect', 'bboxes': [[914.5606, 144.6889, 1877.504, 380.21176]], 'id': 'E0:4F:43:E6:48:C2__CAM_1'}"
;
string
str
=
"{'signal': 'detect', 'bboxes': [[914.5606, 144.6889, 1877.504, 380.21176]], 'id': 'E0:4F:43:E6:48:C2__CAM_1'}"
;
AlgorithmPackageBase
@base
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
AlgorithmPackageBase
>(
str
);
}
}
[
TestMethod
]
[
TestMethod
]
public
void
TimeTest
()
public
void
TimeTest
()
{
{
long
l
=
TimeSpan
.
FromSeconds
(
1
).
Ticks
;
var
list
=
NetHelper
.
GetAllMacAddress
()
;
}
}
}
}
}
}
VIZ.Framework.UnitTest/VIZ.Framework.UnitTest.csproj
View file @
76940085
...
@@ -81,9 +81,9 @@
...
@@ -81,9 +81,9 @@
<None Include="packages.config" />
<None Include="packages.config" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.
H2V\VIZ.H2V.Connection\VIZ.H2V
.Connection.csproj">
<ProjectReference Include="..\..\VIZ.
GimbalAI\VIZ.GimbalAI.Connection\VIZ.GimbalAI
.Connection.csproj">
<Project>{
94C95C0F-070F-4827-83FC-8DDA63BAB177
}</Project>
<Project>{
52ca7346-0bc0-4e03-8ca5-c00a8777f1ef
}</Project>
<Name>VIZ.
H2V
.Connection</Name>
<Name>VIZ.
GimbalAI
.Connection</Name>
</ProjectReference>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
<ProjectReference Include="..\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
<Project>{76ef480a-e486-41b7-b7a5-2a849fc8d5bf}</Project>
<Project>{76ef480a-e486-41b7-b7a5-2a849fc8d5bf}</Project>
...
...
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