Skip to content

Commit 8ef70a0

Browse files
committed
Merge branch 'main' of https://github.com/files-community/Files into terminal
2 parents 327544c + bfba7d4 commit 8ef70a0

24 files changed

+117
-43
lines changed

src/Files.App (Package)/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<Identity
1717
Name="FilesDev"
1818
Publisher="CN=Files"
19-
Version="3.4.16.0" />
19+
Version="3.4.18.0" />
2020

2121
<Properties>
2222
<DisplayName>Files - Dev</DisplayName>

src/Files.App.Server/Files.App.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<Manifest Include="app.manifest" />
4141
<TrimmerRootAssembly Include="Files.App.Server" />
4242
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
43-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.1.647-beta" PrivateAssets="all" />
43+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106" PrivateAssets="all" />
4444
</ItemGroup>
4545

4646
<ItemGroup>

src/Files.App.Server/Helpers.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,31 @@
33

44
using System.Runtime.CompilerServices;
55
using System.Runtime.InteropServices;
6+
using Windows.Win32.Foundation;
7+
using Windows.Win32.System.WinRT;
68
using WinRT;
79

810
namespace Files.App.Server;
911

1012
unsafe partial class Helpers
1113
{
1214
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
13-
public static int GetActivationFactory(void* activatableClassId, void** factory)
15+
public static HRESULT GetActivationFactory(HSTRING activatableClassId, IActivationFactory** factory)
1416
{
15-
const int E_INVALIDARG = unchecked((int)0x80070057);
16-
const int CLASS_E_CLASSNOTAVAILABLE = unchecked((int)0x80040111);
17-
const int S_OK = 0;
18-
19-
if (activatableClassId is null || factory is null)
17+
if (activatableClassId.IsNull || factory is null)
2018
{
21-
return E_INVALIDARG;
19+
return HRESULT.E_INVALIDARG;
2220
}
2321

2422
try
2523
{
26-
IntPtr obj = Module.GetActivationFactory(MarshalString.FromAbi((IntPtr)activatableClassId));
27-
28-
if ((void*)obj is null)
29-
{
30-
return CLASS_E_CLASSNOTAVAILABLE;
31-
}
32-
33-
*factory = (void*)obj;
34-
return S_OK;
24+
*factory = (IActivationFactory*)Module.GetActivationFactory(MarshalString.FromAbi((IntPtr)activatableClassId));
25+
return *factory is null ? HRESULT.CLASS_E_CLASSNOTAVAILABLE : HRESULT.S_OK;
3526
}
3627
catch (Exception e)
3728
{
3829
ExceptionHelpers.SetErrorInfo(e);
39-
return ExceptionHelpers.GetHRForException(e);
30+
return (HRESULT)ExceptionHelpers.GetHRForException(e);
4031
}
4132
}
4233
}

src/Files.App.Server/NativeMethods.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// Copyright (c) 2024 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
CLASS_E_CLASSNOTAVAILABLE
5+
E_INVALIDARG
6+
RoInitialize
47
RoRegisterActivationFactories
58
RoRevokeActivationFactories
69
WindowsCreateString
710
WindowsDeleteString
8-
RoInitialize

src/Files.App.Server/Program.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static async Task Main()
2121
{
2222
AppDomain.CurrentDomain.FirstChanceException += OnFirstChanceException;
2323

24-
nint cookie = 0;
24+
RO_REGISTRATION_COOKIE cookie = default;
2525

2626
_ = PInvoke.RoInitialize(RO_INIT_TYPE.RO_INIT_MULTITHREADED);
2727

@@ -42,11 +42,18 @@ static async Task Main()
4242

4343
unsafe
4444
{
45-
var callbacks = Enumerable.Repeat((nint)(delegate* unmanaged[Stdcall]<void*, void**, int>)&Helpers.GetActivationFactory, classIds.Length).ToArray();
45+
delegate* unmanaged[Stdcall]<HSTRING, IActivationFactory**, HRESULT>[] callbacks = new delegate* unmanaged[Stdcall]<HSTRING, IActivationFactory**, HRESULT>[classIds.Length];
46+
for (int i = 0; i < callbacks.Length; i++)
47+
{
48+
callbacks[i] = &Helpers.GetActivationFactory;
49+
}
4650

47-
if (PInvoke.RoRegisterActivationFactories(classIds, callbacks, out cookie) is HRESULT hr && hr.Value != 0)
51+
fixed (delegate* unmanaged[Stdcall]<HSTRING, IActivationFactory**, HRESULT>* pCallbacks = callbacks)
4852
{
49-
Marshal.ThrowExceptionForHR(hr);
53+
if (PInvoke.RoRegisterActivationFactories(classIds, pCallbacks, out cookie) is HRESULT hr && hr.Value != 0)
54+
{
55+
Marshal.ThrowExceptionForHR(hr);
56+
}
5057
}
5158
}
5259

src/Files.App/Data/Contracts/IAppearanceSettingsService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,10 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
9696
/// Gets or sets a value for the app background image Horizontal Alignment.
9797
/// </summary>
9898
HorizontalAlignment AppThemeBackgroundImageHorizontalAlignment { get; set; }
99+
100+
/// <summary>
101+
/// Gets or sets a value whether the toolbar should be displayed.
102+
/// </summary>
103+
bool ShowToolbar { get; set; }
99104
}
100105
}

src/Files.App/Files.App.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
8686
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" />
8787
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
88-
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
8988
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />
9089
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
9190
<PackageReference Include="TagLibSharp" Version="2.3.0" />
@@ -95,7 +94,7 @@
9594
<PackageReference Include="Vanara.Windows.Shell" Version="4.0.1" />
9695
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
9796
<PackageReference Include="Microsoft.Management.Infrastructure.Runtime.Win" Version="3.0.0" />
98-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta" PrivateAssets="all" />
97+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106" PrivateAssets="all" />
9998
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
10099
</ItemGroup>
101100

src/Files.App/Helpers/Application/AppLifecycleHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ public static void HandleAppUnhandledException(Exception? ex, bool showToastNoti
267267
ex.Data[Mechanism.HandledKey] = false;
268268
ex.Data[Mechanism.MechanismKey] = "Application.UnhandledException";
269269

270+
SentrySdk.CaptureException(ex, scope =>
271+
{
272+
scope.User.Id = generalSettingsService?.UserId;
273+
scope.Level = SentryLevel.Fatal;
274+
});
275+
270276
formattedException.AppendLine($">>>> HRESULT: {ex.HResult}");
271277

272278
if (ex.Message is not null)

src/Files.App/Services/Settings/AppearanceSettingsService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ public HorizontalAlignment AppThemeBackgroundImageHorizontalAlignment
131131
set => Set(value);
132132
}
133133

134+
/// <inheritdoc/>
135+
public bool ShowToolbar
136+
{
137+
get => Get(true);
138+
set => Set(value);
139+
}
140+
134141
protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
135142
{
136143
base.RaiseOnSettingChangedEvent(sender, e);

src/Files.App/Services/Storage/StorageNetworkService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public bool DisconnectNetworkDrive(ILocatableFolder drive)
184184
return
185185
PInvoke.WNetCancelConnection2W(
186186
drive.Path.TrimEnd('\\'),
187-
(uint)NET_USE_CONNECT_FLAGS.CONNECT_UPDATE_PROFILE,
187+
NET_CONNECT_FLAGS.CONNECT_UPDATE_PROFILE,
188188
true)
189189
is WIN32_ERROR.NO_ERROR;
190190
}

0 commit comments

Comments
 (0)