Skip to content

Commit 07bb56b

Browse files
committed
release:v3.0.9.0 紧急修复商店无法打开
1 parent e974a4d commit 07bb56b

File tree

6 files changed

+60
-39
lines changed

6 files changed

+60
-39
lines changed

docs/2.更新记录.md

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959

6060
---
6161

62+
## v3.0.9-alpha.9 发布日期:2024.2.8
63+
64+
### 修复
65+
66+
- [x] 修复商店版无法使用
67+
68+
---
69+
6270
## v3.0.8-alpha.8 发布日期:2024.2.7
6371

6472
### 修复

src/giantapp-wallpaper-client/Client.App/Package.appxmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Identity
1111
Name="24765mscoder.3"
1212
Publisher="CN=49BC8659-1B4C-4520-B1FB-ED98CFA366C4"
13-
Version="3.0.8.0" />
13+
Version="3.0.9.0" />
1414

1515
<Properties>
1616
<DisplayName>巨应壁纸3</DisplayName>

src/giantapp-wallpaper-client/Client/Client.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Platforms>x64</Platforms>
1111
<AssemblyName>LiveWallpaper3</AssemblyName>
1212
<ApplicationIcon>Assets\Img\logo.ico</ApplicationIcon>
13-
<Version>3.0.8-alpha8</Version>
13+
<Version>3.0.9-alpha9</Version>
1414
<PackageProjectUrl>https://giantapp.cn</PackageProjectUrl>
1515
<Authors>巨应君 | Giantapp Studio</Authors>
1616
<ApplicationManifest>app.manifest</ApplicationManifest>

src/giantapp-wallpaper-client/Client/Libs/AutoStart.cs

+2-36
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public AutoStart(string key, string executablePath)
2929

3030
public async Task<bool> Set(bool enabled)
3131
{
32-
if (IsRunningAsUwp())
32+
if (UWPHelper.IsRunningAsUwp())
3333
return await UWPSet(enabled);
3434
else
3535
return DeskTopSet(enabled);
3636
}
3737

3838
public async Task<bool> Check()
3939
{
40-
if (IsRunningAsUwp())
40+
if (UWPHelper.IsRunningAsUwp())
4141
return await UWPCheck();
4242
else
4343
return DeskTopCheck();
@@ -210,40 +210,6 @@ public bool DeskTopCheck()
210210
return null;
211211
}
212212
}
213-
const long APPMODEL_ERROR_NO_PACKAGE = 15700L;
214-
215-
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
216-
static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder packageFullName);
217-
218-
public bool IsRunningAsUwp()
219-
{
220-
if (IsWindows7OrLower)
221-
{
222-
return false;
223-
}
224-
else
225-
{
226-
int length = 0;
227-
StringBuilder sb = new(0);
228-
GetCurrentPackageFullName(ref length, sb);
229-
230-
sb = new StringBuilder(length);
231-
int result = GetCurrentPackageFullName(ref length, sb);
232-
233-
return result != APPMODEL_ERROR_NO_PACKAGE;
234-
}
235-
}
236-
237-
private bool IsWindows7OrLower
238-
{
239-
get
240-
{
241-
int versionMajor = Environment.OSVersion.Version.Major;
242-
int versionMinor = Environment.OSVersion.Version.Minor;
243-
double version = versionMajor + (double)versionMinor / 10;
244-
return version <= 6.1;
245-
}
246-
}
247213
#endregion
248214
}
249215
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using System.Text;
4+
5+
namespace Client.Libs;
6+
7+
public class UWPHelper
8+
{
9+
public static bool IsRunningAsUwp()
10+
{
11+
if (IsWindows7OrLower)
12+
{
13+
return false;
14+
}
15+
else
16+
{
17+
int length = 0;
18+
StringBuilder sb = new(0);
19+
GetCurrentPackageFullName(ref length, sb);
20+
21+
sb = new StringBuilder(length);
22+
int result = GetCurrentPackageFullName(ref length, sb);
23+
24+
return result != APPMODEL_ERROR_NO_PACKAGE;
25+
}
26+
}
27+
28+
private static bool IsWindows7OrLower
29+
{
30+
get
31+
{
32+
int versionMajor = Environment.OSVersion.Version.Major;
33+
int versionMinor = Environment.OSVersion.Version.Minor;
34+
double version = versionMajor + (double)versionMinor / 10;
35+
return version <= 6.1;
36+
}
37+
}
38+
39+
const long APPMODEL_ERROR_NO_PACKAGE = 15700L;
40+
41+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
42+
static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder packageFullName);
43+
44+
}

src/giantapp-wallpaper-client/Client/UI/ShellWindow.xaml.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ public static void ApplyCustomFolderMapping(Dictionary<string, string> mapping,
204204

205205
foreach (var item in mapping)
206206
{
207-
if (!Directory.Exists(item.Value))
207+
bool isAbsoluteFilePath = Path.IsPathRooted(item.Value);
208+
bool isUWP = UWPHelper.IsRunningAsUwp();
209+
//必须判断,商店版无法创建相对路径
210+
if ((!isUWP || isAbsoluteFilePath) && !Directory.Exists(item.Value))
208211
Directory.CreateDirectory(item.Value);
209212
webview2?.CoreWebView2?.SetVirtualHostNameToFolderMapping(item.Key, item.Value, CoreWebView2HostResourceAccessKind.Allow);
210213
}

0 commit comments

Comments
 (0)