Compare commits

...

43 Commits

Author SHA1 Message Date
bccd9b1bec
Merge branch 'develop' 2022-04-13 22:28:57 +03:00
4bc5e0cf38
bump versions 2022-04-13 22:28:42 +03:00
d3d7aba0e8
Merge branch 'master' into develop 2022-04-13 22:09:54 +03:00
08b0736521
gha 2022-04-13 22:09:08 +03:00
fd3cf4fa22
Merge branch 'master' into develop 2022-04-13 22:06:35 +03:00
44c8097599
Update dotnet-core.yml 2020-09-18 20:18:12 +03:00
5f9e2a0542
Create dotnet-core.yml 2020-09-18 20:02:18 +03:00
0eded93505
Merge pull request #11 from EpicMorg/dependabot/nuget/Gameloop.Vdf-0.6.1
Bump Gameloop.Vdf from 0.5.0 to 0.6.1
2020-09-18 19:56:11 +03:00
57655e7744
Merge pull request #10 from EpicMorg/dependabot/add-v2-config-file
Create Dependabot config file
2020-09-18 19:55:46 +03:00
dependabot-preview[bot]
428ba714e6
Bump Gameloop.Vdf from 0.5.0 to 0.6.1
Bumps [Gameloop.Vdf](https://github.com/shravan2x/Gameloop.Vdf) from 0.5.0 to 0.6.1.
- [Release notes](https://github.com/shravan2x/Gameloop.Vdf/releases)
- [Commits](https://github.com/shravan2x/Gameloop.Vdf/compare/v0.5.0...v0.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-18 16:54:57 +00:00
dependabot-preview[bot]
1daa6bb5ad
Create Dependabot config file 2020-09-18 16:54:09 +00:00
AlexZ
df130b7ead Update EpicMorg.SteamPathsLib.csproj 2020-06-11 19:21:35 +03:00
Alex_Z
ac26ae83e9
Merge pull request #9 from EpicMorg/develop
Develop
2020-06-10 23:32:36 +03:00
AlexZ
3aa8aec61e Update SteamPathsUtil.cs
* fix parser
2020-05-30 13:36:59 +03:00
AlexZ
3957f87103 Update SteamPathsUtil.cs
* fix read steam config
2020-05-29 23:15:31 +03:00
55f2c00ee7
Merge pull request #7 from EpicMorg/develop
Develop
2020-03-19 12:47:09 +03:00
614275b3be
Merge pull request #6 from EpicMorg/feature/netcore
Feature/netcore
2020-03-19 12:46:20 +03:00
7db191cf39 Update EpicMorg.SteamPathsLib.csproj 2020-03-19 12:45:29 +03:00
Konstantin Safonov
18f13665cb Code cleanup 2020-03-18 01:36:10 +03:00
Konstantin Safonov
5006877670 Migrate to .net core sdk 2020-03-18 01:14:41 +03:00
1149709d03 Fixed loading appmanifest data if we have an invalid *.acf. 2020-02-26 00:39:53 +03:00
e9dc3f0c72 fix load appmanifest data if invalid acf
fix load appmanifest data if invalid acf
2020-02-26 00:31:52 +03:00
16878cbb32 Update FrmMain.cs
- deleted ;
2020-02-26 00:31:14 +03:00
0c6f564692 1.1.0.2 2020-02-04 00:46:02 +03:00
AlexZ
08659b463b fix catching exception 2020-02-03 13:13:35 +03:00
e33f0b6d12
Update README.md 2020-01-30 22:58:37 +03:00
8ae229d997
Update README.md 2020-01-30 22:56:08 +03:00
e039d0a12b
Update FUNDING.yml 2020-01-30 02:07:40 +03:00
9350e8904d
Update README.md 2020-01-30 01:51:31 +03:00
710d9f05a2
Update README.md 2020-01-30 01:51:06 +03:00
6e0c391d4d
Update README.md 2020-01-30 01:50:23 +03:00
bcdb7e9c38
Update README.md 2020-01-30 01:49:26 +03:00
78788c7db8
Update README.md 2020-01-30 01:48:59 +03:00
cd2e69bf91
Update README.md 2020-01-30 01:44:02 +03:00
5351f1e20a bump to version 1.1.01 2020-01-28 01:15:59 +03:00
AlexZ
e60a695b83 Add info directly from Steam 2020-01-27 04:34:34 +03:00
9b2de02338
Create FUNDING.yml 2020-01-17 01:33:30 +03:00
93bf62ddaf
Merge pull request #2 from EpicMorg/develop
Develop
2020-01-14 14:03:49 +03:00
d34d4798e8
Update README.md 2020-01-14 14:03:24 +03:00
5b96bcc6a3
Delete .travis.yml 2020-01-14 14:02:08 +03:00
45900b2544
Update README.md 2020-01-14 13:58:41 +03:00
cf696e67cf
Delete .travis.yml 2020-01-14 13:58:12 +03:00
Alex_Z
f0efdca7ee
fix description 2020-01-09 17:44:40 +03:00
33 changed files with 447 additions and 308 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
patreon: epicmorg
ko_fi: epicmorg
custom: https://ko-fi.com/alexz696
#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#open_collective: # Replace with a single Open Collective username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

9
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,9 @@
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 Normal file
View File

@ -0,0 +1,40 @@
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 Normal file
View File

@ -0,0 +1,40 @@
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 Normal file
View File

@ -0,0 +1,43 @@
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

View File

@ -1,13 +0,0 @@
#os: windows
#language: csharp
#solution: src/EpicMorg.SteamPathsSolution.sln
#services:
# - nuget
#install:
# - nuget restore src/EpicMorg.SteamPathsSolution.sln
#matrix:
# include:
# name: Library Build
# script:
# - msbuild /p:Configuration=Release src/EpicMorg.SteamPathsSolution.sln

View File

@ -2,3 +2,11 @@
* `1.1.0.0` Whats new:
* Refractoring API
* Added new info about steam and steam application
* `1.1.0.1` Whats new:
* 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

View File

@ -1,6 +1,8 @@
# SteamPathsLib
# [![Travis (.org)](https://img.shields.io/travis/EpicMorg/SteamPathsLib?style=flat-square)](https://travis-ci.org/EpicMorg/SteamPathsLib) [![Nuget](https://img.shields.io/nuget/v/EpicMorg.SteamPathsLib?style=flat-square)](https://www.nuget.org/packages/EpicMorg.SteamPathsLib/) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/stargazers) [![GitHub license](https://img.shields.io/github/license/EpicMorg/SteamPathsLib.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md)
# [![AppVeyor](https://img.shields.io/appveyor/ci/stamepicmorg/steampathslib?style=flat-square)](https://ci.appveyor.com/project/stamepicmorg/steampathslib) [![Nuget](https://img.shields.io/nuget/v/EpicMorg.SteamPathsLib?style=flat-square)](https://www.nuget.org/packages/EpicMorg.SteamPathsLib/) [![Size](https://img.shields.io/github/repo-size/EpicMorg/SteamPathsLib?label=size&style=flat-square)](https://github.com/EpicMorg/SteamPathsLib/archive/master.zip) [![Release](https://img.shields.io/github/v/release/EpicMorg/SteamPathsLib?style=flat-square)](https://github.com/EpicMorg/SteamPathsLib/releases) [![GitHub license](https://img.shields.io/github/license/EpicMorg/SteamPathsLib.svg?style=popout-square)](LICENSE.md) [![Changelog](https://img.shields.io/badge/Changelog-yellow.svg?style=popout-square)](CHANGELOG.md) [![Activity](https://img.shields.io/github/commit-activity/w/EpicMorg/SteamPathsLib?&style=flat-square)](https://github.com/EpicMorg/SteamPathsLib/commits) [![GitHub issues](https://img.shields.io/github/issues/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/issues) [![GitHub forks](https://img.shields.io/github/forks/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/network) [![GitHub stars](https://img.shields.io/github/stars/EpicMorg/SteamPathsLib.svg?style=popout-square)](https://github.com/EpicMorg/SteamPathsLib/stargazers) [![GitHub uses](https://img.shields.io/sourcegraph/rrc/github.com/EpicMorg/SteamPathsLib?style=flat-square)](https://github.com/EpicMorg/SteamPathsLib/pulse) [![CodeScene Code Health](https://codescene.io/projects/6853/status-badges/code-health)](https://codescene.io/projects/6853) [![CodeScene System Mastery](https://codescene.io/projects/6853/status-badges/system-mastery)](https://codescene.io/projects/6853)
[![](https://codescene.io/projects/6853/status.svg)](https://codescene.io/projects/6853/jobs/latest-successful/results)
# Usage

View File

@ -1,33 +0,0 @@
<?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.0</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>Refractoring API. Added new info about steam and steam application.</releaseNotes>
<description>Small helper for getting som registry keys of Steam.</description>
<copyright>Copyright ©2020 EpicMorg</copyright>
<tags>steam epicmorg registry path helper</tags>
<dependencies>
<group targetFramework=".NETFramework4.8.0" />
<group targetFramework=".NETFramework4.7.2" />
<group targetFramework=".NETFramework4.6.2" />
<group targetFramework=".NETFramework4.5.2" />
</dependencies>
</metadata>
<files>
<file src="lib\net48\*.dll" target="lib\net48" />
<file src="lib\net472\*.dll" target="lib\net472" />
<file src="lib\net462\*.dll" target="lib\net462" />
<file src="lib\net452\*.dll" target="lib\net452" />
<file src="images\*" target="images" />
</files>
</package>

View File

@ -1,12 +0,0 @@
Remove-Item './lib/net48/dummy_file' -Force
Remove-Item './lib/net472/dummy_file' -Force
Remove-Item './lib/net462/dummy_file' -Force
Remove-Item './lib/net452/dummy_file' -Force
Remove-Item './*.nupkg' -Force
& nuget.exe pack ./EpicMorg.SteamPathsLib.nuspec
Copy-Item './dummy_file' -Destination './lib/net48/dummy_file' -Force
Copy-Item './dummy_file' -Destination './lib/net472/dummy_file' -Force
Copy-Item './dummy_file' -Destination './lib/net462/dummy_file' -Force
Copy-Item './dummy_file' -Destination './lib/net452/dummy_file' -Force

View File

@ -1 +0,0 @@
dummy_file

View File

@ -1 +0,0 @@
dummy_file

View File

@ -1 +0,0 @@
dummy_file

View File

@ -1 +0,0 @@
dummy_file

View File

@ -1 +0,0 @@
dummy_file

View File

@ -1,58 +1,39 @@
<?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>
<Project Sdk="Microsoft.Net.Sdk">
<PropertyGroup>
<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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<None Include="steam.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<None Include="steam.ico">
<Pack>True</Pack>
</None>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="model\ActiveProcessSteamData.cs" />
<Compile Include="model\SteamAppData.cs" />
<Compile Include="model\SteamData.cs" />
<Compile Include="SteamPathsUtil.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="steam.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,9 @@
namespace EpicMorg.SteamPathsLib.Model
{
public class ActiveProcessSteamRegistryData
{
public string RegistryKey { get; set; }
public int PID { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace EpicMorg.SteamPathsLib.Model
{
public class ConfigSteamData
{
public string[] SteamLibraryFolders { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace EpicMorg.SteamPathsLib.Model
{
using System.Collections.Generic;
public class LibrarySteamData
{
public List<SteamAppManifestData> AppManifestDataList { get; set; }
public string Path { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace EpicMorg.SteamPathsLib.Model
{
public class SteamAppManifestData
{
public int AppId { get; set; }
public string Name { get; set; }
public string InstallDir { get; set; }
public string Path { get; set; }
}
}

View File

@ -0,0 +1,17 @@
namespace EpicMorg.SteamPathsLib.Model
{
public class SteamAppRegistryData
{
public bool Installed { get; set; }
public bool Running { get; set; }
public bool Updating { get; set; }
public int AppId { get; set; }
public string Name { get; set; }
public string RegistryKey { get; set; }
}
}

View File

@ -0,0 +1,27 @@
namespace EpicMorg.SteamPathsLib.Model
{
public class SteamRegistryData
{
public string RegistryKey { get; set; }
public string LastGameNameUsed { get; set; }
public string SourceModInstallPath { get; set; }
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; }
}
}

View File

@ -1,18 +0,0 @@
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.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@ -1,116 +1,182 @@
using System;
using System.Collections.Generic;
using EpicMorg.SteamPathsLib.model;
using Microsoft.Win32;
namespace EpicMorg.SteamPathsLib
namespace EpicMorg.SteamPathsLib
{
public class SteamPathsUtil
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using EpicMorg.SteamPathsLib.Model;
using Gameloop.Vdf;
using Gameloop.Vdf.Linq;
using Microsoft.Win32;
public static 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 const string ValveKey = @"Software\Valve";
private const string ValveSteamKey = @"Software\Valve\Steam";
private const string ValveSteamAppsKey = @"Software\Valve\Steam\Apps";
private const string ValveActiveProcessPID = @"Software\Valve\Steam\ActiveProcess";
private static readonly string _valveSteamAppsPattern = @"Software\Valve\Steam\Apps\";
private const string ValveSteamAppsPattern = @"Software\Valve\Steam\Apps\";
public static string GetValveKeyRegistry()
public static string GetValveKeyRegistry() => TryOrDefault(() => Registry.CurrentUser.OpenSubKey(ValveKey).ToString());
public static string GetSteamAppsKeyRegistry() => TryOrDefault(() => Registry.CurrentUser.OpenSubKey(ValveSteamAppsKey).ToString());
public static ActiveProcessSteamRegistryData GetActiveProcessSteamData() => TryOrDefault(() =>
{
using (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(() =>
{
using (var regData = Registry.CurrentUser.OpenSubKey(ValveSteamAppsPattern + appId))
{
return new SteamAppRegistryData
{
RegistryKey = regData.ToString(),
Name = (regData.GetValue("Name") ?? string.Empty).ToString(),
AppId = appId,
Installed = (regData.GetValue("Installed") ?? 0).Equals(1),
Updating = (regData.GetValue("Updating") ?? 0).Equals(1),
Running = (regData.GetValue("Running") ?? 0).Equals(1),
};
}
});
public static SteamRegistryData GetSteamData() => TryOrDefault(() =>
{
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 {
dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value;
dynamic valve;
try {
valve = configObject.Software.Valve;
} catch {
valve = configObject.Software.valve;
}
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);
} catch { }
result.SteamLibraryFolders = libraryPaths.ToArray();
return result;
});
public static List<LibrarySteamData> GetLibrarySteamDataList() => TryOrDefault(() =>
{
var configData = GetSteamConfig();
var result = new List<LibrarySteamData>();
foreach (var path in configData.SteamLibraryFolders)
{
var libraryData = new LibrarySteamData
{
Path = path,
AppManifestDataList = new List<SteamAppManifestData>(),
};
var files = new DirectoryInfo(path).GetFiles("appmanifest_*.acf");
foreach (var file in files)
{
try
{
var appData = new SteamAppManifestData();
dynamic appManifestObject = VdfConvert.Deserialize(File.ReadAllText(file.FullName)).Value;
appData.AppId = Convert.ToInt32(appManifestObject.appid.Value);
appData.Name = appManifestObject.name.Value;
appData.InstallDir = appManifestObject.installdir.Value;
appData.Path = Path.Combine(path, "common", appData.InstallDir);
libraryData.AppManifestDataList.Add(appData);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
result.Add(libraryData);
}
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 Registry.CurrentUser.OpenSubKey(_valveKey).ToString();
return action();
}
catch (Exception)
catch
{
return null;
};
}
public static string GetSteamAppsKeyRegistry()
{
try
{
return Registry.CurrentUser.OpenSubKey(_valveSteamAppsKey).ToString();
}
catch (Exception)
{
return null;
};
}
public static ActiveProcessSteamData GetActiveProcessSteamData()
{
try
{
var regData = Registry.CurrentUser.OpenSubKey(_valveActiveProcessPID);
var result = new ActiveProcessSteamData();
result.RegistryKey = regData.ToString();
result.PID = Convert.ToInt32((regData.GetValue("pid") ?? 0));
return result;
}
catch (Exception)
{
return null;
}
}
public static SteamAppData GetSteamAppDataById(int appId)
{
var appKey = _valveSteamAppsPattern + appId;
try
{
var regData = Registry.CurrentUser.OpenSubKey(appKey);
var result = new SteamAppData();
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 SteamData GetSteamData()
{
try
{
var regData = Registry.CurrentUser.OpenSubKey(_valveSteamKey);
var result = new SteamData();
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;
return default;
}
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EpicMorg.SteamPathsLib.model
{
public class ActiveProcessSteamData
{
public string RegistryKey;
public int PID;
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EpicMorg.SteamPathsLib.model
{
public class SteamAppData
{
public string RegistryKey;
public string Name;
public int AppId;
public bool Installed;
public bool Runnig;
public bool Updating;
}
}

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EpicMorg.SteamPathsLib.model
{
public class SteamData
{
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 int RunningAppID;
public bool AlreadyRetriedOfflineMode;
public bool RememberPassword;
}
}

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -33,7 +33,6 @@ namespace SteamTest
InitializeComponent();
textBoxTestAppId.Value = (decimal)SOURCE_SDK_BASE_2013_SINGLEPLAYER_APP_ID;
this.Text = Text + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
;
}
private void FrmMain_Load(object sender, EventArgs e)

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SteamTest

View File

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@ -32,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
[assembly: AssemblyVersion("1.0.0.4")]
[assembly: AssemblyFileVersion("1.0.0.4")]

View File

@ -19,7 +19,7 @@ namespace SteamTest.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

View File

@ -12,7 +12,7 @@ namespace SteamTest.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));