FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
dotpython/src/DotPython.Worker/WorkerStableAbiModuleOptions.cs at main · kidoz/dotpython · GitHub
kidoz
/
dotpython
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
dotpython
/
src
/
DotPython.Worker
/
WorkerStableAbiModuleOptions.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (50 loc) · 1.88 KB
Breadcrumbs
dotpython
/
src
/
DotPython.Worker
/
WorkerStableAbiModuleOptions.cs
Copy path
File metadata and controls
60 lines (50 loc) · 1.88 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
namespace
DotPython
.
Worker
;
public
sealed
record
WorkerStableAbiModuleOptions
{
public
required
string
BridgePath
{
get
;
init
;
}
public
required
string
ModulePath
{
get
;
init
;
}
public
required
string
ManifestPath
{
get
;
init
;
}
public
required
string
BridgeSha256
{
get
;
init
;
}
public
required
string
ModuleSha256
{
get
;
init
;
}
public
required
string
ManifestSha256
{
get
;
init
;
}
internal
void
Validate
(
)
{
ValidateFile
(
BridgePath
,
nameof
(
BridgePath
)
)
;
ValidateFile
(
ModulePath
,
nameof
(
ModulePath
)
)
;
ValidateFile
(
ManifestPath
,
nameof
(
ManifestPath
)
)
;
ValidateHash
(
BridgeSha256
,
nameof
(
BridgeSha256
)
)
;
ValidateHash
(
ModuleSha256
,
nameof
(
ModuleSha256
)
)
;
ValidateHash
(
ManifestSha256
,
nameof
(
ManifestSha256
)
)
;
}
private
static
void
ValidateFile
(
string
path
,
string
parameterName
)
{
ArgumentException
.
ThrowIfNullOrWhiteSpace
(
path
,
parameterName
)
;
if
(
!
Path
.
IsPathFullyQualified
(
path
)
||
!
File
.
Exists
(
path
)
)
{
throw
new
ArgumentException
(
"An existing absolute native artifact path is required."
,
parameterName
)
;
}
if
(
(
File
.
GetAttributes
(
path
)
&
FileAttributes
.
ReparsePoint
)
!=
0
)
{
throw
new
ArgumentException
(
"Native artifact paths cannot be links or reparse points."
,
parameterName
)
;
}
}
private
static
void
ValidateHash
(
string
hash
,
string
parameterName
)
{
ArgumentException
.
ThrowIfNullOrWhiteSpace
(
hash
,
parameterName
)
;
if
(
hash
.
Length
!=
64
||
hash
.
Any
(
character
=>
character
is
not
(
>=
'0'
and
<=
'9'
)
and not
(
>=
'a'
and
<=
'f'
)
)
)
{
throw
new
ArgumentException
(
"A lowercase SHA-256 value is required."
,
parameterName
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL