Initialer Import der Synology Scripts
This commit is contained in:
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+49253
File diff suppressed because it is too large
Load Diff
Executable
+13
@@ -0,0 +1,13 @@
|
||||
20240426 19:36:45: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Location": "Cannot convert value "2; 25" to type "System.Drawing.Point". Error: "2; 25 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:37:45: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Location": "Cannot convert value "2; 25" to type "System.Drawing.Point". Error: "2; 25 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:51:34: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:51:56: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:53:42: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:54:06: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:55:20: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240426 19:55:36: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "2714; 988" to type "System.Drawing.Size". Error: "2714; 988 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240427 21:35:03: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "1105; 581" to type "System.Drawing.Size". Error: "1105; 581 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240427 21:36:12: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "1105; 581" to type "System.Drawing.Size". Error: "1105; 581 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240427 21:37:54: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "1105; 581" to type "System.Drawing.Size". Error: "1105; 581 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240427 21:41:28: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "1105; 581" to type "System.Drawing.Size". Error: "1105; 581 is not a valid value for Int32. (Parameter 'value')""
|
||||
20240427 21:41:43: Exception: Line | 141 | try {$newControl.$($_.ToString()) = $value} | ~~~~~~~~~~~~~ | Exception setting "Size": "Cannot convert value "1105; 581" to type "System.Drawing.Size". Error: "1105; 581 is not a valid value for Int32. (Parameter 'value')""
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#region Environment Setup
|
||||
|
||||
try {
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered during Environment Setup."}
|
||||
|
||||
#endregion Environment Setup
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
#region Functions
|
||||
|
||||
function Update-ErrorLog {
|
||||
param(
|
||||
[System.Management.Automation.ErrorRecord]$ErrorRecord,
|
||||
[string]$Message,
|
||||
[switch]$Promote
|
||||
)
|
||||
|
||||
if ( $Message -ne '' ) {[void][System.Windows.Forms.MessageBox]::Show("$($Message)`r`n`r`nCheck '$($BaseDir)\exceptions.txt' for details.",'Exception Occurred')}
|
||||
|
||||
$date = Get-Date -Format 'yyyyMMdd HH:mm:ss'
|
||||
$ErrorRecord | Out-File "$($BaseDir)\tmpError.txt"
|
||||
|
||||
Add-Content -Path "$($BaseDir)\exceptions.txt" -Value "$($date): $($(Get-Content "$($BaseDir)\tmpError.txt") -replace "\s+"," ")"
|
||||
|
||||
Remove-Item -Path "$($BaseDir)\tmpError.txt"
|
||||
|
||||
if ( $Promote ) {throw $ErrorRecord}
|
||||
}
|
||||
|
||||
function ConvertFrom-WinFormsXML {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]$Xml,
|
||||
[string]$Reference,
|
||||
$ParentControl,
|
||||
[switch]$Suppress
|
||||
)
|
||||
|
||||
try {
|
||||
if ( $Xml.GetType().Name -eq 'String' ) {$Xml = ([xml]$Xml).ChildNodes}
|
||||
|
||||
if ( $Xml.ToString() -ne 'SplitterPanel' ) {$newControl = New-Object System.Windows.Forms.$($Xml.ToString())}
|
||||
|
||||
if ( $ParentControl ) {
|
||||
if ( $Xml.ToString() -match "^ToolStrip" ) {
|
||||
if ( $ParentControl.GetType().Name -match "^ToolStrip" ) {[void]$ParentControl.DropDownItems.Add($newControl)} else {[void]$ParentControl.Items.Add($newControl)}
|
||||
} elseif ( $Xml.ToString() -eq 'ContextMenuStrip' ) {$ParentControl.ContextMenuStrip = $newControl}
|
||||
elseif ( $Xml.ToString() -eq 'SplitterPanel' ) {$newControl = $ParentControl.$($Xml.Name.Split('_')[-1])}
|
||||
else {$ParentControl.Controls.Add($newControl)}
|
||||
}
|
||||
|
||||
$Xml.Attributes | ForEach-Object {
|
||||
$attrib = $_
|
||||
$attribName = $_.ToString()
|
||||
|
||||
if ( $Script:specialProps.Array -contains $attribName ) {
|
||||
if ( $attribName -eq 'Items' ) {
|
||||
$($_.Value -replace "\|\*BreakPT\*\|","`n").Split("`n") | ForEach-Object{[void]$newControl.Items.Add($_)}
|
||||
} else {
|
||||
# Other than Items only BoldedDate properties on MonthCalendar control
|
||||
$methodName = "Add$($attribName)" -replace "s$"
|
||||
|
||||
$($_.Value -replace "\|\*BreakPT\*\|","`n").Split("`n") | ForEach-Object{$newControl.$attribName.$methodName($_)}
|
||||
}
|
||||
} else {
|
||||
switch ($attribName) {
|
||||
FlatAppearance {
|
||||
$attrib.Value.Split('|') | ForEach-Object {$newControl.FlatAppearance.$($_.Split('=')[0]) = $_.Split('=')[1]}
|
||||
}
|
||||
default {
|
||||
if ( $null -ne $newControl.$attribName ) {
|
||||
if ( $newControl.$attribName.GetType().Name -eq 'Boolean' ) {
|
||||
if ( $attrib.Value -eq 'True' ) {$value = $true} else {$value = $false}
|
||||
} else {$value = $attrib.Value}
|
||||
} else {$value = $attrib.Value}
|
||||
$newControl.$attribName = $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (( $attrib.ToString() -eq 'Name' ) -and ( $Reference -ne '' )) {
|
||||
try {$refHashTable = Get-Variable -Name $Reference -Scope Script -ErrorAction Stop}
|
||||
catch {
|
||||
New-Variable -Name $Reference -Scope Script -Value @{} | Out-Null
|
||||
$refHashTable = Get-Variable -Name $Reference -Scope Script -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$refHashTable.Value.Add($attrib.Value,$newControl)
|
||||
}
|
||||
}
|
||||
|
||||
if ( $Xml.ChildNodes ) {$Xml.ChildNodes | ForEach-Object {ConvertFrom-WinformsXML -Xml $_ -ParentControl $newControl -Reference $Reference -Suppress}}
|
||||
|
||||
if ( $Suppress -eq $false ) {return $newControl}
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered adding $($Xml.ToString()) to $($ParentControl.Name)"}
|
||||
}
|
||||
|
||||
function Get-CustomControl {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][hashtable]$ControlInfo,
|
||||
[string]$Reference,
|
||||
[switch]$Suppress
|
||||
)
|
||||
|
||||
try {
|
||||
$refGuid = [guid]::NewGuid()
|
||||
$control = ConvertFrom-WinFormsXML -Xml "$($ControlInfo.XMLText)" -Reference $refGuid
|
||||
$refControl = Get-Variable -Name $refGuid -ValueOnly
|
||||
|
||||
if ( $ControlInfo.Events ) {$ControlInfo.Events.ForEach({$refControl[$_.Name]."add_$($_.EventType)"($_.ScriptBlock)})}
|
||||
|
||||
if ( $Reference -ne '' ) {New-Variable -Name $Reference -Scope Script -Value $refControl}
|
||||
|
||||
Remove-Variable -Name refGuid -Scope Script
|
||||
|
||||
if ( $Suppress -eq $false ) {return $control}
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered getting special control."}
|
||||
}
|
||||
|
||||
#endregion Functions
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
<#
|
||||
.NOTES
|
||||
===========================================================================
|
||||
FileName: tst.ps1
|
||||
Author: micha
|
||||
Created On: 2024.04.26
|
||||
Last Updated: 2024.04.26
|
||||
Organization:
|
||||
Version: v0.1
|
||||
===========================================================================
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
.DEPENDENCIES
|
||||
#>
|
||||
|
||||
# ScriptBlock to Execute in STA Runspace
|
||||
$sbGUI = {
|
||||
param($BaseDir)
|
||||
|
||||
#region Child Forms
|
||||
|
||||
$Script:childFormInfo = @{
|
||||
'MainForm' = @{
|
||||
XMLText = @"
|
||||
<Form Name="MainForm" Size="2714; 988">
|
||||
<Label Name="lbl_Programs" Font="Segoe UI; 18pt" Location="0; 10" Size="200; 50" TextAlign="MiddleCenter" Text="Install Options" />
|
||||
<Label Name="lbl_config" Font="Segoe UI; 18pt" Location="500; 10" Size="260; 50" TextAlign="MiddleCenter" Text="Configuration Options" />
|
||||
<Label Name="lbl_symantec" Font="Segoe UI; 18pt" Location="0; 100" Size="150; 30" TextAlign="MiddleCenter" Text="Symantec" />
|
||||
<Label Name="lbl_Packages" Location="0; 140" TextAlign="MiddleCenter" Text="Packages" />
|
||||
</Form>
|
||||
"@
|
||||
}
|
||||
|
||||
#endregion Child Forms
|
||||
|
||||
#region Dot Sourcing of files
|
||||
|
||||
$dotSourceDir = $BaseDir
|
||||
|
||||
. "$($dotSourceDir)\Functions.ps1"
|
||||
. "$($dotSourceDir)\EnvSetup.ps1"
|
||||
|
||||
#endregion Dot Sourcing of files
|
||||
|
||||
#region Form Initialization
|
||||
|
||||
try {
|
||||
ConvertFrom-WinFormsXML -Reference refs -Suppress -Xml @"
|
||||
<Form Name="MainForm" />
|
||||
"@
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered during Form Initialization."}
|
||||
|
||||
#endregion Form Initialization
|
||||
|
||||
#region Other Actions Before ShowDialog
|
||||
|
||||
try {
|
||||
Remove-Variable -Name eventSB
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered before ShowDialog."}
|
||||
|
||||
#endregion Other Actions Before ShowDialog
|
||||
|
||||
# Show the form
|
||||
try {[void]$Script:refs['MainForm'].ShowDialog()} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered unexpectedly at ShowDialog."}
|
||||
|
||||
<#
|
||||
#region Actions After Form Closed
|
||||
|
||||
try {
|
||||
|
||||
} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered after Form close."}
|
||||
|
||||
#endregion Actions After Form Closed
|
||||
#>
|
||||
}
|
||||
|
||||
#region Start Point of Execution
|
||||
|
||||
# Initialize STA Runspace
|
||||
$rsGUI = [Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
|
||||
$rsGUI.ApartmentState = 'STA'
|
||||
$rsGUI.ThreadOptions = 'ReuseThread'
|
||||
$rsGUI.Open()
|
||||
|
||||
# Create the PSCommand, Load into Runspace, and BeginInvoke
|
||||
$cmdGUI = [Management.Automation.PowerShell]::Create().AddScript($sbGUI).AddParameter('BaseDir',$PSScriptRoot)
|
||||
$cmdGUI.RunSpace = $rsGUI
|
||||
$handleGUI = $cmdGUI.BeginInvoke()
|
||||
|
||||
# Hide Console Window
|
||||
Add-Type -Name Window -Namespace Console -MemberDefinition '
|
||||
[DllImport("Kernel32.dll")]
|
||||
public static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);
|
||||
'
|
||||
|
||||
[Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), 0)
|
||||
|
||||
#Loop Until GUI Closure
|
||||
while ( $handleGUI.IsCompleted -eq $false ) {Start-Sleep -Seconds 5}
|
||||
|
||||
# Dispose of GUI Runspace/Command
|
||||
$cmdGUI.EndInvoke($handleGUI)
|
||||
$cmdGUI.Dispose()
|
||||
$rsGUI.Dispose()
|
||||
|
||||
Exit
|
||||
|
||||
#endregion Start Point of Execution
|
||||
Executable
+129
@@ -0,0 +1,129 @@
|
||||
[tool.black]
|
||||
target-version = ['py310']
|
||||
line-length = 120
|
||||
skip-string-normalization = true
|
||||
skip-magic-trailing-comma = true
|
||||
force-exclude = '''
|
||||
/(
|
||||
| docs
|
||||
| setup.py
|
||||
)/
|
||||
'''
|
||||
|
||||
[tool.isort]
|
||||
py_version = 310
|
||||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
|
||||
default_section = "THIRDPARTY"
|
||||
known_third_party = []
|
||||
known_first_party = []
|
||||
known_local_folder = []
|
||||
# style: black
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = true
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = true
|
||||
ensure_newline_before_comments = true
|
||||
line_length = 120
|
||||
split_on_trailing_comma = true
|
||||
lines_after_imports = 2
|
||||
force_single_line = true
|
||||
skip_glob = ["docs/*", "setup.py"]
|
||||
filter_files = true
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py310"
|
||||
line-length = 120
|
||||
indent-width = 4
|
||||
extend-exclude = ["docs", "test", "tests"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["F", "E"]
|
||||
extend-select = ["W", "C90", "I", "N", "B", "A", "C4", "PERF", "RUF"]
|
||||
ignore = ["I001"]
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
preview = true
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
force-single-line = true
|
||||
force-sort-within-sections = false
|
||||
lines-after-imports = 2
|
||||
known-first-party = []
|
||||
known-local-folder = []
|
||||
known-third-party = []
|
||||
section-order = [
|
||||
"future",
|
||||
"standard-library",
|
||||
"third-party",
|
||||
"first-party",
|
||||
"local-folder",
|
||||
]
|
||||
|
||||
[tool.ruff.lint.mccabe]
|
||||
max-complexity = 24
|
||||
|
||||
[tool.ruff.lint.pycodestyle]
|
||||
ignore-overlong-task-comments = true
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "numpy"
|
||||
|
||||
[tool.ruff.lint.flake8-annotations]
|
||||
allow-star-arg-any = true
|
||||
ignore-fully-untyped = true
|
||||
|
||||
[tool.ruff.lint.pylint]
|
||||
max-args = 5
|
||||
max-branches = 12
|
||||
max-locals = 15
|
||||
max-statements = 50
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
skip-magic-trailing-comma = false
|
||||
line-ending = "auto"
|
||||
preview = false
|
||||
docstring-code-format = true
|
||||
|
||||
[tool.mypy]
|
||||
# Platform configuration
|
||||
python_version = "3.10"
|
||||
# imports related
|
||||
ignore_missing_imports = true
|
||||
follow_imports = "silent"
|
||||
# None and Optional handling
|
||||
no_implicit_optional = false
|
||||
strict_optional = false
|
||||
# Configuring warnings
|
||||
warn_unused_configs = true
|
||||
warn_redundant_casts = true
|
||||
warn_unused_ignores = true
|
||||
warn_no_return = true
|
||||
warn_unreachable = true
|
||||
warn_return_any = false
|
||||
# Untyped definitions and calls
|
||||
check_untyped_defs = false
|
||||
disallow_untyped_calls = false
|
||||
disallow_untyped_defs = false
|
||||
disallow_incomplete_defs = false
|
||||
disallow_untyped_decorators = false
|
||||
# Disallow dynamic typing
|
||||
disallow_subclassing_any = false
|
||||
disallow_any_unimported = false
|
||||
disallow_any_expr = false
|
||||
disallow_any_decorated = false
|
||||
disallow_any_explicit = false
|
||||
disallow_any_generics = false
|
||||
# Miscellaneous strictness flags
|
||||
allow_untyped_globals = true
|
||||
allow_redefinition = true
|
||||
local_partial_types = false
|
||||
implicit_reexport = true
|
||||
strict_equality = true
|
||||
# Configuring error messages
|
||||
show_error_context = false
|
||||
show_column_numbers = false
|
||||
show_error_codes = true
|
||||
exclude = ["docs", "test", "tests"]
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
# Packaging
|
||||
# python -m pip install -U pip
|
||||
build>=1.2.1
|
||||
twine>=5.1.0
|
||||
setuptools>=73.0.1
|
||||
virtualenv>=20.26.3
|
||||
|
||||
# Jupyter
|
||||
ipython>=8.18.1
|
||||
ipykernel>=6.29.5
|
||||
|
||||
# Linting/Formatting
|
||||
ruff>=0.6.2
|
||||
black>=24.8.0
|
||||
isort>=5.13.2
|
||||
|
||||
# Tooling
|
||||
pre-commit>=3.8.0
|
||||
nbqa>=1.8.7
|
||||
|
||||
# Type Checker
|
||||
mypy>=1.11.1
|
||||
mypy-extensions>=1.0.0
|
||||
|
||||
# Testing
|
||||
pytest>=8.3.2
|
||||
pytest-cov>=5.0.0
|
||||
pytest-benchmark>=4.0.0
|
||||
codecov>=2.1.13
|
||||
|
||||
# Documentation
|
||||
mkdocs>=1.6.0
|
||||
mkdocstrings>=0.25.2
|
||||
mkdocs-material>=9.5.33
|
||||
mkdocstrings-python>=1.10.8
|
||||
Pygments>=2.18.0
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
-r requirements-dev.txt
|
||||
Reference in New Issue
Block a user