-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement Winch config options in the settings menu - Update Winch uninstall logic for version 0.3.1 - Fixed sidebar width changing, reload info when changing pages
- Loading branch information
Showing
13 changed files
with
224 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use std::fs; | ||
use serde_json::Result as SerdeResult; | ||
|
||
#[derive(serde::Serialize, serde::Deserialize)] | ||
#[serde(rename_all(serialize = "UPPERCASE"))] | ||
#[derive(Default)] | ||
pub enum LogLevel { | ||
UNITY, | ||
DEBUG, | ||
#[default] | ||
INFO, | ||
WARN, | ||
ERROR | ||
} | ||
|
||
#[derive(serde::Serialize, serde::Deserialize)] | ||
#[serde(rename_all = "PascalCase")] | ||
pub struct WinchConfig { | ||
#[serde(default)] | ||
pub write_logs_to_file : bool, | ||
|
||
#[serde(default)] | ||
pub write_logs_to_console : bool, | ||
|
||
#[serde(default)] | ||
pub logs_folder : String, | ||
|
||
#[serde(default)] | ||
pub log_level : LogLevel, | ||
|
||
#[serde(default)] | ||
pub detailed_log_sources : bool, | ||
|
||
#[serde(default)] | ||
pub enable_developer_console : bool, | ||
|
||
#[serde(default)] | ||
pub max_log_files : i32, | ||
|
||
#[serde(default)] | ||
pub log_port : String | ||
} | ||
|
||
pub fn load_winch_config(dredge_folder : String) -> Result<WinchConfig, String> { | ||
let file = format!("{}/WinchConfig.json", dredge_folder); | ||
let winch_config_string = match fs::read_to_string(&file) { | ||
Ok(v) => v, | ||
Err(_) => return Err(format!("Couldn't find WinchConfig at {}", file).to_string()) | ||
}; | ||
let json = match serde_json::from_str(&winch_config_string) as SerdeResult<WinchConfig> { | ||
Ok(v) => v, | ||
Err(e) => return Err(format!("Couldn't load mod WinchConfig at {} - {}", file, e.to_string()).to_string()) | ||
}; | ||
|
||
Ok(json) | ||
} | ||
|
||
pub fn write_winch_config(json : String, dredge_folder : String) -> Result<(), String> { | ||
let file = format!("{}/WinchConfig.json", dredge_folder); | ||
match fs::write(file.to_string(), json.to_string()) { | ||
Ok(_) => return Ok(()), | ||
Err(_) => return Err(format!("Couldn't save WinchConfig at {} with settings {}", file, json).to_string()) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export enum LogLevel { | ||
UNITY, | ||
DEBUG, | ||
INFO, | ||
WARN, | ||
ERROR | ||
} | ||
|
||
export interface WinchConfig { | ||
WriteLogsToFile : boolean, | ||
WriteLogsToConsole : boolean, | ||
LogLevel : LogLevel, | ||
LogsFolder : string, | ||
DetailedLogSources : boolean, | ||
EnableDeveloperConsole : boolean, | ||
MaxLogFiles : number, | ||
LogPort: string | ||
} |
Oops, something went wrong.