Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HYH.Registry
Project
Project
Details
Activity
Releases
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
张龙涛
HYH.Registry
Commits
22562f80
Commit
22562f80
authored
Aug 23, 2021
by
zhanglongtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3f0d87e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
1 deletion
+85
-1
ComputerInfoHelper.cs
...try.Application/Services/Encryption/ComputerInfoHelper.cs
+47
-1
EncryptionService.cs
...stry.Application/Services/Encryption/EncryptionService.cs
+20
-0
HYH.Registry.Application.xml
src/HYH.Registry.Web.Host/HYH.Registry.Application.xml
+18
-0
No files found.
src/HYH.Registry.Application/Services/Encryption/ComputerInfoHelper.cs
View file @
22562f80
...
@@ -61,6 +61,52 @@ namespace HYH.Registry.Services.Encryption
...
@@ -61,6 +61,52 @@ namespace HYH.Registry.Services.Encryption
var
DomainName
=
computerProperties
.
DomainName
;
var
DomainName
=
computerProperties
.
DomainName
;
return
"电脑名:"
+
HostName
+
",域名:"
+
DomainName
;
return
"电脑名:"
+
HostName
+
",域名:"
+
DomainName
;
}
}
public
static
string
PrintAllMacAddress
()
{
const
int
MIN_MAC_ADDR_LENGTH
=
12
;
string
macAddress
=
string
.
Empty
;
long
maxSpeed
=
-
1
;
foreach
(
NetworkInterface
nic
in
NetworkInterface
.
GetAllNetworkInterfaces
())
{
Console
.
WriteLine
(
"Name: "
+
nic
.
Name
+
" Found MAC Address: "
+
nic
.
GetPhysicalAddress
()
+
" Type: "
+
nic
.
NetworkInterfaceType
);
string
tempMac
=
nic
.
GetPhysicalAddress
().
ToString
();
if
(
nic
.
Speed
>
maxSpeed
&&
!
string
.
IsNullOrEmpty
(
tempMac
)
&&
tempMac
.
Length
>=
MIN_MAC_ADDR_LENGTH
)
{
Console
.
WriteLine
(
"New Max Speed = "
+
nic
.
Speed
+
", MAC: "
+
tempMac
);
maxSpeed
=
nic
.
Speed
;
macAddress
=
tempMac
;
}
}
return
macAddress
;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
static
string
GetFirstMacAddress
()
{
string
macAddresses
=
string
.
Empty
;
foreach
(
NetworkInterface
nic
in
NetworkInterface
.
GetAllNetworkInterfaces
())
{
if
(
nic
.
OperationalStatus
==
OperationalStatus
.
Up
)
{
macAddresses
+=
nic
.
GetPhysicalAddress
().
ToString
();
Console
.
WriteLine
(
macAddresses
);
break
;
}
}
return
macAddresses
;
}
/// <summary>
/// <summary>
/// 获取电脑 MAC(物理) 地址
/// 获取电脑 MAC(物理) 地址
/// </summary>
/// </summary>
...
@@ -105,7 +151,7 @@ namespace HYH.Registry.Services.Encryption
...
@@ -105,7 +151,7 @@ namespace HYH.Registry.Services.Encryption
}
}
}
}
//}
//}
MACIp
+=
"["
+
adapterName
+
":"
+
macip
+
"
;
] "
;
MACIp
+=
"["
+
adapterName
+
":"
+
macip
+
"] "
;
}
}
return
MACIp
;
return
MACIp
;
...
...
src/HYH.Registry.Application/Services/Encryption/EncryptionService.cs
View file @
22562f80
...
@@ -47,6 +47,26 @@ namespace HYH.Registry.Services.Encryption
...
@@ -47,6 +47,26 @@ namespace HYH.Registry.Services.Encryption
return
netCardMACAddress
;
return
netCardMACAddress
;
}
}
/// <summary>
/// <summary>
/// 获取所有Mac地址
/// </summary>
/// <returns></returns>
[
HttpGet
]
public
string
PrintAllMacAddress
()
{
string
netCardMACAddress
=
ComputerInfoHelper
.
PrintAllMacAddress
();
return
netCardMACAddress
;
}
/// <summary>
/// 获取第一个mac地址
/// </summary>
/// <returns></returns>
[
HttpGet
]
public
string
GetFirstMacAddress
()
{
string
netCardMACAddress
=
ComputerInfoHelper
.
GetFirstMacAddress
();
return
netCardMACAddress
;
}
/// <summary>
/// 获取Mac地址
/// 获取Mac地址
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
...
...
src/HYH.Registry.Web.Host/HYH.Registry.Application.xml
View file @
22562f80
...
@@ -43,6 +43,12 @@
...
@@ -43,6 +43,12 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:HYH.Registry.Services.Encryption.ComputerInfoHelper.GetFirstMacAddress"
>
<summary>
</summary>
<returns></returns>
</member>
<member
name=
"M:HYH.Registry.Services.Encryption.ComputerInfoHelper.GetMACIp"
>
<member
name=
"M:HYH.Registry.Services.Encryption.ComputerInfoHelper.GetMACIp"
>
<summary>
<summary>
获取电脑 MAC(物理) 地址
获取电脑 MAC(物理) 地址
...
@@ -65,6 +71,18 @@
...
@@ -65,6 +71,18 @@
</summary>
</summary>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:HYH.Registry.Services.Encryption.EncryptionService.PrintAllMacAddress"
>
<summary>
获取所有Mac地址
</summary>
<returns></returns>
</member>
<member
name=
"M:HYH.Registry.Services.Encryption.EncryptionService.GetFirstMacAddress"
>
<summary>
获取第一个mac地址
</summary>
<returns></returns>
</member>
<member
name=
"M:HYH.Registry.Services.Encryption.EncryptionService.GetMACIp"
>
<member
name=
"M:HYH.Registry.Services.Encryption.EncryptionService.GetMACIp"
>
<summary>
<summary>
获取Mac地址
获取Mac地址
...
...
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