34 lines
884 B
C#
34 lines
884 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PluralRichPresence
|
|
{
|
|
public class ConfigReader
|
|
{
|
|
const string CFG_NAME = "plurality.cfg";
|
|
const char SEPERATOR = ':';
|
|
|
|
public static string ReadString(string key)
|
|
{
|
|
StreamReader txtReader = new StreamReader(File.OpenRead(CFG_NAME));
|
|
|
|
for (string? line = txtReader.ReadLine(); line is not null; line = txtReader.ReadLine())
|
|
{
|
|
line = line.Trim().ReplaceLineEndings(String.Empty);
|
|
if (!line.Contains(SEPERATOR)) continue;
|
|
string[] configOptions = line.Split(SEPERATOR);
|
|
|
|
if (configOptions[0].Trim() == key)
|
|
return configOptions[1].Trim();
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
|
|
}
|
|
}
|