-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
1,384 additions
and
920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,4 +133,5 @@ IFileOperation | |
IShellItem2 | ||
PSGetPropertyKeyFromName | ||
ShellExecuteEx | ||
CoTaskMemFree | ||
QueryDosDevice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2024 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using Windows.Win32; | ||
using Windows.Win32.System.Com; | ||
|
||
namespace Windows.Win32 | ||
{ | ||
/// <summary> | ||
/// Contains a heap pointer allocated via CoTaskMemAlloc and a set of methods to work with the pointer safely. | ||
/// </summary> | ||
public unsafe struct ComHeapPtr<T> : IDisposable where T : unmanaged | ||
{ | ||
private T* _ptr; | ||
|
||
public bool IsNull | ||
=> _ptr == default; | ||
|
||
public ComHeapPtr(T* ptr) | ||
{ | ||
_ptr = ptr; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public readonly T* Get() | ||
{ | ||
return _ptr; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public readonly T** GetAddressOf() | ||
{ | ||
return (T**)Unsafe.AsPointer(ref Unsafe.AsRef(in this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public void Dispose() | ||
{ | ||
T* ptr = _ptr; | ||
if (ptr is not null) | ||
{ | ||
_ptr = null; | ||
PInvoke.CoTaskMemFree((void*)ptr); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- Copyright (c) 2024 Files Community. Licensed under the MIT License. See the LICENSE. --> | ||
<ContentDialog | ||
x:Class="Files.App.Dialogs.BulkRenameDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:helpers="using:Files.App.Helpers" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
Title="{helpers:ResourceString Name=BulkRename}" | ||
DefaultButton="Primary" | ||
HighContrastAdjustment="None" | ||
IsPrimaryButtonEnabled="{x:Bind ViewModel.IsNameValid, Mode=OneWay}" | ||
PrimaryButtonCommand="{x:Bind ViewModel.CommitRenameCommand, Mode=OneWay}" | ||
PrimaryButtonText="{helpers:ResourceString Name=Rename}" | ||
RequestedTheme="{x:Bind RootAppElement.RequestedTheme, Mode=OneWay}" | ||
SecondaryButtonText="{helpers:ResourceString Name=Cancel}" | ||
Style="{StaticResource DefaultContentDialogStyle}" | ||
mc:Ignorable="d"> | ||
|
||
<StackPanel Width="440" Spacing="4"> | ||
|
||
<!-- Name --> | ||
<Grid | ||
Padding="12" | ||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" | ||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" | ||
BorderThickness="1" | ||
ColumnSpacing="8" | ||
CornerRadius="4"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<TextBlock | ||
Grid.Column="0" | ||
VerticalAlignment="Center" | ||
Text="{helpers:ResourceString Name=Name}" /> | ||
|
||
<TextBox | ||
x:Name="FileNameBox" | ||
Grid.Column="1" | ||
Width="260" | ||
PlaceholderText="{helpers:ResourceString Name=EnterName}" | ||
Text="{x:Bind ViewModel.FileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> | ||
<TextBox.Resources> | ||
<TeachingTip | ||
x:Name="InvalidNameWarning" | ||
Title="{helpers:ResourceString Name=InvalidFilename/Text}" | ||
IsOpen="{x:Bind ViewModel.ShowNameWarning, Mode=OneWay}" | ||
PreferredPlacement="Bottom" | ||
Target="{x:Bind FileNameBox}" /> | ||
</TextBox.Resources> | ||
</TextBox> | ||
|
||
</Grid> | ||
|
||
</StackPanel> | ||
</ContentDialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2024 Files Community | ||
// Licensed under the MIT License. See the LICENSE. | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Files.App.Dialogs | ||
{ | ||
public sealed partial class BulkRenameDialog : ContentDialog, IDialog<BulkRenameDialogViewModel> | ||
{ | ||
private FrameworkElement RootAppElement | ||
=> (FrameworkElement)MainWindow.Instance.Content; | ||
|
||
public BulkRenameDialogViewModel ViewModel | ||
{ | ||
get => (BulkRenameDialogViewModel)DataContext; | ||
set => DataContext = value; | ||
} | ||
|
||
public BulkRenameDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public new async Task<DialogResult> ShowAsync() | ||
{ | ||
return (DialogResult)await base.ShowAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.