private static void SaveConfig(CrossBotConfig config)
        {
            var options = new JsonSerializerOptions {
                WriteIndented = true
            };
            var json = JsonSerializer.Serialize(config, options);

            File.WriteAllText(ConfigPath, json);
        }
Exemple #2
0
 public static async Task RunFrom(CrossBotConfig config, CancellationToken cancel)
 {
     // Set up logging for Console Window
     LogUtil.Forwarders.Add(Logger);
        public static IReadOnlyCollection <Item> GetItemsFromUserInput(string request, CrossBotConfig cfg)
        {
            try
            {
                var split = request.Split(new[] { " ", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                return(GetItems(split, cfg));
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch
#pragma warning restore CA1031 // Do not catch general exception types
            {
                var split = request.Split(new[] { ",", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                return(GetItems(split, cfg, GameLanguage.DefaultLanguage));
            }
        }