spine连接器和导出修改
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
setlocal
|
||||
|
||||
set "PACKAGE_DIR=%~dp0"
|
||||
set "PID_FILE=%PACKAGE_DIR%.run\spine-connector.pid"
|
||||
set "CONNECTOR_BIN=%PACKAGE_DIR%SpineParticleConnector.exe"
|
||||
set "CONNECTOR_PID="
|
||||
if exist "%PID_FILE%" set /p CONNECTOR_PID=<"%PID_FILE%"
|
||||
|
||||
powershell -NoProfile -Command ^
|
||||
"$pidValue=0; [void][int]::TryParse($env:CONNECTOR_PID,[ref]$pidValue);" ^
|
||||
"$process=if($pidValue -gt 0){Get-CimInstance Win32_Process -Filter ('ProcessId = ' + $pidValue) -ErrorAction SilentlyContinue};" ^
|
||||
"if($null -eq $process){$listener=Get-NetTCPConnection -LocalPort 27843 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if($listener){$process=Get-CimInstance Win32_Process -Filter ('ProcessId = ' + $listener.OwningProcess) -ErrorAction SilentlyContinue}};" ^
|
||||
"if ($null -eq $process) { exit 2 };" ^
|
||||
"if ($process.CommandLine -notlike ('*' + $env:CONNECTOR_BIN + '*')) { exit 3 };" ^
|
||||
"Stop-Process -Id $process.ProcessId -Force"
|
||||
|
||||
set "STOP_RESULT=%ERRORLEVEL%"
|
||||
del /q "%PID_FILE%" >nul 2>&1
|
||||
if "%STOP_RESULT%"=="3" (
|
||||
echo 27843 端口对应的进程不是此独立连接器,为避免误关,本次未执行停止。
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo Spine粒子连接器已停止。
|
||||
exit /b 0
|
||||
@@ -0,0 +1,42 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
setlocal
|
||||
|
||||
set "PACKAGE_DIR=%~dp0"
|
||||
set "RUN_DIR=%PACKAGE_DIR%.run"
|
||||
set "PID_FILE=%RUN_DIR%\spine-connector.pid"
|
||||
set "OUT_LOG=%RUN_DIR%\spine-connector.log"
|
||||
set "ERROR_LOG=%RUN_DIR%\spine-connector-error.log"
|
||||
set "CONNECTOR_BIN=%PACKAGE_DIR%SpineParticleConnector.exe"
|
||||
|
||||
if not exist "%RUN_DIR%" mkdir "%RUN_DIR%"
|
||||
if not exist "%CONNECTOR_BIN%" (
|
||||
echo 未找到独立连接器:%CONNECTOR_BIN%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if exist "%PID_FILE%" (
|
||||
set /p CONNECTOR_PID=<"%PID_FILE%"
|
||||
powershell -NoProfile -Command "if (Get-Process -Id $env:CONNECTOR_PID -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"
|
||||
if not errorlevel 1 (
|
||||
echo Spine粒子连接器已经在运行。
|
||||
exit /b 0
|
||||
)
|
||||
del /q "%PID_FILE%" >nul 2>&1
|
||||
)
|
||||
|
||||
echo 正在启动 Spine粒子连接器...
|
||||
powershell -NoProfile -Command ^
|
||||
"$process=Start-Process -FilePath $env:CONNECTOR_BIN -WorkingDirectory $env:PACKAGE_DIR -RedirectStandardOutput $env:OUT_LOG -RedirectStandardError $env:ERROR_LOG -WindowStyle Hidden -PassThru;" ^
|
||||
"Set-Content -Path $env:PID_FILE -Value $process.Id -Encoding ascii"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo 连接器启动失败。
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
timeout /t 2 /nobreak >nul
|
||||
echo Spine粒子连接器已启动,可以回到网页直接导出 .spine。
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user