I honestly don't get what part is causing me the error. "System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'" is what I get but it shouldn't happen.
class Program
{
static void Main(string[] args)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\firstrun\config.cfg";
if (!File.Exists(path))
{
Console.WriteLine("First time running");
File.Create(path);
}
nameMethod(path);
Console.ReadKey();
}
static void nameMethod(string path)
{
var lines = File.ReadAllLines(path).ToList();
var idk = lines.Where(x => x.ToLower().Contains("name:"));
string[] s = idk.ToString().Split(':');
Console.WriteLine(s[1]);
}
}
Text from the .cfg: Name: Nala