mirror of
https://github.com/EpicMorg/SteamPathsLib.git
synced 2025-04-20 07:52:34 +03:00
Compare commits
No commits in common. "master" and "1.1.0.2" have entirely different histories.
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
@ -1,9 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: nuget
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
time: "02:00"
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: "develop"
|
|
40
.github/workflows/develop.yml
vendored
40
.github/workflows/develop.yml
vendored
@ -1,40 +0,0 @@
|
|||||||
name: SteamPathsLib - develop
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ develop ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set the value
|
|
||||||
run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@master
|
|
||||||
with:
|
|
||||||
clean: true
|
|
||||||
fetch-depth: 0
|
|
||||||
lfs: true
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
|
||||||
with:
|
|
||||||
vs-prerelease: true
|
|
||||||
msbuild-architecture: x86
|
|
||||||
|
|
||||||
- name: Setup NuGet
|
|
||||||
uses: NuGet/setup-nuget@v1
|
|
||||||
|
|
||||||
- name: Restore NuGet Packages
|
|
||||||
run: nuget restore src/EpicMorg.SteamPathsSolution.sln
|
|
||||||
|
|
||||||
- name: Build Debug
|
|
||||||
run: msbuild src/EpicMorg.SteamPathsSolution.sln /p:Configuration=Debug
|
|
40
.github/workflows/master.yml
vendored
40
.github/workflows/master.yml
vendored
@ -1,40 +0,0 @@
|
|||||||
name: SteamPathsLib - master
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set the value
|
|
||||||
run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@master
|
|
||||||
with:
|
|
||||||
clean: true
|
|
||||||
fetch-depth: 0
|
|
||||||
lfs: true
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
|
||||||
with:
|
|
||||||
vs-prerelease: true
|
|
||||||
msbuild-architecture: x86
|
|
||||||
|
|
||||||
- name: Setup NuGet
|
|
||||||
uses: NuGet/setup-nuget@v1
|
|
||||||
|
|
||||||
- name: Restore NuGet Packages
|
|
||||||
run: nuget restore src/EpicMorg.SteamPathsSolution.sln
|
|
||||||
|
|
||||||
- name: Build Release
|
|
||||||
run: msbuild src/EpicMorg.SteamPathsSolution.sln /p:Configuration=Release
|
|
43
.github/workflows/pr.yml
vendored
43
.github/workflows/pr.yml
vendored
@ -1,43 +0,0 @@
|
|||||||
name: SteamPathsLib - pull request to master
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Set the value
|
|
||||||
run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@master
|
|
||||||
with:
|
|
||||||
clean: true
|
|
||||||
fetch-depth: 0
|
|
||||||
lfs: true
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Add msbuild to PATH
|
|
||||||
uses: microsoft/setup-msbuild@v1.1
|
|
||||||
with:
|
|
||||||
vs-prerelease: true
|
|
||||||
msbuild-architecture: x86
|
|
||||||
|
|
||||||
- name: Setup NuGet
|
|
||||||
uses: NuGet/setup-nuget@v1
|
|
||||||
|
|
||||||
- name: Restore NuGet Packages
|
|
||||||
run: nuget restore src/EpicMorg.SteamPathsSolution.sln
|
|
||||||
|
|
||||||
- name: Build Debug
|
|
||||||
run: msbuild src/EpicMorg.SteamPathsSolution.sln /p:Configuration=Debug
|
|
||||||
|
|
||||||
- name: Build Release
|
|
||||||
run: msbuild src/EpicMorg.SteamPathsSolution.sln /p:Configuration=Release
|
|
@ -4,9 +4,3 @@
|
|||||||
* Added new info about steam and steam application
|
* Added new info about steam and steam application
|
||||||
* `1.1.0.1` Whats new:
|
* `1.1.0.1` Whats new:
|
||||||
* Add info directly from Steam
|
* Add info directly from Steam
|
||||||
* `1.1.0.2` Whats new:
|
|
||||||
* Fixed catching exceptions
|
|
||||||
* `1.1.0.3` Whats new:
|
|
||||||
* Fixed loading appmanifest data if we have an invalid *.acf.
|
|
||||||
* `1.1.0.4` Whats new:
|
|
||||||
* Code review and optimizations, dotNetCore support
|
|
29
nuget/EpicMorg.SteamPathsLib.nuspec
Normal file
29
nuget/EpicMorg.SteamPathsLib.nuspec
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||||
|
<metadata minClientVersion="3.3">
|
||||||
|
<id>EpicMorg.SteamPathsLib</id>
|
||||||
|
<title>Steam Paths Library</title>
|
||||||
|
<version>1.1.0.2</version>
|
||||||
|
<authors>EpicMorgDev, AurZum, stam</authors>
|
||||||
|
<owners>EpicMorgDev, AurZum, stam</owners>
|
||||||
|
<language>en-US</language>
|
||||||
|
<projectUrl>https://github.com/EpicMorg/SteamPathsLib</projectUrl>
|
||||||
|
<repository type="git" url="https://github.com/EpicMorg/SteamPathsLib.git" branch="master"/>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<icon>images\icon.png</icon>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<releaseNotes>Fixed catching exceptions.</releaseNotes>
|
||||||
|
<description>Small helper for getting some registry keys of Steam.</description>
|
||||||
|
<copyright>Copyright © 2020 EpicMorg</copyright>
|
||||||
|
<tags>steam epicmorg registry path helper vdf</tags>
|
||||||
|
<dependencies>
|
||||||
|
<group targetFramework=".NETFramework4.8.0">
|
||||||
|
<dependency id="Gameloop.Vdf" version="0.5.0" />
|
||||||
|
</group>
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="lib\net48\*.dll" target="lib\net48" />
|
||||||
|
<file src="images\*" target="images" />
|
||||||
|
</files>
|
||||||
|
</package>
|
6
nuget/build.ps1
Normal file
6
nuget/build.ps1
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Remove-Item './lib/net48/dummy_file' -Force
|
||||||
|
Remove-Item './*.nupkg' -Force
|
||||||
|
|
||||||
|
& nuget.exe pack ./EpicMorg.SteamPathsLib.nuspec
|
||||||
|
|
||||||
|
Copy-Item './dummy_file' -Destination './lib/net48/dummy_file' -Force
|
1
nuget/dummy_file
Normal file
1
nuget/dummy_file
Normal file
@ -0,0 +1 @@
|
|||||||
|
dummy_file
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
1
nuget/lib/net48/dummy_file
Normal file
1
nuget/lib/net48/dummy_file
Normal file
@ -0,0 +1 @@
|
|||||||
|
dummy_file
|
@ -1,39 +1,66 @@
|
|||||||
<Project Sdk="Microsoft.Net.Sdk">
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{E34AE985-7C7E-49BA-A2B0-70D88F865265}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>EpicMorg.SteamPathsLib</RootNamespace>
|
||||||
|
<AssemblyName>EpicMorg.SteamPathsLib</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>steam.ico</ApplicationIcon>
|
<ApplicationIcon>steam.ico</ApplicationIcon>
|
||||||
<TargetFrameworks>net46;net461;net462;net47;net471;net472;net48;netstandard1.3;netcoreapp3.1</TargetFrameworks>
|
|
||||||
<Company>EpicMorg</Company>
|
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
|
||||||
<RepositoryUrl>https://github.com/EpicMorg/SteamPathsLib</RepositoryUrl>
|
|
||||||
<PackageIcon>steam.png</PackageIcon>
|
|
||||||
<PackageProjectUrl>https://github.com/EpicMorg/SteamPathsLib</PackageProjectUrl>
|
|
||||||
<Copyright>Copyright © EpicMorg 2020</Copyright>
|
|
||||||
<AssemblyVersion>1.1.0.6</AssemblyVersion>
|
|
||||||
<FileVersion>1.1.0.6</FileVersion>
|
|
||||||
<Version>1.1.0.6</Version>
|
|
||||||
<Description>Small helper for getting some registry keys of Steam.</Description>
|
|
||||||
<SignAssembly>False</SignAssembly>
|
|
||||||
<Authors>EpicMorgDev, AurZum, stam, kasthack</Authors>
|
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<PackageTags>steam epicmorg registry path helper vdf</PackageTags>
|
|
||||||
<PackageReleaseNotes>Some of fixes</PackageReleaseNotes>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="steam.png">
|
<Reference Include="System" />
|
||||||
<Pack>True</Pack>
|
<Reference Include="System.Core" />
|
||||||
<PackagePath></PackagePath>
|
<Reference Include="System.Xml.Linq" />
|
||||||
</None>
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
|
<Reference Include="System.Data" />
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<Reference Include="System.Net.Http" />
|
||||||
<None Include="steam.ico">
|
<Reference Include="System.Xml" />
|
||||||
<Pack>True</Pack>
|
</ItemGroup>
|
||||||
</None>
|
<ItemGroup>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
|
<Compile Include="Model\ActiveProcessSteamRegistryData.cs" />
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<Compile Include="Model\ConfigSteamData.cs" />
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<Compile Include="Model\LibrarySteamData.cs" />
|
||||||
|
<Compile Include="Model\SteamAppManifestData.cs" />
|
||||||
|
<Compile Include="Model\SteamAppRegistryData.cs" />
|
||||||
|
<Compile Include="Model\SteamRegistryData.cs" />
|
||||||
|
<Compile Include="SteamPathsUtil.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="steam.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Gameloop.Vdf">
|
||||||
|
<Version>0.5.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@ -1,9 +1,15 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EpicMorg.SteamPathsLib.Model
|
||||||
{
|
{
|
||||||
public class ActiveProcessSteamRegistryData
|
public class ActiveProcessSteamRegistryData
|
||||||
{
|
{
|
||||||
public string RegistryKey { get; set; }
|
public string RegistryKey;
|
||||||
|
|
||||||
public int PID { get; set; }
|
public int PID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
{
|
using System.Collections.Generic;
|
||||||
public class ConfigSteamData
|
using System.Linq;
|
||||||
{
|
using System.Text;
|
||||||
public string[] SteamLibraryFolders { get; set; }
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EpicMorg.SteamPathsLib.Model {
|
||||||
|
public class ConfigSteamData {
|
||||||
|
public string[] SteamLibraryFolders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
{
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public class LibrarySteamData
|
namespace EpicMorg.SteamPathsLib.Model {
|
||||||
{
|
public class LibrarySteamData {
|
||||||
public List<SteamAppManifestData> AppManifestDataList { get; set; }
|
public string Path;
|
||||||
|
|
||||||
public string Path { get; set; }
|
public List<SteamAppManifestData> AppManifestDataList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
{
|
using System.Collections.Generic;
|
||||||
public class SteamAppManifestData
|
using System.Linq;
|
||||||
{
|
using System.Text;
|
||||||
public int AppId { get; set; }
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public string Name { get; set; }
|
namespace EpicMorg.SteamPathsLib.Model {
|
||||||
|
public class SteamAppManifestData {
|
||||||
|
public int AppId;
|
||||||
|
public string Name;
|
||||||
|
public string InstallDir;
|
||||||
|
|
||||||
public string InstallDir { get; set; }
|
public string Path;
|
||||||
|
|
||||||
public string Path { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EpicMorg.SteamPathsLib.Model
|
||||||
{
|
{
|
||||||
public class SteamAppRegistryData
|
public class SteamAppRegistryData
|
||||||
{
|
{
|
||||||
public bool Installed { get; set; }
|
public string RegistryKey;
|
||||||
|
public string Name;
|
||||||
|
|
||||||
public bool Running { get; set; }
|
public int AppId;
|
||||||
|
|
||||||
public bool Updating { get; set; }
|
public bool Installed;
|
||||||
|
public bool Runnig;
|
||||||
public int AppId { get; set; }
|
public bool Updating;
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public string RegistryKey { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
namespace EpicMorg.SteamPathsLib.Model
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EpicMorg.SteamPathsLib.Model
|
||||||
{
|
{
|
||||||
public class SteamRegistryData
|
public class SteamRegistryData
|
||||||
{
|
{
|
||||||
public string RegistryKey { get; set; }
|
public string RegistryKey;
|
||||||
|
public string LastGameNameUsed;
|
||||||
|
public string SourceModInstallPath;
|
||||||
|
public string SteamExe;
|
||||||
|
public string SteamPath;
|
||||||
|
public string Language;
|
||||||
|
public string PseudoUUID;
|
||||||
|
public string ModInstallPath;
|
||||||
|
|
||||||
public string LastGameNameUsed { get; set; }
|
public int RunningAppID;
|
||||||
|
|
||||||
public string SourceModInstallPath { get; set; }
|
public bool AlreadyRetriedOfflineMode;
|
||||||
|
public bool RememberPassword;
|
||||||
|
|
||||||
public string SteamExe { get; set; }
|
|
||||||
|
|
||||||
public string SteamPath { get; set; }
|
|
||||||
|
|
||||||
public string Language { get; set; }
|
|
||||||
|
|
||||||
public string PseudoUUID { get; set; }
|
|
||||||
|
|
||||||
public string ModInstallPath { get; set; }
|
|
||||||
|
|
||||||
public int RunningAppID { get; set; }
|
|
||||||
|
|
||||||
public bool AlreadyRetriedOfflineMode { get; set; }
|
|
||||||
|
|
||||||
public bool RememberPassword { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/EpicMorg.SteamPathsLib/Properties/AssemblyInfo.cs
Normal file
18
src/EpicMorg.SteamPathsLib/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("EpicMorg.SteamPathsLib")]
|
||||||
|
[assembly: AssemblyDescription("Steam Paths Library")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("EpicMorg")]
|
||||||
|
[assembly: AssemblyProduct("EpicMorg.SteamPathsLib")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © EpicMorg 2020")]
|
||||||
|
[assembly: AssemblyTrademark("Valve")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
[assembly: Guid("e34ae985-7c7e-49ba-a2b0-70d88f865265")]
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.1.0.2")]
|
||||||
|
[assembly: AssemblyFileVersion("1.1.0.2")]
|
@ -1,134 +1,142 @@
|
|||||||
namespace EpicMorg.SteamPathsLib
|
using System;
|
||||||
{
|
using System.Collections.Generic;
|
||||||
using System;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using System.IO;
|
using System.Text.RegularExpressions;
|
||||||
using System.Linq;
|
using EpicMorg.SteamPathsLib.Model;
|
||||||
using EpicMorg.SteamPathsLib.Model;
|
using Gameloop.Vdf;
|
||||||
using Gameloop.Vdf;
|
using Gameloop.Vdf.Linq;
|
||||||
using Gameloop.Vdf.Linq;
|
using Microsoft.Win32;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
public static class SteamPathsUtil
|
namespace EpicMorg.SteamPathsLib {
|
||||||
{
|
public class SteamPathsUtil {
|
||||||
private const string ValveKey = @"Software\Valve";
|
private static readonly string _valveKey = @"Software\Valve";
|
||||||
private const string ValveSteamKey = @"Software\Valve\Steam";
|
private static readonly string _valveSteamKey = @"Software\Valve\Steam";
|
||||||
private const string ValveSteamAppsKey = @"Software\Valve\Steam\Apps";
|
private static readonly string _valveSteamAppsKey = @"Software\Valve\Steam\Apps";
|
||||||
private const string ValveActiveProcessPID = @"Software\Valve\Steam\ActiveProcess";
|
private static readonly string _valveActiveProcessPID = @"Software\Valve\Steam\ActiveProcess";
|
||||||
|
|
||||||
private const string ValveSteamAppsPattern = @"Software\Valve\Steam\Apps\";
|
private static readonly string _valveSteamAppsPattern = @"Software\Valve\Steam\Apps\";
|
||||||
|
|
||||||
public static string GetValveKeyRegistry() => TryOrDefault(() => Registry.CurrentUser.OpenSubKey(ValveKey).ToString());
|
public static string GetValveKeyRegistry() {
|
||||||
|
try {
|
||||||
|
return Registry.CurrentUser.OpenSubKey(_valveKey).ToString();
|
||||||
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetSteamAppsKeyRegistry() => TryOrDefault(() => Registry.CurrentUser.OpenSubKey(ValveSteamAppsKey).ToString());
|
public static string GetSteamAppsKeyRegistry() {
|
||||||
|
try {
|
||||||
|
return Registry.CurrentUser.OpenSubKey(_valveSteamAppsKey).ToString();
|
||||||
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static ActiveProcessSteamRegistryData GetActiveProcessSteamData() => TryOrDefault(() =>
|
public static ActiveProcessSteamRegistryData GetActiveProcessSteamData() {
|
||||||
{
|
try {
|
||||||
using (var regData = Registry.CurrentUser.OpenSubKey(ValveActiveProcessPID))
|
var regData = Registry.CurrentUser.OpenSubKey(_valveActiveProcessPID);
|
||||||
{
|
|
||||||
return new ActiveProcessSteamRegistryData
|
|
||||||
{
|
|
||||||
RegistryKey = regData.ToString(),
|
|
||||||
PID = Convert.ToInt32(regData.GetValue("pid") ?? 0),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
public static SteamAppRegistryData GetSteamAppDataById(int appId) => TryOrDefault(() =>
|
var result = new ActiveProcessSteamRegistryData();
|
||||||
{
|
|
||||||
using (var regData = Registry.CurrentUser.OpenSubKey(ValveSteamAppsPattern + appId))
|
|
||||||
{
|
|
||||||
return new SteamAppRegistryData
|
|
||||||
{
|
|
||||||
RegistryKey = regData.ToString(),
|
|
||||||
Name = (regData.GetValue("Name") ?? string.Empty).ToString(),
|
|
||||||
|
|
||||||
AppId = appId,
|
result.RegistryKey = regData.ToString();
|
||||||
|
result.PID = Convert.ToInt32((regData.GetValue("pid") ?? 0));
|
||||||
|
|
||||||
Installed = (regData.GetValue("Installed") ?? 0).Equals(1),
|
return result;
|
||||||
Updating = (regData.GetValue("Updating") ?? 0).Equals(1),
|
} catch (Exception) {
|
||||||
Running = (regData.GetValue("Running") ?? 0).Equals(1),
|
return null;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
public static SteamRegistryData GetSteamData() => TryOrDefault(() =>
|
public static SteamAppRegistryData GetSteamAppDataById(int appId) {
|
||||||
{
|
var appKey = _valveSteamAppsPattern + appId;
|
||||||
using (var regData = Registry.CurrentUser.OpenSubKey(ValveSteamKey))
|
|
||||||
{
|
|
||||||
return new SteamRegistryData
|
|
||||||
{
|
|
||||||
RegistryKey = regData.ToString(),
|
|
||||||
LastGameNameUsed = (regData.GetValue("LastGameNameUsed") ?? string.Empty).ToString(),
|
|
||||||
SourceModInstallPath = (regData.GetValue("SourceModInstallPath") ?? string.Empty).ToString(),
|
|
||||||
SteamExe = (regData.GetValue("SteamExe") ?? string.Empty).ToString(),
|
|
||||||
SteamPath = (regData.GetValue("SteamPath") ?? string.Empty).ToString(),
|
|
||||||
Language = (regData.GetValue("Language") ?? string.Empty).ToString(),
|
|
||||||
PseudoUUID = (regData.GetValue("PseudoUUID") ?? string.Empty).ToString(),
|
|
||||||
ModInstallPath = (regData.GetValue("ModInstallPath") ?? string.Empty).ToString(),
|
|
||||||
|
|
||||||
RunningAppID = Convert.ToInt32((regData.GetValue("RunningAppID") ?? "0").ToString()),
|
|
||||||
|
|
||||||
RememberPassword = (regData.GetValue("RememberPassword") ?? 0).Equals(1),
|
|
||||||
AlreadyRetriedOfflineMode = (regData.GetValue("AlreadyRetriedOfflineMode") ?? 0).Equals(1),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
public static ConfigSteamData GetSteamConfig() => TryOrDefault(() =>
|
|
||||||
{
|
|
||||||
var result = new ConfigSteamData();
|
|
||||||
var libraryPaths = new List<string>();
|
|
||||||
|
|
||||||
var steamPath = new DirectoryInfo(GetSteamData().SteamPath).FullName;
|
|
||||||
var configPath = Path.Combine(steamPath, "config", "config.vdf");
|
|
||||||
|
|
||||||
libraryPaths.Add(Path.Combine(steamPath, "steamapps"));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
var regData = Registry.CurrentUser.OpenSubKey(appKey);
|
||||||
|
|
||||||
|
var result = new SteamAppRegistryData();
|
||||||
|
|
||||||
|
result.RegistryKey = regData.ToString();
|
||||||
|
result.Name = (regData.GetValue("Name") ?? "").ToString();
|
||||||
|
|
||||||
|
result.AppId = appId;
|
||||||
|
|
||||||
|
result.Installed = (regData.GetValue("Installed") ?? 0).Equals(1);
|
||||||
|
result.Updating = (regData.GetValue("Updating") ?? 0).Equals(1);
|
||||||
|
result.Runnig = (regData.GetValue("Running") ?? 0).Equals(1);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SteamRegistryData GetSteamData() {
|
||||||
|
try {
|
||||||
|
var regData = Registry.CurrentUser.OpenSubKey(_valveSteamKey);
|
||||||
|
|
||||||
|
var result = new SteamRegistryData();
|
||||||
|
|
||||||
|
result.RegistryKey = regData.ToString();
|
||||||
|
result.LastGameNameUsed = (regData.GetValue("LastGameNameUsed") ?? "").ToString();
|
||||||
|
result.SourceModInstallPath = (regData.GetValue("SourceModInstallPath") ?? "").ToString();
|
||||||
|
result.SteamExe = (regData.GetValue("SteamExe") ?? "").ToString();
|
||||||
|
result.SteamPath = (regData.GetValue("SteamPath") ?? "").ToString();
|
||||||
|
result.Language = (regData.GetValue("Language") ?? "").ToString();
|
||||||
|
result.PseudoUUID = (regData.GetValue("PseudoUUID") ?? "").ToString();
|
||||||
|
result.ModInstallPath = (regData.GetValue("ModInstallPath") ?? "").ToString();
|
||||||
|
|
||||||
|
result.RunningAppID = Convert.ToInt32((regData.GetValue("RunningAppID") ?? "0").ToString());
|
||||||
|
|
||||||
|
result.RememberPassword = (regData.GetValue("RememberPassword") ?? 0).Equals(1);
|
||||||
|
result.AlreadyRetriedOfflineMode = (regData.GetValue("AlreadyRetriedOfflineMode") ?? 0).Equals(1);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static ConfigSteamData GetSteamConfig() {
|
||||||
|
try {
|
||||||
|
var result = new ConfigSteamData();
|
||||||
|
var libraryPaths = new List<string>();
|
||||||
|
|
||||||
|
var steamPath = new DirectoryInfo(GetSteamData().SteamPath).FullName;
|
||||||
|
var configPath = Path.Combine(steamPath, "config", "config.vdf");
|
||||||
|
|
||||||
|
libraryPaths.Add(Path.Combine(steamPath, "steamapps"));
|
||||||
|
|
||||||
dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value;
|
dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value;
|
||||||
dynamic valve;
|
var configLibraryPaths = ((VObject)configObject.Software.Valve.Steam)
|
||||||
|
.Children()
|
||||||
try {
|
.Where(item => item.Key.StartsWith("BaseInstallFolder"))
|
||||||
valve = configObject.Software.Valve;
|
.Select(item => item.Value.ToString())
|
||||||
} catch {
|
.Select(line => new DirectoryInfo(line).FullName)
|
||||||
valve = configObject.Software.valve;
|
.Select(line => Path.Combine(line, "steamapps"));
|
||||||
}
|
|
||||||
|
|
||||||
var configLibraryPaths = ((VObject)valve.Steam)
|
|
||||||
.Children()
|
|
||||||
.Where(item => item.Key.StartsWith("BaseInstallFolder"))
|
|
||||||
.Select(item => item.Value.ToString())
|
|
||||||
.Select(line => new DirectoryInfo(line).FullName)
|
|
||||||
.Select(line => Path.Combine(line, "steamapps"));
|
|
||||||
|
|
||||||
libraryPaths.AddRange(configLibraryPaths);
|
libraryPaths.AddRange(configLibraryPaths);
|
||||||
} catch { }
|
|
||||||
|
|
||||||
result.SteamLibraryFolders = libraryPaths.ToArray();
|
result.SteamLibraryFolders = libraryPaths.ToArray();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
});
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static List<LibrarySteamData> GetLibrarySteamDataList() => TryOrDefault(() =>
|
public static List<LibrarySteamData> GetLibrarySteamDataList() {
|
||||||
{
|
try {
|
||||||
var configData = GetSteamConfig();
|
var configData = GetSteamConfig();
|
||||||
var result = new List<LibrarySteamData>();
|
var result = new List<LibrarySteamData>();
|
||||||
|
|
||||||
foreach (var path in configData.SteamLibraryFolders)
|
foreach (var path in configData.SteamLibraryFolders) {
|
||||||
{
|
var libraryData = new LibrarySteamData();
|
||||||
var libraryData = new LibrarySteamData
|
libraryData.Path = path;
|
||||||
{
|
libraryData.AppManifestDataList = new List<SteamAppManifestData>();
|
||||||
Path = path,
|
|
||||||
AppManifestDataList = new List<SteamAppManifestData>(),
|
|
||||||
};
|
|
||||||
|
|
||||||
var files = new DirectoryInfo(path).GetFiles("appmanifest_*.acf");
|
var files = new DirectoryInfo(path).GetFiles("appmanifest_*.acf");
|
||||||
|
|
||||||
foreach (var file in files)
|
foreach (var file in files) {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var appData = new SteamAppManifestData();
|
var appData = new SteamAppManifestData();
|
||||||
dynamic appManifestObject = VdfConvert.Deserialize(File.ReadAllText(file.FullName)).Value;
|
dynamic appManifestObject = VdfConvert.Deserialize(File.ReadAllText(file.FullName)).Value;
|
||||||
|
|
||||||
@ -140,44 +148,32 @@
|
|||||||
|
|
||||||
libraryData.AppManifestDataList.Add(appData);
|
libraryData.AppManifestDataList.Add(appData);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
result.Add(libraryData);
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Add(libraryData);
|
return result;
|
||||||
}
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
return result;
|
|
||||||
});
|
|
||||||
|
|
||||||
public static List<SteamAppManifestData> GetAllSteamAppManifestData() => TryOrDefault(() =>
|
|
||||||
{
|
|
||||||
var result = new List<SteamAppManifestData>();
|
|
||||||
|
|
||||||
var libraries = GetLibrarySteamDataList();
|
|
||||||
|
|
||||||
foreach (var library in libraries)
|
|
||||||
{
|
|
||||||
result.AddRange(library.AppManifestDataList);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
|
|
||||||
public static SteamAppManifestData GetSteamAppManifestDataById(int appId) => GetAllSteamAppManifestData()?.FirstOrDefault(appData => appData.AppId == appId);
|
|
||||||
|
|
||||||
private static T TryOrDefault<T>(Func<T> action)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return action();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<SteamAppManifestData> GetAllSteamAppManifestData() {
|
||||||
|
try {
|
||||||
|
var result = new List<SteamAppManifestData>();
|
||||||
|
|
||||||
|
var libraries = GetLibrarySteamDataList();
|
||||||
|
|
||||||
|
foreach (var library in libraries) {
|
||||||
|
result.AddRange(library.AppManifestDataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SteamAppManifestData GetSteamAppManifestDataById(int appId) => GetAllSteamAppManifestData()?.FirstOrDefault(appData => appData.AppId == appId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ namespace SteamTest
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
textBoxTestAppId.Value = (decimal)SOURCE_SDK_BASE_2013_SINGLEPLAYER_APP_ID;
|
textBoxTestAppId.Value = (decimal)SOURCE_SDK_BASE_2013_SINGLEPLAYER_APP_ID;
|
||||||
this.Text = Text + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
this.Text = Text + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FrmMain_Load(object sender, EventArgs e)
|
private void FrmMain_Load(object sender, EventArgs e)
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SteamTest
|
namespace SteamTest
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.4")]
|
[assembly: AssemblyVersion("1.0.0.2")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.4")]
|
[assembly: AssemblyFileVersion("1.0.0.2")]
|
||||||
|
2
src/SteamTest/Properties/Resources.Designer.cs
generated
2
src/SteamTest/Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace SteamTest.Properties {
|
|||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
||||||
|
2
src/SteamTest/Properties/Settings.Designer.cs
generated
2
src/SteamTest/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace SteamTest.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user