diff --git a/src/EpicMorg.SteamPathsLib/EpicMorg.SteamPathsLib.csproj b/src/EpicMorg.SteamPathsLib/EpicMorg.SteamPathsLib.csproj
index 22fd296..d787fff 100644
--- a/src/EpicMorg.SteamPathsLib/EpicMorg.SteamPathsLib.csproj
+++ b/src/EpicMorg.SteamPathsLib/EpicMorg.SteamPathsLib.csproj
@@ -41,7 +41,7 @@
-
+
diff --git a/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs b/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs
index 72cc86a..d0dcf49 100644
--- a/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs
+++ b/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs
@@ -1,12 +1,159 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Microsoft.Win32;
namespace EpicMorg.SteamPathsLib
{
public class SteamPathsUtil
{
+ private static readonly string _valveKey = @"Software\Valve";
+ private static readonly string _valveSteamKey = @"Software\Valve\Steam";
+ private static readonly string _valveSteamAppsKey = @"Software\Valve\Steam\Apps";
+ private static readonly string _valveActiveProcessPID = @"Software\Valve\Steam\ActiveProcess";
+
+ private static readonly string _valveSteamAppsPattern = @"Software\Valve\Steam\Apps\";
+
+ public static Dictionary GetInfo()
+ {
+ var result = new Dictionary();
+
+ result["ValveKeyRegistry"] = GetValveKeyRegistry();
+ result["SteamKeyRegistry"] = GetSteamKeyRegistry();
+ result["SteamAppsKeyRegistry"] = GetSteamAppsKeyRegistry();
+ result["SteamDirectoryPath"] = GetSteamDirectoryPath();
+ result["SteamExePath"] = GetSteamExePath();
+ result["SteamExePid"] = GetSteamExePid();
+ result["OriginalSourceModDirectoryPath"] = GetOriginalSourceModDirectoryPath();
+
+ return result;
+ }
+
+ public static string GetValveKeyRegistry()
+ {
+ try
+ {
+ return Registry.CurrentUser.OpenSubKey(_valveKey).ToString();
+ }
+ catch (Exception)
+ {
+ return null;
+ };
+ }
+
+ public static string GetSteamKeyRegistry()
+ {
+ try
+ {
+ return Registry.CurrentUser.OpenSubKey(_valveSteamKey).ToString();
+ }
+ catch (Exception)
+ {
+ return null;
+ };
+ }
+
+ public static string GetSteamAppsKeyRegistry()
+ {
+ try
+ {
+ return Registry.CurrentUser.OpenSubKey(_valveSteamAppsKey).ToString();
+ }
+ catch (Exception)
+ {
+ return null;
+ };
+ }
+
+ public static string GetSteamDirectoryPath()
+ {
+ try
+ {
+ using (var key = Registry.CurrentUser.OpenSubKey(_valveSteamKey))
+ {
+ var path = key.GetValue("SteamPath").ToString();
+ if (path != @"")
+ {
+ return path;
+ }
+ }
+ }
+ catch (Exception) { };
+
+ return null;
+ }
+
+ public static string GetSteamExePath()
+ {
+ try
+ {
+ using (var key = Registry.CurrentUser.OpenSubKey(_valveSteamKey))
+ {
+ var path = key.GetValue("SteamExe").ToString();
+ if (path != @"")
+ {
+ return path;
+ }
+ }
+ }
+ catch (Exception) { };
+
+ return null;
+ }
+
+ public static string GetSteamExePid()
+ {
+ try
+ {
+ using (var key = Registry.CurrentUser.OpenSubKey(_valveActiveProcessPID))
+ {
+ var pid = key.GetValue("pid").ToString();
+ if (pid != @"0")
+ {
+ return pid;
+ }
+ }
+ }
+ catch (Exception) { };
+
+ return null;
+ }
+
+ public static string GetOriginalSourceModDirectoryPath()
+ {
+ try
+ {
+ using (var key = Registry.CurrentUser.OpenSubKey(_valveSteamKey))
+ {
+ var path = key.GetValue("SourceModInstallPath").ToString();
+ if (path != @"")
+ {
+ return path;
+ }
+ }
+ }
+ catch (Exception) { };
+
+ return null;
+ }
+
+ public static bool IsInstalledApps(int number)
+ {
+ try
+ {
+ var appKey = _valveSteamAppsPattern + number;
+
+ using (var key = Registry.CurrentUser.OpenSubKey(appKey))
+ {
+ var installedValue = key.GetValue("Installed");
+ if (installedValue.Equals(1))
+ {
+ return true;
+ }
+ }
+ }
+ catch (Exception) { };
+
+ return false;
+ }
}
}
diff --git a/src/EpicMorg.SteamPathsSolution.sln b/src/EpicMorg.SteamPathsSolution.sln
index cb628f8..3508b67 100644
--- a/src/EpicMorg.SteamPathsSolution.sln
+++ b/src/EpicMorg.SteamPathsSolution.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamPathsLib", "SteamPathsLib\SteamPathsLib.csproj", "{00E7A45F-69F7-41FC-B2A7-566E2904E49B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EpicMorg.SteamPathsLib", "EpicMorg.SteamPathsLib\EpicMorg.SteamPathsLib.csproj", "{E34AE985-7C7E-49BA-A2B0-70D88F865265}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,10 +11,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {00E7A45F-69F7-41FC-B2A7-566E2904E49B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {00E7A45F-69F7-41FC-B2A7-566E2904E49B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {00E7A45F-69F7-41FC-B2A7-566E2904E49B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {00E7A45F-69F7-41FC-B2A7-566E2904E49B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E34AE985-7C7E-49BA-A2B0-70D88F865265}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E34AE985-7C7E-49BA-A2B0-70D88F865265}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E34AE985-7C7E-49BA-A2B0-70D88F865265}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E34AE985-7C7E-49BA-A2B0-70D88F865265}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE