Skip to content

Commit 1b4b04c

Browse files
Close console if not debug
1 parent 6f86fdb commit 1b4b04c

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

installer/main.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import zipfile
55
import requests
66
import threading
7-
import configparser
87
import customtkinter
98
import CTkMessagebox as messagebox
109

@@ -52,10 +51,9 @@ def install():
5251
return
5352
path_entry.configure(state=customtkinter.DISABLED)
5453
browse_button.configure(state=customtkinter.DISABLED)
55-
disable_logs_button.configure(state=customtkinter.DISABLED)
5654
install_button.destroy()
5755
progress_bar = customtkinter.CTkProgressBar(app, determinate_speed=50 / 2)
58-
progress_bar.grid(column=0, row=2, columnspan=2, padx=5, pady=5)
56+
progress_bar.grid(column=0, row=1, columnspan=2, padx=5, pady=5)
5957
progress_bar.set(0)
6058
threading.Thread(target=_install, daemon=True, args=(path, )).start()
6159

@@ -71,26 +69,15 @@ def _install(path):
7169
open(path + "/BepInEx/plugins/PolyMod.dll", "wb").write(
7270
requests.get(POLYMOD).content
7371
)
74-
os.makedirs(path + "/BepInEx/config/")
75-
config_file = open(path + "/BepInEx/config/BepInEx.cfg", "a+")
76-
config = configparser.ConfigParser()
77-
config.read_file(config_file)
78-
logs = not bool(disable_logs_button.get())
79-
if "Logging.Console" in config:
80-
config["Logging.Console"]["Enabled"] = logs
81-
else:
82-
config["Logging.Console"] = {
83-
"Enabled": logs}
84-
config.write(config_file)
8572
progress_bar.step()
8673

8774
customtkinter.CTkButton(app, text="Launch", command=launch).grid(
88-
column=0, row=3, columnspan=2, padx=5, pady=5
75+
column=0, row=2, columnspan=2, padx=5, pady=5
8976
)
9077

9178

9279
def launch():
93-
os.system("start steam://rungameid/874390")
80+
os.startfile("steam://rungameid/874390")
9481
app.destroy()
9582
sys.exit()
9683

@@ -104,13 +91,10 @@ def launch():
10491
app, placeholder_text="Game path", width=228)
10592
browse_button = customtkinter.CTkButton(
10693
app, text="Browse", command=browse, width=1)
107-
disable_logs_button = customtkinter.CTkCheckBox(app, text="Disable logs")
108-
disable_logs_button.select()
10994
install_button = customtkinter.CTkButton(app, text="Install", command=install)
11095

11196
path_entry.grid(column=0, row=0, padx=5, pady=5)
11297
browse_button.grid(column=1, row=0, padx=(0, 5), pady=5)
113-
disable_logs_button.grid(column=0, row=1, columnspan=2, padx=5, pady=5)
114-
install_button.grid(column=0, row=2, columnspan=2, padx=5, pady=5)
98+
install_button.grid(column=0, row=1, columnspan=2, padx=5, pady=5)
11599

116100
app.mainloop()

src/Plugin.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public override void Load()
3838
File.WriteAllText(CONFIG_PATH, JsonSerializer.Serialize(config));
3939
}
4040

41+
if (!config.debug) ConsoleManager.DetachConsole();
42+
4143
logger = Log;
4244
ConfigFile.CoreConfig[new("Logging.Disk", "WriteUnityLog")].BoxedValue = true;
4345
AudioClipLoader.Init();

0 commit comments

Comments
 (0)