You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
///! Config system is currently only updated on the startup of the application and when the "start" button is pressed. This is to minimize unnecessary reads and writes to the config file.
2
+
use std::{
3
+
fs::File,
4
+
io::{Read,Write},
5
+
};
6
+
7
+
use serde::{Deserialize,Serialize};
8
+
9
+
#[derive(Clone,Deserialize,Serialize)]
10
+
pubstructConfig{
11
+
pubkill_dwm:bool,
12
+
pubkill_explorer:bool,
13
+
pubdisable_idle:bool,
14
+
pubtimer_resolution:f64,
15
+
}
16
+
17
+
implConfig{
18
+
pubfndefault() -> Config{
19
+
Config{
20
+
kill_dwm:true,
21
+
kill_explorer:false,
22
+
disable_idle:false,
23
+
timer_resolution:1.0,
24
+
}
25
+
}
26
+
27
+
pubfnread() -> Config{
28
+
let file = File::open("gameutil.toml");
29
+
match file {
30
+
Err(_) => {
31
+
let config = Config::default();
32
+
config.write().expect("Failed to write config file!");
33
+
config
34
+
},
35
+
Ok(mut file) => {
36
+
letmut contents = String::new();
37
+
file.read_to_string(&mut contents)
38
+
.expect("Failed to read config file!");
39
+
letmut config:Config = toml::from_str(&contents).expect("Failed to parse config file!");
40
+
// Prevent both from being true, dwm kills explorer already
"Has no effect on Windows 2004+, 0.0 to disable.",
103
108
)
104
109
.build(&mut data.timer_tooltip)?;
@@ -108,7 +113,7 @@ mod app_gui {
108
113
.build(&mut data.idle_tooltip)?;
109
114
110
115
nwg::Tooltip::builder()
111
-
.register(&*&mut data.clean_button,"Hotkey: F4. Cleans the working set of all processes. Can cause a slight stutter after clicking so if in-game run it when you are safe.")
116
+
.register(&*&mut data.clean_button,"Hotkey: F4. Cleans the working set of all processes. Can cause a slight stutter after clicking so if using in-game run it when you are safe.")
112
117
.build(&mut data.clean_tooltip)?;
113
118
114
119
// Wrap-up
@@ -149,11 +154,11 @@ mod app_gui {
149
154
}
150
155
if handle == ui.kill_dwm{
151
156
if ui.kill_dwm.check_state() == CheckBoxState::Checked{
0 commit comments