Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMaid #2630

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Files.Launcher/DragDropForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FilesFullTrust
Expand Down Expand Up @@ -45,7 +42,8 @@ public DragDropForm(string dropPath, string dropText, System.Threading.Cancellat
this.Size = new System.Drawing.Size(lpRect.Width, lpRect.Height);
this.Location = new System.Drawing.Point(lpRect.Location.X, lpRect.Location.Y);

token.Register(() => {
token.Register(() =>
{
if (this.IsHandleCreated)
{
// If another window is created, close this one
Expand Down Expand Up @@ -127,4 +125,4 @@ protected override CreateParams CreateParams
}
}
}
}
}
4 changes: 2 additions & 2 deletions Files/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public static class GridViewBrowser
}

public static class GenericFileBrowser
{
{
}
}
}
}
}
2 changes: 1 addition & 1 deletion Files/Dialogs/AddItemDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
</StackPanel>
</Grid>
</StackPanel>
</ContentDialog>
</ContentDialog>
1 change: 0 additions & 1 deletion Files/Dialogs/ConfirmDeleteDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Files.View_Models;
using Microsoft.Toolkit.Uwp.Extensions;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

Expand Down
2 changes: 1 addition & 1 deletion Files/Dialogs/PropertySaveError.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
Grid.Row="1"
Text="There was an issue saving some properties." />
</StackPanel>
</ContentDialog>
</ContentDialog>
17 changes: 2 additions & 15 deletions Files/Dialogs/PropertySaveError.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml.Controls;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

Expand All @@ -34,4 +21,4 @@ private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDia
{
}
}
}
}
1 change: 0 additions & 1 deletion Files/Dialogs/RenameDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Files.Filesystem;
using Files.Interacts;
using Windows.System;
using Windows.UI.Xaml.Controls;

Expand Down
2 changes: 1 addition & 1 deletion Files/Enums/FileOperationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public enum FileOperationType : byte
/// </summary>
Delete = 8
}
}
}
2 changes: 1 addition & 1 deletion Files/Enums/ReturnResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public enum ReturnResult : byte
/// </summary>
Cancelled = 8,
}
}
}
2 changes: 1 addition & 1 deletion Files/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ internal static class EnumerableExtensions
internal static IEnumerable<T> CreateEnumerable<T>(this T item) =>
new List<T>() { item };
}
}
}
2 changes: 1 addition & 1 deletion Files/Extensions/LinqExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ internal static void ForEach<T>(this IEnumerable<T> collection, Action<T> action
action(value);
}
}
}
}
2 changes: 2 additions & 0 deletions Files/Files.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@
<None Include="Assets\terminal\terminal.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="priconfig.default.xml" />
<Content Include="priconfig.packaging.xml" />
<Content Include="Resources\AppCenterKey.txt" />
<Content Include="Resources\BingMapsKey.txt" />
<None Include="NLog.config">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public enum FilesystemItemType : byte
[Obsolete("The symlink has no use for now here.")]
Symlink = 2
}
}
}
22 changes: 11 additions & 11 deletions Files/Filesystem/FilesystemOperations/FilesystemOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class FilesystemOperations : IFilesystemOperations

private RecycleBinHelpers recycleBinHelpers;

#endregion
#endregion Private Members

#region Constructor

Expand All @@ -42,7 +42,7 @@ public FilesystemOperations(IShellPage associatedInstance)
recycleBinHelpers = new RecycleBinHelpers(this.associatedInstance);
}

#endregion
#endregion Constructor

#region IFilesystemOperations

