Compare commits
	
		
			3 Commits
		
	
	
		
			99809c9d45
			...
			51d9389f6d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 51d9389f6d | |||
| 7bd3664f92 | |||
| 50d0951b4a | 
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace FakeeDeck.Class
 | 
					namespace FakeeDeck.Class
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    internal class Keyboard
 | 
					    internal class KeyboardCode
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public const uint LBUTTON = 0x01; // Left mouse button
 | 
					        public const uint LBUTTON = 0x01; // Left mouse button
 | 
				
			||||||
        public const uint RBUTTON = 0x02; // Right mouse button
 | 
					        public const uint RBUTTON = 0x02; // Right mouse button
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										73
									
								
								FakeeDeck/Class/YamlConfig.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								FakeeDeck/Class/YamlConfig.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Diagnostics;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Reflection.Metadata.Ecma335;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Text.Json;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					using static System.Runtime.InteropServices.JavaScript.JSType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace FakeeDeck.Class
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    internal class YamlConfig
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public Dictionary<string, dynamic> Data { get; private set; }
 | 
				
			||||||
 | 
					        public YamlConfig(string path)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Data = new Dictionary<string, dynamic>();
 | 
				
			||||||
 | 
					            ParseYamlFile(File.ReadAllLines(path));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        private Dictionary<dynamic, dynamic> ParseYamlFile(string[] lines, int levelStart = 0, int linesParsedPreviuse = 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Dictionary<dynamic, dynamic> tempObject = new Dictionary<dynamic, dynamic>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            int linesParsed = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ((linesParsed + linesParsedPreviuse) <= lines.Length)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                int level = 0;
 | 
				
			||||||
 | 
					                int iterator = 0;
 | 
				
			||||||
 | 
					                foreach (string line in lines)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    level = line.Count(x => x == '\t');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    linesParsed++;
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(line))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        continue;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Console.WriteLine(level + "> level " + linesParsedPreviuse + " Lines handeled previouselly '" + line + "'");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if ((level > levelStart || level == 0))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (line.Contains(":"))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            iterator = 0;
 | 
				
			||||||
 | 
					                            string[] array = line.Split(":");
 | 
				
			||||||
 | 
					                            string key = array[0];
 | 
				
			||||||
 | 
					                            dynamic value = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (array.Length > 0)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                tempObject[key] = array[1];
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            else if (array.Length == 1 && lines[linesParsed..lines.Length].Length > 0)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                tempObject[key] = ParseYamlFile(lines[linesParsed..lines.Length], level, linesParsed);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        } else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            iterator++;
 | 
				
			||||||
 | 
					                            tempObject[iterator] = line;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Debug.WriteLine(JsonSerializer.Serialize(tempObject));
 | 
				
			||||||
 | 
					            return tempObject;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -12,6 +12,9 @@
 | 
				
			|||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <None Update="configuration.yaml">
 | 
				
			||||||
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
 | 
					    </None>
 | 
				
			||||||
    <None Update="StaticFiles\app.js">
 | 
					    <None Update="StaticFiles\app.js">
 | 
				
			||||||
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
					      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 | 
				
			||||||
    </None>
 | 
					    </None>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,13 @@
 | 
				
			|||||||
using FakeeDeck;
 | 
					using FakeeDeck;
 | 
				
			||||||
 | 
					using FakeeDeck.Class;
 | 
				
			||||||
 | 
					using System.Diagnostics;
 | 
				
			||||||
 | 
					using System.Text.Json;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HttpServer.serv();
 | 
					
 | 
				
			||||||
 | 
					YamlConfig parser = new YamlConfig("configuration.yaml");
 | 
				
			||||||
 | 
					var result = parser.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Console.WriteLine(JsonSerializer.Serialize(result));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#HttpServer.serv();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								FakeeDeck/configuration.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								FakeeDeck/configuration.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					server:
 | 
				
			||||||
 | 
						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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user