fix catching exception

This commit is contained in:
AlexZ 2020-02-03 13:13:35 +03:00
parent e33f0b6d12
commit 08659b463b

View File

@ -97,6 +97,7 @@ namespace EpicMorg.SteamPathsLib {
}
}
public static ConfigSteamData GetSteamConfig() {
try {
var result = new ConfigSteamData();
var libraryPaths = new List<string>();
@ -118,9 +119,13 @@ namespace EpicMorg.SteamPathsLib {
result.SteamLibraryFolders = libraryPaths.ToArray();
return result;
} catch (Exception) {
return null;
}
}
public static List<LibrarySteamData> GetLibrarySteamDataList() {
try {
var configData = GetSteamConfig();
var result = new List<LibrarySteamData>();
@ -148,9 +153,13 @@ namespace EpicMorg.SteamPathsLib {
}
return result;
} catch (Exception) {
return null;
}
}
public static List<SteamAppManifestData> GetAllSteamAppManifestData() {
try {
var result = new List<SteamAppManifestData>();
var libraries = GetLibrarySteamDataList();
@ -160,8 +169,11 @@ namespace EpicMorg.SteamPathsLib {
}
return result;
} catch (Exception) {
return null;
}
}
public static SteamAppManifestData GetSteamAppManifestDataById(int appId) => GetAllSteamAppManifestData().FirstOrDefault(appData => appData.AppId == appId);
public static SteamAppManifestData GetSteamAppManifestDataById(int appId) => GetAllSteamAppManifestData()?.FirstOrDefault(appData => appData.AppId == appId);
}
}