namespace PluralFlux; public static class ConfigExtension { //Load YML configuration from file public static Dictionary? LoadConfig() { //NOTE: This path may need to be modified depending on where you run the example from if (File.Exists("./config.yml")) { string[] lines = File.ReadAllLines("./config.yml"); Dictionary configValues = ParseYaml(lines); // Use the values from the config if (configValues.TryGetValue("Token", out var token)) { Console.WriteLine($"Token: {token}"); } return configValues; } return null; } //Custom YML parser private static Dictionary ParseYaml(string[] lines) { Dictionary configValues = new Dictionary(); string currentKey = ""; foreach (string line in lines) { if (line.Trim().StartsWith('#')) { // Skip comments continue; } if (line.Contains(":")) { string[] parts = line.Split(':'); currentKey = parts[0].Trim(); string value = parts.Length > 1 ? parts[1].Trim() : ""; configValues[currentKey] = value; } else if (!string.IsNullOrEmpty(currentKey)) { // Multi-line values configValues[currentKey] += Environment.NewLine + line.Trim(); } } return configValues; } }