I wrote a C# program that copies a file and then reads certain parts of it. The program works perfectly fine on my pc, but on my friends pc it closes instantly. My friend has the latest .net framework version and the latest windows version.
This is my code:
while ( true )
{
Console.WriteLine("");
Console.WriteLine("Press ENTER to check killer");
Console.ReadLine();
File.Copy(@"C:\Users\" + Environment.UserName + @"\AppData\Local\DeadByDaylight\Saved\Logs\DeadByDaylight.log", "DeadByDaylightCopy.log", true);
string killer = "";
foreach ( string line in File.ReadAllLines("DeadByDaylightCopy.log") )
{
if ( line.Contains("LogCustomization: --> TW") )
{
killer = "Wraith";
}
else if ( line.Contains("LogCustomization: --> TR") )
{
killer = "Trapper";
}
else if ( line.Contains("LogCustomization: --> HK") )
{
killer = "Spirit";
}
else if ( line.Contains("LogCustomization: --> MK") )
{
killer = "Plague";
}
else if ( line.Contains("LogCustomization: --> FK") )
{
killer = "Pig";
}
else if ( line.Contains("LogCustomization: --> OK") )
{
killer = "GhostFace";
}
else if ( line.Contains("LogCustomization: --> TN") )
{
killer = "Nurse";
}
else if ( line.Contains("LogCustomization: --> KK") )
{
killer = "Legion";
}
else if ( line.Contains("LogCustomization: --> BE") )
{
killer = "Huntress";
}
else if ( line.Contains("LogCustomization: --> TC") )
{
killer = "Billy";
}
else if ( line.Contains("LogCustomization: --> WI") )
{
killer = "Hag";
}
else if ( line.Contains("LogCustomization: --> GK") )
{
killer = "Clown";
}
else if ( line.Contains("LogCustomization: --> SD") )
{
killer = "Freddy";
}
else if ( line.Contains("LogCustomization: --> DO") )
{
killer = "Doctor";
}
else if ( line.Contains("LogCustomization: --> CA") )
{
killer = "Cannibal";
}
else if ( line.Contains("LogCustomization: --> MM") )
{
killer = "Myers";
}
else if ( line.Contains("LogCustomization: --> UK") )
{
killer = "Deathslinger";
}
else if ( line.Contains("LogCustomization: --> SwedenKiller") )
{
killer = "Oni";
}
else if ( line.Contains("LogCustomization: --> QK") )
{
killer = "Demogorgon";
}
}
if ( killer == "" )
{
Console.WriteLine("ERROR: Make sure you're in the dedicated lobby");
}
else
{
Console.WriteLine(killer);
}
Thread.Sleep(2000);
Console.Clear();
}