fix: Read auto-load assembly version from DLL
This commit is contained in:
1 parent
0031014f04
commit
f594a72950
1 file changed
+3
-2
+3
-2
@@ -68,7 +68,7 @@ exit /b 0
|
|||||||
set "TERRASHARP_CONFIG_MODE=%~1"
|
set "TERRASHARP_CONFIG_MODE=%~1"
|
||||||
set "TERRASHARP_CONFIG_PATH=%TerrariaDir%\Terraria.exe.config"
|
set "TERRASHARP_CONFIG_PATH=%TerrariaDir%\Terraria.exe.config"
|
||||||
set "TERRASHARP_CONFIG_VALIDATE=%~2"
|
set "TERRASHARP_CONFIG_VALIDATE=%~2"
|
||||||
powershell -NoProfile -NonInteractive -Command "$source = [IO.File]::ReadAllText($env:TERRASHARP_AUTOLOAD_SCRIPT); & ([scriptblock]::Create($source.Substring($source.LastIndexOf('# PowerShell')))) -Mode $env:TERRASHARP_CONFIG_MODE -ConfigPath $env:TERRASHARP_CONFIG_PATH -ValidateOnly:($env:TERRASHARP_CONFIG_VALIDATE -eq '1')"
|
powershell -NoProfile -NonInteractive -Command "$source = [IO.File]::ReadAllText($env:TERRASHARP_AUTOLOAD_SCRIPT); & ([scriptblock]::Create($source.Substring($source.LastIndexOf('# PowerShell')))) -Mode $env:TERRASHARP_CONFIG_MODE -ConfigPath $env:TERRASHARP_CONFIG_PATH -AssemblyPath $env:DLL -ValidateOnly:($env:TERRASHARP_CONFIG_VALIDATE -eq '1')"
|
||||||
exit /b %errorlevel%
|
exit /b %errorlevel%
|
||||||
|
|
||||||
:launcher
|
:launcher
|
||||||
@@ -91,13 +91,13 @@ param(
|
|||||||
[string]$Mode,
|
[string]$Mode,
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$ConfigPath,
|
[string]$ConfigPath,
|
||||||
|
[string]$AssemblyPath,
|
||||||
[switch]$ValidateOnly
|
[switch]$ValidateOnly
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
$managerType = 'TerraSharp.LoaderDomainManager'
|
$managerType = 'TerraSharp.LoaderDomainManager'
|
||||||
$assemblyName = 'TerraSharp.Vanilla'
|
$assemblyName = 'TerraSharp.Vanilla'
|
||||||
$assemblyIdentity = 'TerraSharp.Vanilla, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
|
|
||||||
$ConfigPath = [IO.Path]::GetFullPath($ConfigPath)
|
$ConfigPath = [IO.Path]::GetFullPath($ConfigPath)
|
||||||
$document = New-Object Xml.XmlDocument
|
$document = New-Object Xml.XmlDocument
|
||||||
$document.PreserveWhitespace = $true
|
$document.PreserveWhitespace = $true
|
||||||
@@ -129,6 +129,7 @@ try {
|
|||||||
$assemblyNodes = @($document.SelectNodes('/configuration/runtime/appDomainManagerAssembly'))
|
$assemblyNodes = @($document.SelectNodes('/configuration/runtime/appDomainManagerAssembly'))
|
||||||
|
|
||||||
if ($Mode -eq 'Install') {
|
if ($Mode -eq 'Install') {
|
||||||
|
$assemblyIdentity = [Reflection.AssemblyName]::GetAssemblyName($AssemblyPath).FullName
|
||||||
foreach ($typeNode in $typeNodes) {
|
foreach ($typeNode in $typeNodes) {
|
||||||
if ($typeNode.GetAttribute('value') -cne $managerType) {
|
if ($typeNode.GetAttribute('value') -cne $managerType) {
|
||||||
throw 'Another AppDomainManager is configured; its entries were left unchanged.'
|
throw 'Another AppDomainManager is configured; its entries were left unchanged.'
|
||||||
|
|||||||
Reference in new issue
Block a user