mirror of
				https://github.com/massgravel/Microsoft-Activation-Scripts.git
				synced 2025-11-04 17:13:24 +08:00 
			
		
		
		
	Add support for external LibTSforge.dll if found in BIN folder
This commit is contained in:
		
							parent
							
								
									294837dfe0
								
							
						
					
					
						commit
						70162c4130
					
				@ -154,6 +154,7 @@ goto dk_done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
set "_work=%~dp0"
 | 
					set "_work=%~dp0"
 | 
				
			||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
					if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
				
			||||||
 | 
					set "_workp=%_work:'=''%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set "_batf=%~f0"
 | 
					set "_batf=%~f0"
 | 
				
			||||||
set "_batp=%_batf:'=''%"
 | 
					set "_batp=%_batf:'=''%"
 | 
				
			||||||
@ -8826,6 +8827,13 @@ namespace LibTSforge.PhysicalStore
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
'@
 | 
					'@
 | 
				
			||||||
$ErrorActionPreference = 'Stop'
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
 | 
					$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (Test-Path -Path $binPath) {
 | 
				
			||||||
 | 
					    Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
 | 
				
			||||||
 | 
					    Add-Type -Path $binPath
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					else {
 | 
				
			||||||
    $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
 | 
					    $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
 | 
				
			||||||
    $cp.CompilerOptions = "/unsafe"
 | 
					    $cp.CompilerOptions = "/unsafe"
 | 
				
			||||||
    $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
 | 
					    $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
 | 
				
			||||||
@ -8837,6 +8845,8 @@ $env:TEMP = $ctemp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    $cp.GenerateInMemory = $true
 | 
					    $cp.GenerateInMemory = $true
 | 
				
			||||||
    Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
 | 
					    Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($env:_debug -eq '0') {
 | 
					if ($env:_debug -eq '0') {
 | 
				
			||||||
    [LibTSforge.Logger]::HideOutput = $true
 | 
					    [LibTSforge.Logger]::HideOutput = $true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -221,6 +221,7 @@ goto dk_done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
set "_work=%~dp0"
 | 
					set "_work=%~dp0"
 | 
				
			||||||
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
					if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
 | 
				
			||||||
 | 
					set "_workp=%_work:'=''%"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set "_batf=%~f0"
 | 
					set "_batf=%~f0"
 | 
				
			||||||
set "_batp=%_batf:'=''%"
 | 
					set "_batp=%_batf:'=''%"
 | 
				
			||||||
@ -6709,6 +6710,13 @@ namespace LibTSforge.PhysicalStore
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
'@
 | 
					'@
 | 
				
			||||||
$ErrorActionPreference = 'Stop'
 | 
					$ErrorActionPreference = 'Stop'
 | 
				
			||||||
 | 
					$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (Test-Path -Path $binPath) {
 | 
				
			||||||
 | 
					    Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
 | 
				
			||||||
 | 
					    Add-Type -Path $binPath
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					else {
 | 
				
			||||||
    $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
 | 
					    $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
 | 
				
			||||||
    $cp.CompilerOptions = "/unsafe"
 | 
					    $cp.CompilerOptions = "/unsafe"
 | 
				
			||||||
    $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
 | 
					    $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
 | 
				
			||||||
@ -6720,6 +6728,8 @@ $env:TEMP = $ctemp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    $cp.GenerateInMemory = $true
 | 
					    $cp.GenerateInMemory = $true
 | 
				
			||||||
    Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
 | 
					    Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($env:_debug -eq '0') {
 | 
					if ($env:_debug -eq '0') {
 | 
				
			||||||
    [LibTSforge.Logger]::HideOutput = $true
 | 
					    [LibTSforge.Logger]::HideOutput = $true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user