Skip to content

Codebase: Remove unnecessary this keyword #11037

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

Merged
merged 2 commits into from
Jan 18, 2023
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
6 changes: 3 additions & 3 deletions src/Files.App.Storage/WindowsStorage/WindowsStorable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public abstract class WindowsStorable<TStorage> : ILocatableStorable
protected internal WindowsStorable(TStorage storage)
{
this.storage = storage;
this.Path = storage.Path;
this.Name = storage.Name;
this.Id = string.Empty;
Path = storage.Path;
Name = storage.Name;
Id = string.Empty;
}

/// <inheritdoc/>
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public App()
UnhandledException += OnUnhandledException;
TaskScheduler.UnobservedTaskException += OnUnobservedException;
InitializeComponent();
this.Services = ConfigureServices();
Services = ConfigureServices();
Ioc.Default.ConfigureServices(Services);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
{
base.OnNavigatedTo(eventArgs);
// Add item jumping handler
this.CharacterReceived += Page_CharacterReceived;
CharacterReceived += Page_CharacterReceived;
navigationArguments = (NavigationArguments)eventArgs.Parameter;
ParentShellPageInstance = navigationArguments.AssociatedTabInstance;
InitializeCommandsViewModel();
Expand Down Expand Up @@ -491,7 +491,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
// Remove item jumping handler
this.CharacterReceived -= Page_CharacterReceived;
CharacterReceived -= Page_CharacterReceived;
FolderSettings!.LayoutModeChangeRequested -= BaseFolderSettings_LayoutModeChangeRequested;
FolderSettings.GroupOptionPreferenceUpdated -= FolderSettings_GroupOptionPreferenceUpdated;
ItemContextMenuFlyout.Opening -= ItemContextFlyout_Opening;
Expand Down Expand Up @@ -578,7 +578,7 @@ private async Task LoadMenuItemsAsync()
itc.MaxHeight = Constants.UI.ContextMenuMaxHeight; // Reset menu max height
shellContextMenuItemCancellationToken?.Cancel();
shellContextMenuItemCancellationToken = new CancellationTokenSource();
SelectedItemsPropertiesViewModel.CheckAllFileExtensions(this.SelectedItems!.Select(selectedItem => selectedItem?.FileExtension).ToList()!);
SelectedItemsPropertiesViewModel.CheckAllFileExtensions(SelectedItems!.Select(selectedItem => selectedItem?.FileExtension).ToList()!);
var shiftPressed = Microsoft.UI.Input.InputKeyboardSource.GetKeyStateForCurrentThread(VirtualKey.Shift).HasFlag(Windows.UI.Core.CoreVirtualKeyStates.Down);
var items = ContextFlyoutItemHelper.GetItemContextCommandsWithoutShellItems(currentInstanceViewModel: InstanceViewModel!, workingDir: ParentShellPageInstance!.FilesystemViewModel.WorkingDirectory, selectedItems: SelectedItems!, selectedItemsPropertiesViewModel: SelectedItemsPropertiesViewModel, commandsViewModel: CommandsViewModel!, shiftPressed: shiftPressed, showOpenMenu: false);
ItemContextMenuFlyout.PrimaryCommands.Clear();
Expand Down
14 changes: 7 additions & 7 deletions src/Files.App/DataModels/SuggestionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ private void Img_ImageOpened(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)

public SuggestionModel(ListedItem item)
{
this.LoadFileIcon = item.LoadFileIcon;
this.NeedsPlaceholderGlyph = item.NeedsPlaceholderGlyph;
this.ItemPath = item.ItemPath;
this.Name = item.Name;
this.FileImage = item.FileImage;
LoadFileIcon = item.LoadFileIcon;
NeedsPlaceholderGlyph = item.NeedsPlaceholderGlyph;
ItemPath = item.ItemPath;
Name = item.Name;
FileImage = item.FileImage;
}

public SuggestionModel(string itemName, bool isRecentSearch)
{
this.IsRecentSearch = isRecentSearch;
this.Name = itemName;
IsRecentSearch = isRecentSearch;
Name = itemName;
}
}
}
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/AddItemDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public AddItemDialog()
private void ListView_ItemClick(object sender, ItemClickEventArgs e)
{
ViewModel.ResultType = (e.ClickedItem as AddItemDialogListItemViewModel).ItemResult;
this.Hide();
Hide();
}

