Skip to content

Commit ec385ea

Browse files
authored
rewrite some parts to reduce startup latency
1 parent 88d7fd4 commit ec385ea

File tree

4 files changed

+84
-43
lines changed

4 files changed

+84
-43
lines changed

background-service.bat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@echo off
2+
title Dopamine Service.
3+
4+
:hide
5+
if "%1"=="hide" goto admincheck
6+
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
7+
8+
:admincheck
9+
net session >nul 2>&1
10+
if %errorlevel% neq 0 (
11+
PowerShell -Command "Start-Process '%~dpnx0' -Verb RunAs"
12+
exit /b
13+
)
14+
15+
:rundisplaymodule
16+
start %appdata%\dopamine\state-display.bat
17+
18+
:mainservice
19+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
20+
taskkill /f /im SeewoCore.exe
21+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
22+
taskkill /f /im SeewoAbility.exe
23+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
24+
taskkill /f /im EasiAgent.exe
25+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
26+
taskkill /f /im Easiupdate3Protect.exe
27+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
28+
taskkill /f /im Easiupdate3.exe
29+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
30+
taskkill /f /im SeewoServiceAssistant.exe
31+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
32+
taskkill /f /im SeewoHugoLauncher.exe
33+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
34+
taskkill /f /im SeewoFreezeUpdateAssist.exe
35+
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
36+
goto mainservice

main-service.bat

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,37 @@
1+
@echo off
2+
title Dopamine Loader
3+
14
:createpath
25
mkdir %appdata%\dopamine_service
36

4-
:hide
5-
if "%1"=="hide" goto admincheck
6-
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
7-
8-
:admincheck
9-
net session >nul 2>&1
10-
if %errorlevel% neq 0 (
11-
PowerShell -Command "Start-Process '%~dpnx0' -Verb RunAs"
12-
exit /b
13-
)
14-
157
:requirefilescheck
168
if not exist %systemdrive%\Windows\System32\PING.EXE goto requirecheckfilesfailed
179
if not exist %systemdrive%\Windows\System32\taskkill.exe goto requirecheckfilesfailed
1810
if not exist %systemdrive%\Windows\System32\cmd.exe goto requirecheckfilesfailed
1911
if not exist %systemdrive%\Windows\System32\wscript.exe goto requirecheckfilesfailed
2012

2113
:statecheck
22-
if exist %appdata%\dopamine_service\state.dp goto judgeexist
23-
start %appdata%\dopamine\state-display.bat
24-
goto mainservice
14+
if exist %appdata%\dopamine_service\state.dp goto judgeexistence
15+
goto runservice
2516

26-
:judgeexist
17+
:judgeexistence
2718
del /f /s /q %appdata%\dopamine_service\state.dp
28-
ping 127.0.0.1 -n 3 >nul
29-
if exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\turnoff.dp
30-
start %appdata%\dopamine\state-display.bat
19+
cls
20+
color f3
21+
echo ÇëµÈ´ýDopamine¼ÓÔØ...
22+
ping 127.0.0.1 -n 2 >nul
23+
if exist %appdata%\dopamine_service\state.dp goto turnoff
24+
if not exist %appdata%\dopamine_service\state.dp goto runservice
3125

32-
:mainservice
33-
taskkill /f /im SeewoCore.exe
34-
taskkill /f /im SeewoAbility.exe
35-
taskkill /f /im EasiAgent.exe
36-
taskkill /f /im Easiupdate3Protect.exe
37-
taskkill /f /im Easiupdate3.exe
38-
taskkill /f /im SeewoServiceAssistant.exe
39-
taskkill /f /im SeewoHugoLauncher.exe
40-
taskkill /f /im SeewoFreezeUpdateAssist.exe
26+
:runservice
27+
start %appdata%\Dopamine\background-service.bat
28+
exit
4129

42-
:keepstate
43-
if not exist %appdata%\dopamine_service\state.dp clip > %appdata%\dopamine_service\state.dp
44-
goto mainservice
30+
:turnoff
31+
start %appdata%\Dopamine\state-off.bat
32+
exit
4533

4634
:requirecheckfilesfailed
4735
clip > %appdata%\dopamine_service\nofiles.dp
48-
start %appdata%\dopamine\state-display.bat
36+
start %appdata%\Dopamine\state-display.bat
4937
exit

state-display.bat

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
@echo off
2+
title Dopamine Loader
3+
14
:setversion
25
set servicename=Dopamine
3-
set version=v1.1
4-
set codename=alpha
6+
set version=v1.2
7+
set codename=semi-rewrite
58
set website=https://litev4.github.io/dopamine-web/
69

710
:checkaction
@@ -25,17 +28,11 @@ echo %servicename%
2528
echo 按任意键关闭该窗口
2629
echo.
2730
echo.
28-
echo %servicename% Service 版本 - %version% %codename%
29-
set /p =官方网址 - %website%<nul
31+
echo %servicename% Service 版本 / %version% %codename%
32+
set /p =官方网址 / %website%<nul
3033
pause >nul
3134
exit
3235

33-
:off
34-
del /f /s /q %appdata%\dopamine_service\turnoff.dp
35-
start %appdata%\dopamine\state-off.vbs
36-
taskkill /f /im cmd.exe
37-
exit
38-
3936
:nofiles
4037
del /f /s /q %appdata%\dopamine_service\nofiles.dp
4138
echo off
@@ -50,7 +47,7 @@ echo %servicename%
5047
echo 缺少系统文件
5148
echo 按任意键关闭该窗口
5249
echo.
53-
echo %servicename% Service 版本 - %version% %codename%
54-
set /p =官方网址 - %website%<nul
50+
echo %servicename% Service 版本 / %version% %codename%
51+
set /p =官方网址 / %website%<nul
5552
pause >nul
5653
exit

state-off.bat

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@echo off
2+
title Dopamine Loader
3+
4+
:hide
5+
if "%1"=="hide" goto admincheck
6+
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
7+
8+
:admincheck
9+
net session >nul 2>&1
10+
if %errorlevel% neq 0 (
11+
PowerShell -Command "Start-Process '%~dpnx0' -Verb RunAs"
12+
exit /b
13+
)
14+
15+
16+
:off
17+
del /f /s /q %appdata%\dopamine_service\turnoff.dp
18+
start %appdata%\dopamine\state-off.vbs
19+
taskkill /f /im cmd.exe
20+
exit

0 commit comments

Comments
 (0)