Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
SteamTools
提交
3bd116ca
S
SteamTools
项目概览
jobily
/
SteamTools
10 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SteamTools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3bd116ca
编写于
8月 21, 2023
作者:
A
Aigio Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🎨
Misc
上级
f3ff7852
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
204 addition
and
49 deletion
+204
-49
WattToolkit.snk
WattToolkit.snk
+0
-0
res/windows/Steam++.apphost
res/windows/Steam++.apphost
+0
-0
src/AssemblyInfo.Constants.cs
src/AssemblyInfo.Constants.cs
+4
-7
src/BD.WTTS.Client.AppHost/App.config
src/BD.WTTS.Client.AppHost/App.config
+3
-0
src/BD.WTTS.Client.AppHost/BD.WTTS.Client.AppHost.csproj
src/BD.WTTS.Client.AppHost/BD.WTTS.Client.AppHost.csproj
+9
-0
src/BD.WTTS.Client.AppHost/Program.cs
src/BD.WTTS.Client.AppHost/Program.cs
+112
-33
src/BD.WTTS.Client.Tools.Publish/Helpers/ObfuscarHelper.cs
src/BD.WTTS.Client.Tools.Publish/Helpers/ObfuscarHelper.cs
+4
-3
src/BD.WTTS.Client/Services/Platform/IPlatformService.OS.Linux.cs
...TTS.Client/Services/Platform/IPlatformService.OS.Linux.cs
+67
-2
src/BD.WTTS.Client/UI/ViewModels/Pages/AboutPageViewModel.EasterEgg.cs
...lient/UI/ViewModels/Pages/AboutPageViewModel.EasterEgg.cs
+1
-1
src/BD.WTTS.Client/UI/ViewModels/Pages/AboutPageViewModel.cs
src/BD.WTTS.Client/UI/ViewModels/Pages/AboutPageViewModel.cs
+2
-3
src/BD.WTTS.Client/UI/ViewModels/Windows/Main/MainWindowViewModel.cs
....Client/UI/ViewModels/Windows/Main/MainWindowViewModel.cs
+2
-0
未找到文件。
WattToolkit.snk
0 → 100644
浏览文件 @
3bd116ca
文件已添加
res/windows/Steam++.apphost
0 → 100644
浏览文件 @
3bd116ca
文件已添加
src/AssemblyInfo.Constants.cs
浏览文件 @
3bd116ca
...
...
@@ -94,24 +94,20 @@ false
#endif
#if !APP_HOST
#
region
Modules
/
Plugins
public
const
string
Accelerator
=
"Accelerator"
;
#if !APP_HOST
public
const
string
GameAccount
=
"GameAccount"
;
public
const
string
GameList
=
"GameList"
;
public
const
string
SteamIdleCard
=
"SteamIdleCard"
;
#endif
public
const
string
ArchiSteamFarmPlus
=
"ArchiSteamFarmPlus"
;
#if !APP_HOST
public
const
string
Authenticator
=
"Authenticator"
;
public
const
string
GameTools
=
"GameTools"
;
...
...
@@ -126,8 +122,9 @@ false
public
const
string
AuthenticatorId
=
"00000000-0000-0000-0000-000000000005"
;
public
const
string
GameToolsId
=
"00000000-0000-0000-0000-000000000006"
;
public
const
string
SteamIdleCardId
=
"00000000-0000-0000-0000-000000000007"
;
#endif
#
endregion
#endif
}
\ No newline at end of file
src/BD.WTTS.Client.AppHost/App.config
浏览文件 @
3bd116ca
...
...
@@ -9,4 +9,7 @@
<
GCConserveMemory
enabled
=
"9"
/>
<
legacyCorruptedStateExceptionsPolicy
enabled
=
"true"
/>
</
runtime
>
<
appSettings
>
<
add
key
=
"d"
value
=
"7.0.10"
/>
</
appSettings
>
</
configuration
>
\ No newline at end of file
src/BD.WTTS.Client.AppHost/BD.WTTS.Client.AppHost.csproj
浏览文件 @
3bd116ca
...
...
@@ -22,6 +22,15 @@
<ApplicationIcon Condition="'$(Configuration)'=='Debug'">..\..\res\icons\app\v3\Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net4')) OR $(TargetFramework.StartsWith('net3')) ">
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\WattToolkit.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) OR $(TargetFramework.StartsWith('net3')) ">
<Reference Include="System.Configuration" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<AllowedReferenceRelatedFileExtensions>
<!-- Prevent default XML and PDB files copied to output in RELEASE.
...
...
src/BD.WTTS.Client.AppHost/Program.cs
浏览文件 @
3bd116ca
...
...
@@ -3,6 +3,9 @@
// https://github.com/dotnet/runtime/blob/main/docs/design/features/host-error-codes.md
// https://github.com/dotnet/samples/blob/91355ef22a10ec614a2e8daefd68785066860d57/core/hosting/src/NativeHost/nativehost.cpp
#if NETFRAMEWORK
using
System.Configuration
;
#endif
using
static
BD
.
WTTS
.
AssemblyInfo
;
using
static
BD
.
WTTS
.
Client
.
Resources
.
Strings
;
...
...
@@ -11,10 +14,22 @@ namespace BD.WTTS;
static
unsafe
partial
class
Program
{
public
const
string
dotnet_version_major
=
"7"
;
public
const
string
dotnet_version_minor
=
"0"
;
public
const
string
dotnet_version_build
=
"10"
;
public
const
string
dotnet_version
=
$"
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
.
{
dotnet_version_build
}
"
;
static
Program
()
{
dotnet_version_major
=
"7"
;
dotnet_version_minor
=
"0"
;
dotnet_version_build
=
"10"
;
dotnet_version
=
$"
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
.
{
dotnet_version_build
}
"
;
}
//#if NETFRAMEWORK
public
static
string
dotnet_version_major
,
dotnet_version_minor
,
dotnet_version_build
,
dotnet_version
;
//#else
// public const string dotnet_version_major = "7";
// public const string dotnet_version_minor = "0";
// public const string dotnet_version_build = "10";
// public const string dotnet_version = $"{dotnet_version_major}.{dotnet_version_minor}.{dotnet_version_build}";
//#endif
const
string
dotnet_runtime
=
"Microsoft.NETCore.App"
;
const
string
aspnetcore_runtime
=
"Microsoft.AspNetCore.App"
;
...
...
@@ -23,32 +38,32 @@ static unsafe partial class Program
const
string
dotnet_type
=
"BD.WTTS.Program, Steam++"
;
const
string
dotnet_type_method
=
"CustomEntryPoint"
;
/// <summary>
/// 是否依赖 AspNetCore
/// </summary>
/// <returns></returns>
static
bool
RequireAspNetCore
(
string
baseDirectory
)
{
foreach
(
var
moduleName
in
new
[]
{
// 依赖 AspNetCore 的模块名
Accelerator
,
ArchiSteamFarmPlus
,
})
{
var
module_path
=
#if NET35
PathCombine
#else
Path
.
Combine
#endif
(
baseDirectory
,
"modules"
,
moduleName
);
if
(
Directory
.
Exists
(
module_path
)
&&
!
PathIsDirectoryEmpty
(
module_path
))
{
return
true
;
}
}
return
false
;
}
//
//
/ <summary>
//
//
/ 是否依赖 AspNetCore
//
//
/ </summary>
//
//
/ <returns></returns>
//
static bool RequireAspNetCore(string baseDirectory)
//
{
//
foreach (var moduleName in new[] {
//
// 依赖 AspNetCore 的模块名
//
Accelerator,
//
ArchiSteamFarmPlus,
//
})
//
{
//
var module_path =
//
#if NET35
//
PathCombine
//
#else
//
Path.Combine
//
#endif
//
(baseDirectory, "modules", moduleName);
//
if (Directory.Exists(module_path) && !PathIsDirectoryEmpty(module_path))
//
{
//
return true;
//
}
//
}
//
return false;
//
}
#if NETFRAMEWORK
[
DllImport
(
"shlwapi.dll"
,
EntryPoint
=
"PathIsDirectoryEmptyW"
,
SetLastError
=
true
,
CharSet
=
CharSet
.
Unicode
)]
...
...
@@ -165,7 +180,7 @@ static unsafe partial class Program
#endif
static
void
DownloadDotNetRuntime
()
{
const
string
urlFormat1
=
$"https://dotnet.microsoft.com/
{{
0
}}
/download/dotnet/
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
"
;
string
urlFormat1
=
$"https://dotnet.microsoft.com/
{{
0
}}
/download/dotnet/
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
"
;
var
url
=
string
.
Format
(
urlFormat1
,
GetLang
());
OpenCoreByProcess
(
url
);
}
...
...
@@ -196,7 +211,7 @@ static unsafe partial class Program
{
Console
.
WriteLine
(
ex
);
Console
.
ReadLine
();
return
500
;
return
(
int
)
ExitCode
.
InternalServerError
;
}
}
#endif
...
...
@@ -219,6 +234,50 @@ static unsafe partial class Program
Console
.
WriteLine
(
$"Environment.Version:
{
Environment
.
Version
}
"
);
#endif
#if NETFRAMEWORK
try
{
var
dotnet_version_
=
ConfigurationManager
.
AppSettings
[
"d"
];
if
(!
#if !NET35
string
.
#endif
IsNullOrWhiteSpace
(
dotnet_version_
)
&&
dotnet_version_
.
Length
<
sbyte
.
MaxValue
)
{
var
dotnet_version__
=
dotnet_version_
.
Split
(
'.'
);
int
major
,
minor
,
build
;
switch
(
dotnet_version__
.
Length
)
{
case
1
:
dotnet_version_major
=
(
int
.
TryParse
(
dotnet_version__
[
0
],
out
major
)
?
major
:
0
).
ToString
();
dotnet_version_minor
=
dotnet_version_build
=
"0"
;
dotnet_version
=
$"
{
dotnet_version_major
}
.0.0"
;
break
;
case
2
:
dotnet_version_major
=
(
int
.
TryParse
(
dotnet_version__
[
0
],
out
major
)
?
major
:
0
).
ToString
();
dotnet_version_minor
=
(
int
.
TryParse
(
dotnet_version__
[
1
],
out
minor
)
?
minor
:
0
).
ToString
();
dotnet_version_build
=
"0"
;
dotnet_version
=
$"
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
.0"
;
break
;
case
3
:
dotnet_version_major
=
(
int
.
TryParse
(
dotnet_version__
[
0
],
out
major
)
?
major
:
0
).
ToString
();
dotnet_version_minor
=
(
int
.
TryParse
(
dotnet_version__
[
1
],
out
minor
)
?
minor
:
0
).
ToString
();
dotnet_version_build
=
(
int
.
TryParse
(
dotnet_version__
[
2
],
out
build
)
?
build
:
0
).
ToString
();
dotnet_version
=
$"
{
dotnet_version_major
}
.
{
dotnet_version_minor
}
.
{
dotnet_version_build
}
"
;
break
;
}
}
}
catch
{
}
if
(
dotnet_version
==
default
)
return
(
int
)
ExitCode
.
Failure_read_dotnet_version
;
#endif
var
baseDirectory
=
#if NET46_OR_GREATER || NETCOREAPP
AppContext
.
BaseDirectory
;
...
...
@@ -229,7 +288,8 @@ static unsafe partial class Program
if
(
args
.
Length
==
0
&&
!
CompatibilityCheck
(
baseDirectory
))
return
0
;
var
requireAspNetCore
=
RequireAspNetCore
(
baseDirectory
);
//var requireAspNetCore = RequireAspNetCore(baseDirectory);
const
bool
requireAspNetCore
=
true
;
string
hostfxr_path
,
dotnet_runtime_path
,
aspnetcore_runtime_path
,
config_path
,
dotnetlib_path
;
// STEP 0: Search HostFxr
...
...
@@ -372,6 +432,16 @@ static unsafe partial class Program
#endif
}
var
fvi
=
FileVersionInfo
.
GetVersionInfo
(
dotnetlib_path
);
if
(
fvi
.
Comments
!=
Description
)
return
(
int
)
ExitCode
.
Failure_fvi_Description
;
if
(
fvi
.
CompanyName
!=
Company
)
return
(
int
)
ExitCode
.
Failure_fvi_Company
;
if
(
fvi
.
LegalCopyright
!=
Copyright
)
return
(
int
)
ExitCode
.
Failure_fvi_Copyright
;
if
(
fvi
.
LegalTrademarks
!=
Trademark
)
return
(
int
)
ExitCode
.
Failure_fvi_Trademark
;
delegate
*
unmanaged
[
Cdecl
]<
nint
,
nint
,
out
nint
,
int
>
init_fptr
;
delegate
*
unmanaged
[
Cdecl
]<
nint
,
hostfxr_delegate_type
,
out
delegate
*
unmanaged
[
Cdecl
]<
nint
,
nint
,
nint
,
nint
,
nint
,
out
delegate
*
unmanaged
[
Cdecl
]<
nint
,
int
,
int
>,
int
>,
int
>
get_delegate_fptr
;
delegate
*
unmanaged
[
Cdecl
]<
nint
,
int
>
close_fptr
;
...
...
@@ -507,11 +577,20 @@ static unsafe partial class Program
enum
ExitCode
{
InternalServerError
=
5500
,
Failure_load_hostfxr
=
5701
,
Failure_get_dotnet_load_assembly
,
Failure_load_assembly_and_get_function_pointer
,
FrameworkMissingFailure
,
EntryPointFileNotFound
,
Failure_read_dotnet_version
,
Failure_fvi_Description
,
Failure_fvi_Company
,
Failure_fvi_Copyright
,
Failure_fvi_Trademark
,
}
#if NETFRAMEWORK
...
...
src/BD.WTTS.Client.Tools.Publish/Helpers/ObfuscarHelper.cs
浏览文件 @
3bd116ca
...
...
@@ -9,7 +9,7 @@ static class ObfuscarHelper
static
void
WriteConfig
(
string
dirPath
)
{
var
xml
=
"""
$
"""
<?
xml
version
=
'
1.0
'
?>
<
Obfuscator
>
<!--
输入的工作路径,采用如约定的
Windows
下的路径表示法,如以下表示当前工作路径
-->
...
...
@@ -42,14 +42,15 @@ static class ObfuscarHelper
<
Var
name
=
"RegenerateDebugInfo"
value
=
"false"
/>
<
Var
name
=
"OptimizeMethods"
value
=
"true"
/>
<
Var
name
=
"SuppressIldasm"
value
=
"true"
/>
<
Var
name
=
"KeyFile"
value
=
"{Path.Combine(ProjectUtils.ProjPath, "
WattToolkit
.
snk
")}"
/>
<!--
需要进行混淆的程序集,可以传入很多个,如传入一排排
-->
<!--
<
Module
file
=
"$(InPath)\Lib1.dll"
/>
-->
<!--
<
Module
file
=
"$(InPath)\Lib2.dll"
/>
-->
<
Module
file
=
"$(InPath)\Steam++.exe"
/>
</
Obfuscator
>
"""
u8
;
""";
File
.
WriteAllBytes
(
Path
.
Combine
(
dirPath
,
configFileName
),
xml
.
ToArray
(
));
File
.
WriteAllBytes
(
Path
.
Combine
(
dirPath
,
configFileName
),
Encoding
.
UTF8
.
GetBytes
(
xml
));
}
public
static
void
Start
(
string
dirPath
)
...
...
src/BD.WTTS.Client/Services/Platform/IPlatformService.OS.Linux.cs
浏览文件 @
3bd116ca
...
...
@@ -3,7 +3,7 @@ namespace BD.WTTS.Services;
partial
interface
IPlatformService
{
#
region
LinuxEtc
Issue
#
region
LinuxEtc
#if LINUX
...
...
@@ -45,6 +45,7 @@ partial interface IPlatformService
{
const
string
Deepin
=
"Deepin"
;
const
string
Ubuntu
=
"Ubuntu"
;
const
string
SteamOS
=
"SteamOS"
;
const
string
ReleaseKey_PRETTY_NAME
=
"PRETTY_NAME"
;
const
string
ReleaseKey_NAME
=
"NAME"
;
...
...
@@ -55,9 +56,42 @@ partial interface IPlatformService
const
string
ReleaseKey_ID_LIKE
=
"ID_LIKE"
;
const
string
ReleaseKey_HOME_URL
=
"HOME_URL"
;
const
string
ReleaseKey_BUG_REPORT_URL
=
"BUG_REPORT_URL"
;
// NAME="SteamOS"
// PRETTY_NAME="SteamOS"
// VERSION_CODENAME=holo
// ID=steamos
// ID_LIKE=arch
// ANSI_COLOR="1;35"
// HOME_URL="https://www.steampowered.com/"
// DOCUMENTATION_URL="https://support.steampowered.com/"
// SUPPORT_URL="https://support.steampowered.com/"
// BUG_REPORT_URL="https://support.steampowered.com/"
// LOGO=steamos
// VARIANT_ID=steamdeck
// BUILD_ID=20230508.1
// VERSION_ID=3.4.8
// PRETTY_NAME="Deepin 20.9"
// NAME="Deepin"
// VERSION_ID="20.9"
// VERSION="20.9"
// VERSION_CODENAME="apricot"
// ID=Deepin
// HOME_URL="https://www.deepin.org/"
// BUG_REPORT_URL="https://bbs.deepin.org/"
enum
Distribution
:
ushort
{
SteamOS
=
1
,
Ubuntu
,
Deepin
,
}
}
string
?
GetLinuxReleaseValue
(
string
key
)
st
atic
st
ring
?
GetLinuxReleaseValue
(
string
key
)
{
foreach
(
var
item
in
EtcOSRelease
.
Value
)
{
...
...
@@ -67,6 +101,37 @@ partial interface IPlatformService
return
default
;
}
private
static
readonly
Lazy
<
string
?>
_LinuxReleaseId
=
new
(()
=>
{
var
value
=
GetLinuxReleaseValue
(
LinuxConstants
.
ReleaseKey_ID
);
return
value
;
});
static
string
?
LinuxReleaseId
=>
_LinuxReleaseId
.
Value
;
private
static
readonly
Lazy
<
LinuxConstants
.
Distribution
>
_LinuxDistribution
=
new
(()
=>
{
var
value
=
LinuxReleaseId
;
if
(!
string
.
IsNullOrWhiteSpace
(
value
)
&&
value
.
Length
<
sbyte
.
MaxValue
)
{
var
bytes
=
Encoding
.
UTF8
.
GetBytes
(
value
);
Utf8StringComparerOrdinalIgnoreCase
comparer
=
new
();
if
(
"steamos"
u8
.
SequenceEqual
(
bytes
,
comparer
))
return
LinuxConstants
.
Distribution
.
SteamOS
;
else
if
(
"ubuntu"
u8
.
SequenceEqual
(
bytes
,
comparer
))
return
LinuxConstants
.
Distribution
.
Ubuntu
;
else
if
(
"Deepin"
u8
.
SequenceEqual
(
bytes
,
comparer
))
return
LinuxConstants
.
Distribution
.
Deepin
;
}
return
default
;
});
/// <summary>
/// 获取当前 Linux 发行版
/// </summary>
LinuxConstants
.
Distribution
LinuxDistribution
=>
_LinuxDistribution
.
Value
;
#endif
#
endregion
...
...
src/BD.WTTS.Client/UI/ViewModels/Pages/AboutPageViewModel.EasterEgg.cs
浏览文件 @
3bd116ca
...
...
@@ -74,7 +74,7 @@ partial class AboutPageViewModel
}
#elif MACCATALYST || IOS || MACOS
#elif LINUX
var
linuxOSRelease
=
p
latformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_PRETTY_NAME
);
var
linuxOSRelease
=
IP
latformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_PRETTY_NAME
);
if
(!
string
.
IsNullOrWhiteSpace
(
linuxOSRelease
))
{
b
.
Append
(
linuxOSRelease
);
...
...
src/BD.WTTS.Client/UI/ViewModels/Pages/AboutPageViewModel.cs
浏览文件 @
3bd116ca
...
...
@@ -30,10 +30,9 @@ public sealed partial class AboutPageViewModel : TabItemViewModel
{
string
?
osName
;
#if LINUX
var
platformService
=
IPlatformService
.
Instance
;
osName
=
platformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_NAME
);
osName
=
IPlatformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_NAME
);
if
(!
string
.
IsNullOrWhiteSpace
(
osName
))
return
osName
;
osName
=
p
latformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_ID
);
osName
=
IP
latformService
.
GetLinuxReleaseValue
(
IPlatformService
.
LinuxConstants
.
ReleaseKey_ID
);
if
(!
string
.
IsNullOrWhiteSpace
(
osName
))
return
osName
;
#endif
osName
=
DeviceInfo2
.
OSName
();
...
...
src/BD.WTTS.Client/UI/ViewModels/Windows/Main/MainWindowViewModel.cs
浏览文件 @
3bd116ca
// ReSharper disable once CheckNamespace
using
dotnetCampus.Ipc.CompilerServices.Attributes
;
namespace
BD.WTTS.UI.ViewModels
;
public
sealed
partial
class
MainWindowViewModel
:
WindowViewModel
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录