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nngOUfAsRKbY1bqyM+gc+FHnYIIRw2lYmt4eAh5KMBuoYW8=
::YAwzuBVtJxjWCl3EqQJgSA==
::ZR4luwNxJguZRRnk
::Yhs/ulQjdF+5
::cxAkpRVqdFKZSDk=
::cBs/ulQjdF+5
::ZR41oxFsdFKZSDk=
::eBoioBt6dFKZSDk=
::cRo6pxp7LAbNWATEpSI=
::egkzugNsPRvcWATEpCI=
::dAsiuh18IRvcCxnZtBJQ
::cRYluBh/LU+EWAnk
::YxY4rhs+aU+IeA==
::cxY6rQJ7JhzQF1fEqQJkZkoaHErSXA==
::ZQ05rAF9IBncCkqN+0xwdVsAAlXMbCXqZg==
::ZQ05rAF9IAHYFVzEqQIVLBxRQAGRL+5KyTD2IG8AF29vdMnAqGfovQo+DdQ=
::eg0/rx1wNQPfEVWB+kM9LVsJDGQ=
::fBEirQZwNQPfEVWB+kM9LVsJDGQ=
::cRolqwZ3JBvQF1fEqQIVLBxRQAGRL+5KyTD2IG8AF29vdMnAqGfovQo+DdQ=
::dhA7uBVwLU+EWHqK+yI=
::YQ03rBFzNR3SWATE0UY3LRdRXxfi
::dhAmsQZ3MwfNWATE0UY3LRdRXxfCHWe2FLwb4Pzor9iCsUgPQuc7GA==
::ZQ0/vhVqMQ3MEVWAtB9wSA==
::Zg8zqx1/OA3MEVWAtB9wSA==
::dhA7pRFwIByZRRnk
::Zh4grVQjdCuDJH2B50kkJwtoaQCFOWe/FaYgbRg0agBPJbbl0Qrp/FInX2NLpQXE1sAMoxLwKv+qV07mxJyjhlyudgpU
::YB416Ek+ZW8=
::
::
::978f952a14a936cc963da21a135fa983
@echo off
color 3f
::初始化操作
set burnername_current=启动盘制作工具_Beta_4.1.7z
del /f /q "%~dp0Upath.txt"
del /f /q "%~dp0isolist.txt"
del /f /q "%~dp0core\version_ol.txt"
del /f /q "%~dp0burn_check.txt"
del /f /q "%~dp0burn_target.txt"
del /f /q "%~dp0update_way.txt"
del /f /q "%~dp0core\burnername.txt"
del /f /q "%~dp0core\md5_iso.txt"
del /f /q "%~dp0core\md5_ol.txt"
cd /d "%~dp0"
attrib +s +a +h +r dash_checkiso.cmd
attrib +s +a +h +r dash_checkusb.cmd
attrib +s +a +h +r main_burn.cmd
attrib +s +a +h +r main_exit.cmd
attrib +s +a +h +r main_home.cmd
attrib +s +a +h +r main_update.cmd
attrib +s +a +h +r net_checknet.cmd
attrib +s +a +h +r net_downloadiso.cmd
attrib +s +a +h +r net_getversion.cmd

::useriso
dir /b *.iso >isolist.txt
set /p key=<isolist.txt
if defined key (
title 烧录自定义镜像
color 3f
cls
echo.
echo.
echo           被选择的ISO镜像名称：%key%
echo.
echo.
pause
echo "%~dp0%key%" >burn_target.txt
echo 0 >burn_check.txt
call main_burn.cmd
del /f /q isolist.txt
call main_exit.cmd
)
del /f /q isolist.txt


::OTA
if exist X:\Users\StartOTA.txt (
    set ota=1
    goto checkusb
)
if exist "X:\Program Files\version.txt" (
    if not exist X:\Users\StartOTA.txt pecmd exec core\OTA\GUI.wcs
    call main_exit.cmd
)



::检查自身更新
title 正在检查制作工具更新
color 3f
cls
core\EasyDown\EasyDown.exe -Down("http://s.edgeless.top/?token=burnername","burnername.txt","%~dp0core")
if not exist core\burnername.txt goto endSelfCheck
set /p burnername_ol=<core\burnername.txt
if not defined burnername_ol goto endSelfCheck
if %burnername_ol%==%burnername_current% goto endSelfCheck
title 启动盘制作工具有更新！
cls
echo.
echo  注意：当前存在启动盘制作工具的更新版本
echo.
echo 最新版本：%burnername_ol%
echo 当前版本：%burnername_current%
echo.
echo 继续使用当前版本可能无法实现最新特性，请前往https://down.edgeless.top下载更新，或者按任意键继续使用当前版本
echo.
echo.
pause
:endSelfCheck


:checkusb
cls
for %%1 in (Z Y X W V T S R Q P O N M L K J I H G F E D C U) do if exist %%1:\Edgeless\version.txt echo %%1>Upath.txt
if exist Upath.txt set /p Upath=<Upath.txt
if exist %Upath%:\Edgeless\version.txt set /p version_usb=<%Upath%:\Edgeless\version.txt
if not defined version_usb if defined ota (
    title 未检测到Edgeless启动盘
    cls
    echo.
    echo.
    echo.
    echo     未检测到合法的Edgeless启动盘
    echo  请插入您的Edgeless启动盘后按下任意键
    echo.
    echo.
    echo.
    pause
    goto checkusb
)
if defined version_usb (
    call net_getversion.cmd
    call dash_checkusb.cmd
    call main_exit.cmd
)






::无自定义镜像+无可升级U盘

call dash_checkiso.cmd
echo "%~dp0core\Edgeless.iso" >burn_target.txt
echo 1 >burn_check.txt
call main_burn.cmd
call main_exit.cmd