From 41aa2b7c7bc06285d1978b16f93972999d86e98e Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Wed, 11 Sep 2024 07:59:00 -0700 Subject: [PATCH] Tweaks --- FakeeDeck/Class/YamlConfig.cs | 22 ++++++++------- FakeeDeck/Program.cs | 4 +-- FakeeDeck/configuration.yaml | 50 +++++++++++++++++++---------------- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/FakeeDeck/Class/YamlConfig.cs b/FakeeDeck/Class/YamlConfig.cs index b018340..1269d1b 100644 --- a/FakeeDeck/Class/YamlConfig.cs +++ b/FakeeDeck/Class/YamlConfig.cs @@ -38,30 +38,34 @@ namespace FakeeDeck.Class continue; } - Console.WriteLine(level + "> level " + linesParsedPreviuse + " Lines handeled previouselly '" + line + "'"); - - if ((level > levelStart || level == 0)) + Console.WriteLine(level + ">"+ levelStart + " level " + linesParsedPreviuse + " Lines handeled previouselly '" + line + "'"); + if ((level > levelStart || levelStart == 0)) { if (line.Contains(":")) { + Console.WriteLine("Key:Value Pair"); iterator = 0; string[] array = line.Split(":"); - string key = array[0]; + string key = array[0].Trim('\t'); dynamic value = ""; - if (array.Length > 0) + if (array.Length > 1 && !string.IsNullOrEmpty(array[1])) { - tempObject[key] = array[1]; + Console.WriteLine("Strict Value Found: " + array[1]); + tempObject.Add(key,array[1]); } - else if (array.Length == 1 && lines[linesParsed..lines.Length].Length > 0) + else if (array.Length == 2 && string.IsNullOrEmpty(array[1]) && lines[linesParsed..lines.Length].Length > 0) { - tempObject[key] = ParseYamlFile(lines[linesParsed..lines.Length], level, linesParsed); + tempObject.Add(key, ParseYamlFile(lines[linesParsed..lines.Length], level, linesParsed)); } } else { iterator++; - tempObject[iterator] = line; + tempObject.Add(iterator,line); } + } else if (level < levelStart) + { + Console.WriteLine("Level DOwns"); } } } diff --git a/FakeeDeck/Program.cs b/FakeeDeck/Program.cs index 9a846cd..62f84fe 100644 --- a/FakeeDeck/Program.cs +++ b/FakeeDeck/Program.cs @@ -6,8 +6,6 @@ using System.Text.Json; YamlConfig parser = new YamlConfig("configuration.yaml"); var result = parser.Data; - Console.WriteLine(JsonSerializer.Serialize(result)); - -#HttpServer.serv(); +//HttpServer.serv(); diff --git a/FakeeDeck/configuration.yaml b/FakeeDeck/configuration.yaml index b498e54..3af38fe 100644 --- a/FakeeDeck/configuration.yaml +++ b/FakeeDeck/configuration.yaml @@ -1,26 +1,30 @@ + server: - port: 8000 + port: 8000 pages: - - helldivers: - - test1: - name: test - type: keyboard - url: https://www.reddit.com/r/kde/comments/fen7lj/plasmoid_for_managing_docker_containers/ - action: - - 0x31 - - 0x31 - - test2: - name: test2 - type: keyboard - url: https://www.reddit.com/ - action: - - 0x31 - - 0x31 - - media: - - mute: - name: mute - type: keyboard - url: https://www.reddit.com/r/kde/comments/fen7lj/plasmoid_for_managing_docker_containers/ - action: - - 0x33 \ No newline at end of file + - page: helldivers, + buttons: + - button: b_1, + name: test, + type: keyboard, + url: https://www.reddit.com/r/kde/comments/fen7lj/plasmoid_for_managing_docker_containers/, + action: + - 0x31 + - 0x31 + - button: b_2, + name: test, + type: keyboard, + url: https://www.reddit.com/r/kde/comments/fen7lj/plasmoid_for_managing_docker_containers/, + action: + - 0x31 + - 0x31 + - page: media, + buttons: + - button: b_1, + name: test, + type: keyboard, + url: https://www.reddit.com/, + action: + - 0x31 + - 0x31 \ No newline at end of file