private async void AddItemDialog_Loaded(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/CreateShortcutDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CreateShortcutDialogViewModel ViewModel

public CreateShortcutDialog()
{
this.InitializeComponent();
InitializeComponent();
}

public new async Task<DialogResult> ShowAsync() => (DialogResult)await base.ShowAsync();
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/CredentialDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public CredentialDialogViewModel ViewModel

public CredentialDialog()
{
this.InitializeComponent();
InitializeComponent();
}

public new async Task<DialogResult> ShowAsync() => (DialogResult)await base.ShowAsync();
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/DecompressArchiveDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DecompressArchiveDialogViewModel ViewModel

public DecompressArchiveDialog()
{
this.InitializeComponent();
InitializeComponent();
}

private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Dialogs/DynamicDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ private ContentDialog SetContentDialogRoot(ContentDialog contentDialog)

public DynamicDialog(DynamicDialogViewModel dynamicDialogViewModel)
{
this.InitializeComponent();
InitializeComponent();

dynamicDialogViewModel.HideDialog = this.Hide;
this.ViewModel = dynamicDialogViewModel;
dynamicDialogViewModel.HideDialog = Hide;
ViewModel = dynamicDialogViewModel;
}

#region IDisposable
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/ElevateConfirmDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ElevateConfirmDialogViewModel ViewModel

public ElevateConfirmDialog()
{
this.InitializeComponent();
InitializeComponent();
}

public new async Task<DialogResult> ShowAsync() => (DialogResult)await base.ShowAsync();
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Dialogs/FilesystemOperationDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public FileSystemDialogViewModel ViewModel

public FilesystemOperationDialog()
{
this.InitializeComponent();
InitializeComponent();

App.Window.SizeChanged += Current_SizeChanged;
}

public new async Task<DialogResult> ShowAsync() => (DialogResult)await this.SetContentDialogRoot(this).ShowAsync();
public new async Task<DialogResult> ShowAsync() => (DialogResult)await SetContentDialogRoot(this).ShowAsync();

// WINUI3
private ContentDialog SetContentDialogRoot(ContentDialog contentDialog)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/PropertiesDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public sealed partial class PropertiesDialog : ContentDialog
{
public PropertiesDialog()
{
this.InitializeComponent();
InitializeComponent();
}
}
}
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/SettingsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public SettingsDialogViewModel ViewModel

