Пример #1
0
        /// <summary>
        /// Write data to the tournament.cfg
        /// </summary>
        /// <returns>the running <see cref="Task"/></returns>
        public async Task SaveAsync()
        {
            FlexLogger.Log("Saving configs");
            List <string> lines = new List <string>();

            foreach (var e in entries)
            {
                lines.Add(e.Key + " = " + e.Value);
            }

            await Task.Run(() => File.WriteAllLines(file, lines)).ConfigureAwait(false);
        }
Пример #2
0
        /// <summary>
        /// Read and store data from the tournament.cfg
        /// </summary>
        public void Reload()
        {
            FlexLogger.Log("Reloading configs");
            entries.Clear();

            if (File.Exists(file))
            {
                foreach (string l in File.ReadAllLines(file))
                {
                    string[] split = l.Split('=');
                    entries.Add(split[0].Trim(), split[1].Trim());
                }
            }

            FlexLogger.Log($"Loaded {entries.Count} entries!");
        }