Config: add debug flag
This commit is contained in:
		@@ -8,6 +8,7 @@ namespace Elwig.Helpers {
 | 
			
		||||
    public class Config {
 | 
			
		||||
 | 
			
		||||
        private readonly string FileName;
 | 
			
		||||
        public bool Debug;
 | 
			
		||||
        public string DatabaseFile = App.DataPath + "database.sqlite3";
 | 
			
		||||
        public string? DatabaseLog = null;
 | 
			
		||||
        public string? Branch = null;
 | 
			
		||||
@@ -49,6 +50,13 @@ namespace Elwig.Helpers {
 | 
			
		||||
                Branch = branch;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (ini == null || !ini.TryGetKey("general.debug", out string debug)) {
 | 
			
		||||
                Debug = false;
 | 
			
		||||
            } else {
 | 
			
		||||
                debug = debug.ToLower();
 | 
			
		||||
                Debug = debug == "1" || debug == "true" || debug == "yes" || debug == "on";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ScaleList.Clear();
 | 
			
		||||
            Scales = ScaleList;
 | 
			
		||||
            if (ini != null) {
 | 
			
		||||
@@ -72,6 +80,7 @@ namespace Elwig.Helpers {
 | 
			
		||||
            using var file = new StreamWriter(FileName, false, Utils.UTF8);
 | 
			
		||||
            file.Write($"\r\n[general]\r\n");
 | 
			
		||||
            if (Branch != null) file.Write($"branch = {Branch}\r\n");
 | 
			
		||||
            if (Debug) file.Write("debug = true\r\n");
 | 
			
		||||
            file.Write($"\r\n[database]\r\nfile = {DatabaseFile}\r\n");
 | 
			
		||||
            if (DatabaseLog != null) file.Write($"log = {DatabaseLog}\r\n");
 | 
			
		||||
            foreach (var s in ScaleList) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user