Skip to content

Commit

Permalink
Add Steam++.Launcher.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed May 14, 2022
1 parent 0344682 commit 1499aa4
Show file tree
Hide file tree
Showing 25 changed files with 2,883 additions and 165 deletions.
19 changes: 12 additions & 7 deletions download-guide.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# 下载指南
- Desktop(桌面端)
- Windows
- 如果你使用 Intel、AMD 的 x64(x86-64) 芯片的 PC,则下载文件名中带有 **win_x64** 的文件
- 如果你 **已安装** 了 [ASP.NET Core 运行时 6.0.5](https://dotnet.microsoft.com/zh-cn/download/dotnet/6.0) 则下载文件名中带有 **fde(框架依赖)** 的文件
- 注意:是 《ASP.NET Core 运行时》 而不是 《.NET 桌面运行时》
- [在 Windows 上安装 .NET](https://docs.microsoft.com/zh-cn/dotnet/core/install/windows)
- 本程序在 Windows 上不需要 Hosting Bundle 和 IIS support
- [下载安装程序并手动安装(aspnetcore-runtime-6.0.5-win-x64.exe)](https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/runtime-aspnetcore-6.0.5-windows-x64-installer)
- [使用 PowerShell 自动化安装](https://docs.microsoft.com/zh-cn/dotnet/core/install/windows?tabs=net60#install-with-powershell-automation)
- 如果你使用 Intel、AMD 的 x64(x86-64/AMD64) 芯片的 PC,则下载文件名中带有 **win_x64** 的文件
- **框架依赖版(framework-dependent executable / fde)**
- 需要 **《ASP.NET Core 运行时 6.0.x》** 与 **《.NET 运行时 6.0.x》**,如果你 **已安装** 了相关运行时,则下载文件名中带有 **fde** 的文件,可减少本应用占用的磁盘空间
- 如果你 **未安装相关运行时则应下载文件名中不包含 fde 的文件**,或在 [此下载](https://dotnet.microsoft.com/zh-cn/download/dotnet/6.0) 最新的 6.0.x 运行时
- 在网页上点击 安装程序 x64 的链接即可下载,通常下载的文件名如下,将其安装后即可,无安装顺序要求
- dotnet-runtime-6.0.x-win-x64.exe (.NET 运行时 6.0.x)
- aspnetcore-runtime-6.0.x-win-x64.exe (ASP.NET Core 运行时 6.0.x)
- 其他也包含了所需的运行时的下载项,但不推荐仅为运行本应用而安装
- Hosting Bundle 还包含了本应用不需要的 IIS 运行时支持 (ASP.NET Core Module v2) 与 x86 的多个运行库
- SDK 包含了较多不需要的内容

- macOS
- 如果你使用 Intel 的 x64(x86-64) 芯片的 Mac,则下载文件名中带有 **macos_x64** 的文件
- 如果你使用 ARM64(Apple Silicon) 芯片的 Mac,例如 **Apple M1**,则下载文件名中带有 **macos_arm64** 的文件
Expand Down
Binary file added references/Steam++.Launcher.exe
Binary file not shown.
7 changes: 7 additions & 0 deletions references/Steam++.Launcher.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
<supportedRuntime version="v2.0.50727" />
</startup>
</configuration>
12 changes: 12 additions & 0 deletions src/FDELauncher/Compat/Contract.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace System.Diagnostics.Contracts
{
public static class Contract
{
[Conditional("DEBUG")]
[Conditional("CONTRACTS_FULL")]
public static void Assert(bool condition, string? userMessage)
{

}
}
}
17 changes: 17 additions & 0 deletions src/FDELauncher/Compat/Enumerable2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;

namespace System.Linq
{
public static class Enumerable2
{
public static IEnumerable<T> Append<T>(this IEnumerable<T> collection, T item) // https://github.com/iamandylamb/IEnumerable.Append/blob/master/src/Extension.cs
{
if (collection == null)
{
throw new ArgumentNullException("Collection should not be null");
}

return collection.Concat(Enumerable.Repeat(item, 1));
}
}
}
2,287 changes: 2,287 additions & 0 deletions src/FDELauncher/Compat/ValueTuple.cs

Large diffs are not rendered by default.

49 changes: 38 additions & 11 deletions src/FDELauncher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ static int Main(string[] args)
{
try
{
if (args.Length == 1 && args[0] == "--query")
{
var installed = RegistryQuery.GetAllInstalledBundles().ToArray();
var text = string.Join(Environment.NewLine, installed.Select(x => $"{x.DisplayName} [{x.Version.Type} {x.Version} {ToString(x.Arch)}]").ToArray());
MessageBox.Show(text, _ThisAssembly.AssemblyTrademark);
return 0;
}
if (!IsSupportedPlatform(out var error)) return ShowError(error);
var executivePath = GetExecutivePath();
if (!File.Exists(executivePath)) return ShowError(R.ExecutiveNotExistsFailure);
Expand Down Expand Up @@ -134,11 +141,21 @@ static BundleArch GetArchByPeHeader(string filePath)
/// </summary>
static void ShowRuntimeMissingFailure()
{
var text = String2.TryFormat(R.RuntimeMissingFailureFormat2,
var archStr = ToString(matchArch);
var runtimeVersionStr = runtimeVersion.ToString();
var _AspNetCoreRuntime = String2.TryFormat(
R.AspNetCoreRuntimeFormat2,
runtimeVersionStr,
archStr);
var _NetRuntime = String2.TryFormat(
R.NetRuntimeFormat2,
runtimeVersionStr,
archStr);
var _Runtime = $"{_AspNetCoreRuntime} {R.And} {_NetRuntime}";
var text = String2.TryFormat(
R.RuntimeMissingFailureFormat2,
_ThisAssembly.AssemblyTrademark,
String2.TryFormat(R.AspNetCoreRuntimeFormat2,
runtimeVersion.ToString(),
ToString(matchArch)));
_Runtime);
var result = MessageBox.Show(text, _ThisAssembly.AssemblyTrademark, MessageBoxButtons.YesNo, MessageBoxIcon.Error);
if (result == DialogResult.Yes)
{
Expand Down Expand Up @@ -179,13 +196,23 @@ static void OnError(Exception e)
/// <returns></returns>
static bool IsRuntimeInstalled(BundleArch matchArch, SemanticVersion runtimeVersion, SemanticVersion sdkVersion)
{
var installed = RegistryQuery.GetAllInstalledBundles();
var query = from m in installed
where m.Arch.HasFlags(matchArch) &&
((m.Version.Type == BundleType.AspNetRuntime && m.Version.SemVer >= runtimeVersion) ||
(m.Version.Type == BundleType.Sdk && m.Version.SemVer >= sdkVersion))
select m;
return query.Any();
// ArchiSteamFarm 依赖 ASP.NET Core
// ASP.NET Core 运行时安装程序除 Hosting Bundle 不包含 .NET 运行时 缺少文件 C:\Program Files\dotnet\host\fxr\{version}\hostfxr.dll
// 缺少 hostfxr.dll 会提示 To run this application, you must install .NET Desktop Runtime
// https://github.com/dotnet/runtime/blob/v6.0.5/src/native/corehost/apphost/apphost.windows.cpp#L62-L64
// https://github.com/dotnet/runtime/blob/v6.0.5/src/native/corehost/apphost/apphost.windows.cpp#L106-L113
var installed = RegistryQuery.GetAllInstalledBundles().Where(m => m.Arch.HasFlags(matchArch)).ToArray();

var query_sdk = installed.Where(m => m.Version.Type == BundleType.Sdk && m.Version.SemVer >= sdkVersion);
if (query_sdk.Any()) return true;

var query_runtime = installed.Where(m => (m.Version.Type == BundleType.Runtime || m.Version.Type == BundleType.WindowsDesktopRuntime) && m.Version.SemVer >= runtimeVersion);
if (!query_runtime.Any()) return false;

var query_aspnetruntime = installed.Where(m => m.Version.Type == BundleType.AspNetRuntime && m.Version.SemVer >= runtimeVersion);
if (!query_aspnetruntime.Any()) return false;

return true;
}

/// <summary>
Expand Down
19 changes: 19 additions & 0 deletions src/FDELauncher/Properties/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ public static string GetString(Func<Language, string> getString, CultureInfo? re
_ => "ASP.NET Core Runtime {0} ({1})",
});

public static string NetRuntimeFormat2 => GetString(l => l switch
{
Language.ChineseSimplified => ".NET 运行时 {0} ({1})",
Language.ChineseTraditional => ".NET 運行時 {0} ({1})",
Language.Japanese => ".NET ランタイム {0} ({1})",
_ => ".NET Runtime {0} ({1})",
});

public static string And => GetString(l => l switch
{
Language.ChineseSimplified or Language.ChineseTraditional => "和",
Language.Spanish => "y",
Language.Italian => "e",
Language.Japanese => "と",
Language.Korean => "및",
Language.Russian => "и",
_ => "and",
});

public static string ExecutiveNotExistsFailure => GetString(l => l switch
{
Language.ChineseSimplified => "主程序文件不存在,请重新下载或安装此应用。",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/FDELauncher/dotnet-core-uninstall/LocalizableStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,16 @@
<data name="InvalidInputVersionExceptionMessageFormat" xml:space="preserve">
<value>The specified version is not valid: "{0}".</value>
</data>
<data name="MacRuntimeRequirementExplainationString" xml:space="preserve">
<value>Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</value>
</data>
<data name="MacSDKRequirementExplainationString" xml:space="preserve">
<value>Used by Visual Studio for Mac. Specify individually or use —-force to remove</value>
</data>
<data name="UpperLimitRequirement" xml:space="preserve">
<value>Cannot uninstall version {0} and above</value>
</data>
<data name="WindowsRequirementExplainationString" xml:space="preserve">
<value>Used by Visual Studio{0}. Specify individually or use —-force to remove</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal enum BundleType
Sdk = 0x1,
Runtime = 0x2,
AspNetRuntime = 0x4,
HostingBundle = 0x8
HostingBundle = 0x8,
WindowsDesktopRuntime = 0x10,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;

namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning
{
internal class WindowsDesktopRuntimeVersion : BundleVersion, IComparable, IComparable<WindowsDesktopRuntimeVersion>, IEquatable<WindowsDesktopRuntimeVersion>
{
public override BundleType Type => BundleType.WindowsDesktopRuntime;
public override BeforePatch BeforePatch => new MajorMinorVersion(Major, Minor);

public WindowsDesktopRuntimeVersion() { }

public WindowsDesktopRuntimeVersion(string value) : base(value) { }

public int CompareTo(object obj)
{
return CompareTo(obj as WindowsDesktopRuntimeVersion);
}

public int CompareTo(WindowsDesktopRuntimeVersion? other)
{
return other == null ? 1 : SemVer.CompareTo(other.SemVer);
}

public override bool Equals(object obj)
{
return Equals(obj as WindowsDesktopRuntimeVersion);
}

public bool Equals(WindowsDesktopRuntimeVersion? other)
{
return other != null &&
base.Equals(other);
}

public override int GetHashCode()
{
return HashCode.Combine(base.GetHashCode());
}

public override Bundle ToBundle(BundleArch arch, string uninstallCommand, string displayName)
{
return new Bundle<WindowsDesktopRuntimeVersion>(this, arch, uninstallCommand, displayName);
}
}
}
31 changes: 31 additions & 0 deletions src/FDELauncher/dotnet-core-uninstall/Shared/Utils/RuntimeInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// https://github.com/dotnet/cli-lab/blob/1.5.255402/src/dotnet-core-uninstall/Shared/Utils/RuntimeInfo.cs

using System;

namespace Microsoft.DotNet.Tools.Uninstall.Shared.Utils
{
internal static class RuntimeInfo
{
static RuntimeInfo()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
RunningOnWindows = true;
break;
case PlatformID.Unix:
RunningOnLinux = true;
break;
case PlatformID.MacOSX:
RunningOnOSX = true;
break;
}
}

public static readonly bool RunningOnWindows;
public static readonly bool RunningOnOSX;
public static readonly bool RunningOnLinux;
}
}
Loading

0 comments on commit 1499aa4

Please sign in to comment.