Expand Down Expand Up @@ -128,7 +128,7 @@ await DialogDisplayHelper.ShowDialogAsync(
if (source.ItemType == FilesystemItemType.Directory)
{
if (string.IsNullOrWhiteSpace(source.Path) ||
Path.GetDirectoryName(destination).IsSubPathOf(source.Path)) // We check if user tried to copy anything above the source.ItemPath
Path.GetDirectoryName(destination).IsSubPathOf(source.Path)) // We check if user tried to copy anything above the source.ItemPath
{
ImpossibleActionResponseTypes responseType = ImpossibleActionResponseTypes.Abort;

Expand Down Expand Up @@ -182,8 +182,8 @@ await DialogDisplayHelper.ShowDialogAsync(
{
if (associatedInstance.FilesystemViewModel.CheckFolderForHiddenAttribute(source.Path))
{
// The source folder was hidden, apply hidden attribute to destination
NativeFileOperationsHelper.SetFileAttribute(t.Path, FileAttributes.Hidden);
// The source folder was hidden, apply hidden attribute to destination
NativeFileOperationsHelper.SetFileAttribute(t.Path, FileAttributes.Hidden);
}
copiedItem = t;
});
Expand Down Expand Up @@ -342,14 +342,14 @@ public async Task<IStorageHistory> DeleteAsync(PathWithType source,
// Try again with fulltrust process
if (associatedInstance.FilesystemViewModel.Connection != null)
{
AppServiceResponse response = await associatedInstance.FilesystemViewModel.Connection.SendMessageAsync(new ValueSet()
AppServiceResponse response = await associatedInstance.FilesystemViewModel.Connection.SendMessageAsync(new ValueSet()
{
{ "Arguments", "FileOperation" },
{ "fileop", "DeleteItem" },
{ "filepath", source.Path },
{ "permanently", permanently }
});
fsResult = (FilesystemResult)(response.Status == AppServiceResponseStatus.Success);
fsResult = (FilesystemResult)(response.Status == AppServiceResponseStatus.Success);
}
}
else if (fsResult == FilesystemErrorCode.ERROR_INUSE)
Expand Down Expand Up @@ -485,7 +485,7 @@ public async Task<IStorageHistory> RestoreFromTrashAsync(PathWithType source,
{
FilesystemResult<StorageFolder> sourceFolder = await associatedInstance.FilesystemViewModel.GetFolderFromPathAsync(source.Path);
FilesystemResult<StorageFolder> destinationFolder = await associatedInstance.FilesystemViewModel.GetFolderFromPathAsync(Path.GetDirectoryName(destination));

fsResult = sourceFolder.ErrorCode | destinationFolder.ErrorCode;
errorCode?.Report(fsResult);

Expand Down Expand Up @@ -546,7 +546,7 @@ await associatedInstance.FilesystemViewModel.GetFileFromPathAsync(iFilePath)
return new StorageHistory(FileOperationType.Restore, source, new PathWithType(destination, source.ItemType));
}

#endregion
#endregion IFilesystemOperations

#region IDisposable

Expand All @@ -559,6 +559,6 @@ public void Dispose()
associatedInstance = null;
}

#endregion
#endregion IDisposable
}
}
}
30 changes: 15 additions & 15 deletions Files/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Files.Dialogs;
using Files.Enums;
using Files.Filesystem.FilesystemHistory;
using Files.Helpers;
using Files.UserControls;
Expand All @@ -7,14 +8,13 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
using System.Text.RegularExpressions;
using FileAttributes = System.IO.FileAttributes;
using static Files.Helpers.NativeFindStorageItemHelper;
using Files.Enums;
using FileAttributes = System.IO.FileAttributes;

namespace Files.Filesystem
{
Expand Down Expand Up @@ -43,9 +43,9 @@ public class FilesystemHelpers : IFilesystemHelpers
"LPT6", "LPT7", "LPT8", "LPT9"
};

#endregion
#endregion Helpers Members

#endregion
#endregion Private Members

#region Constructor

Expand All @@ -57,7 +57,7 @@ public FilesystemHelpers(IShellPage associatedInstance, CancellationToken cancel
recycleBinHelpers = new RecycleBinHelpers(this.associatedInstance);
}

#endregion
#endregion Constructor

#region IFilesystemHelpers

Expand All @@ -79,7 +79,7 @@ public async Task<ReturnResult> CreateAsync(PathWithType source, bool registerHi
return returnCode.ToStatus();
}

#endregion
#endregion Create

#region Delete

Expand Down Expand Up @@ -397,7 +397,7 @@ public async Task<ReturnResult> DeleteItemAsync(IStorageItem source, bool showDi
return returnStatus;
}

#endregion
#endregion Delete

public async Task<ReturnResult> RestoreFromTrashAsync(PathWithType source, string destination, bool registerHistory)
{
Expand Down Expand Up @@ -582,7 +582,7 @@ public async Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageVi
return returnStatus;
}

#endregion
#endregion Copy

#region Move

Expand Down Expand Up @@ -724,7 +724,7 @@ public async Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageVi
return returnStatus;
}

#endregion
#endregion Move

#region Rename

Expand Down Expand Up @@ -760,9 +760,9 @@ public async Task<ReturnResult> RenameAsync(PathWithType source, string newName,
return returnCode.ToStatus();
}

#endregion
#endregion Rename

#endregion
#endregion IFilesystemHelpers

#region Public Helpers

Expand Down Expand Up @@ -933,7 +933,7 @@ public static bool ContainsRestrictedFileName(string input)
return false;
}

#endregion
#endregion Public Helpers

#region IDisposable

Expand All @@ -948,6 +948,6 @@ public void Dispose()
recycleBinHelpers = null;
}

#endregion
#endregion IDisposable
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using Files.Enums;
using Files.Filesystem.FilesystemHistory;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
using Files.Filesystem.FilesystemHistory;
using Files.Enums;

namespace Files.Filesystem
{
Expand Down Expand Up @@ -60,7 +60,7 @@ public interface IFilesystemHelpers : IDisposable
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
Task<ReturnResult> DeleteItemAsync(PathWithType source, bool showDialog, bool permanently, bool registerHistory);

#endregion
#endregion Delete

/// <summary>
/// Restores <paramref name="source"/> from the RecycleBin to <paramref name="destination"/> fullPath
Expand Down Expand Up @@ -138,7 +138,7 @@ public interface IFilesystemHelpers : IDisposable
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageView, string destination, bool registerHistory);

#endregion
#endregion Copy

#region Move

Expand Down Expand Up @@ -192,7 +192,7 @@ public interface IFilesystemHelpers : IDisposable
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
Task<ReturnResult> MoveItemsFromClipboard(DataPackageView packageView, string destination, bool registerHistory);

#endregion
#endregion Move

/// <summary>
/// Renames <paramref name="source"/> with <paramref name="newName"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using Files.Filesystem.FilesystemHistory;
using System;
using System.Threading;
using System.Threading.Tasks;
using Windows.Storage;
using Files.Filesystem.FilesystemHistory;

namespace Files.Filesystem
{
Expand Down
Loading