public SettingsDialog()
{
this.InitializeComponent();
InitializeComponent();
SettingsPane.SelectedItem = SettingsPane.MenuItems[0];
App.Window.SizeChanged += Current_SizeChanged;
UpdateDialogLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public FileSystemProgress(
long totalSize = 0,
int samplerInterval = 100)
{
this.StartTime = DateTimeOffset.Now;
StartTime = DateTimeOffset.Now;
this.progress = progress;
this.sampler = new(samplerInterval);
this.EnumerationCompleted = enumerationCompleted;
this.Status = status;
this.ItemsCount = itemsCount;
this.TotalSize = totalSize;
sampler = new(samplerInterval);
EnumerationCompleted = enumerationCompleted;
Status = status;
ItemsCount = itemsCount;
TotalSize = totalSize;
}

public void Report(float? percentage = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ await DialogDisplayHelper.ShowDialogAsync(
CloseButtonText = "Cancel".GetLocalizedResource()
};

ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync();
ContentDialogResult result = await SetContentDialogRoot(dialog).ShowAsync();

if (result == ContentDialogResult.Primary)
{
Expand Down Expand Up @@ -364,7 +364,7 @@ await DialogDisplayHelper.ShowDialogAsync(
CloseButtonText = "Cancel".GetLocalizedResource()
};

ContentDialogResult result = await this.SetContentDialogRoot(dialog).ShowAsync();
ContentDialogResult result = await SetContentDialogRoot(dialog).ShowAsync();

if (result == ContentDialogResult.Primary)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public FilesystemHelpers(IShellPage associatedInstance, CancellationToken cancel
{
this.associatedInstance = associatedInstance;
this.cancellationToken = cancellationToken;
this.filesystemOperations = new ShellFilesystemOperations(this.associatedInstance);
this.recycleBinHelpers = new RecycleBinHelpers();
filesystemOperations = new ShellFilesystemOperations(this.associatedInstance);
recycleBinHelpers = new RecycleBinHelpers();
}

#endregion Constructor
Expand Down
12 changes: 6 additions & 6 deletions src/Files.App/Filesystem/Permissions/FilePermissionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public FilePermissions ToFilePermissions()
{
return new FilePermissions()
{
FilePath = this.FilePath,
IsFolder = this.IsFolder,
AccessRules = this.AccessRules.Select(x =>
FilePath = FilePath,
IsFolder = IsFolder,
AccessRules = AccessRules.Select(x =>
{
FileSystemAccessRule rule = x.ToFileSystemAccessRule();
return new FileSystemAccessRule2()
Expand All @@ -90,9 +90,9 @@ public FilePermissions ToFilePermissions()
PropagationFlags = (System.Security.AccessControl.PropagationFlags)rule.PropagationFlags
};
}).ToList(),
CanReadFilePermissions = this.CanReadFilePermissions,
CurrentUserSID = this.CurrentUser.Sid,
OwnerSID = this.Owner.Sid,
CanReadFilePermissions = CanReadFilePermissions,
CurrentUserSID = CurrentUser.Sid,
OwnerSID = Owner.Sid,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@ public FileSystemAccessRule ToFileSystemAccessRule()
{
return new FileSystemAccessRule()
{
AccessControlType = this.AccessControlType,
FileSystemRights = this.FileSystemRights,
IdentityReference = this.IdentityReference,
IsInherited = this.IsInherited,
InheritanceFlags = this.InheritanceFlags,
PropagationFlags = this.PropagationFlags
AccessControlType = AccessControlType,
FileSystemRights = FileSystemRights,
IdentityReference = IdentityReference,
IsInherited = IsInherited,
InheritanceFlags = InheritanceFlags,
PropagationFlags = PropagationFlags
};
}
}
Expand Down Expand Up @@ -497,8 +497,8 @@ private void TogglePermission(FileSystemRights permission, bool value)

public GrantedPermission(FileSystemAccessRuleForUI fileSystemAccessRule)
{
this.fsar = fileSystemAccessRule;
this.fsar.PropertyChanged += Fsar_PropertyChanged;
fsar = fileSystemAccessRule;
fsar.PropertyChanged += Fsar_PropertyChanged;
}

protected virtual void Fsar_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Filesystem/StorageHistory/StorageHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public StorageHistory(FileOperationType operationType, IStorageItemWithPath sour

public StorageHistory(FileOperationType operationType, IList<IStorageItemWithPath> source, IList<IStorageItemWithPath> destination)
{
this.OperationType = operationType;
this.Source = source;
this.Destination = destination;
OperationType = operationType;
Source = source;
Destination = destination;
}

public void Modify(IStorageHistory newHistory)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/StorageItems/ShellStorageFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private class ShellFileBasicProperties : BaseBasicProperties
{
private readonly ShellFileItem file;

public ShellFileBasicProperties(ShellFileItem folder) => this.file = folder;
public ShellFileBasicProperties(ShellFileItem folder) => file = folder;

public override ulong Size => file.FileSizeBytes;

Expand Down
18 changes: 9 additions & 9 deletions src/Files.App/Filesystem/StorageItems/StreamWithContentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class InputStreamWithDisposeCallback : IInputStream
public InputStreamWithDisposeCallback(Stream stream)
{
this.stream = stream;
this.iStream = stream.AsInputStream();
iStream = stream.AsInputStream();
}

public IAsyncOperationWithProgress<IBuffer, uint> ReadAsync(IBuffer buffer, uint count, InputStreamOptions options)
Expand Down Expand Up @@ -46,8 +46,8 @@ public class NonSeekableRandomAccessStreamForWrite : IRandomAccessStream
public NonSeekableRandomAccessStreamForWrite(Stream stream)
{
this.stream = stream;
this.oStream = stream.AsOutputStream();
this.imrac = new InMemoryRandomAccessStream();
oStream = stream.AsOutputStream();
imrac = new InMemoryRandomAccessStream();
}

public IInputStream GetInputStreamAt(ulong position)
Expand Down Expand Up @@ -141,11 +141,11 @@ public class NonSeekableRandomAccessStreamForRead : IRandomAccessStream

public NonSeekableRandomAccessStreamForRead(Stream baseStream, ulong size)
{
this.stream = baseStream;
this.imrac = new InMemoryRandomAccessStream();
this.virtualPosition = 0;
this.readToByte = 0;
this.byteSize = size;
stream = baseStream;
imrac = new InMemoryRandomAccessStream();
virtualPosition = 0;
readToByte = 0;
byteSize = size;
}

public IInputStream GetInputStreamAt(ulong position)
Expand All @@ -162,7 +162,7 @@ public IOutputStream GetOutputStreamAt(ulong position)
public void Seek(ulong position)
{
imrac.Size = Math.Max(imrac.Size, position);
this.virtualPosition = position;
virtualPosition = position;
}

public IRandomAccessStream CloneStream() => throw new NotSupportedException();
Expand Down
Loading