Catch Steam exceptions where Steam was installed, but removed

This commit is contained in:
Kamil Trzciński 2022-12-16 10:05:57 +01:00
parent 82dcbd7d36
commit d362eb41f5

View file

@ -189,6 +189,11 @@ namespace SteamController.Helpers
return new HashSet<String>();
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return null;
}
catch (IOException e)
{
Log.TraceException("STEAM", "Config", e);
@ -218,6 +223,11 @@ namespace SteamController.Helpers
File.Copy(configPath, String.Format("{0}.{1}.bak", configPath, suffix));
return true;
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return false;
}
catch (IOException e)
{
Log.TraceException("STEAM", "Config", e);
@ -279,6 +289,11 @@ namespace SteamController.Helpers
File.WriteAllLines(configPath, lines);
return true;
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return false;
}
catch (IOException e)
{
Log.TraceException("STEAM", "Config", e);
@ -297,6 +312,11 @@ namespace SteamController.Helpers
byte[] diskContent = File.ReadAllBytes(configPath);
return content.SequenceEqual(diskContent);
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return null;
}
catch (IOException e)
{
Log.TraceException("STEAM", "Config", e);
@ -315,6 +335,11 @@ namespace SteamController.Helpers
File.Copy(configPath + ".orig", configPath, true);
return true;
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return null;
}
catch (UnauthorizedAccessException)
{
return false;
@ -359,6 +384,11 @@ namespace SteamController.Helpers
{
return false;
}
catch (DirectoryNotFoundException)
{
// Steam was installed, but got removed
return false;
}
catch (IOException e)
{
Log.TraceException("STEAM", "Config", e);