Skip to content

Commit

Permalink
Code Quality: Introduce a new data storage namespace (#12233)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5bfa authored Apr 30, 2023
1 parent 638e3b7 commit d8d10c2
Show file tree
Hide file tree
Showing 78 changed files with 126 additions and 127 deletions.
2 changes: 1 addition & 1 deletion src/Files.App/Actions/FileSystem/FormatDriveAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Contexts;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Extensions;
using Files.App.Shell;
using Files.App.ViewModels;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/FileSystem/PasteItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Commands;
using Files.App.Contexts;
using Files.App.DataModels;
using Files.App.Data.Models;
using Files.App.Extensions;
using Files.App.Helpers;
using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Commands;
using Files.App.Contexts;
using Files.App.DataModels;
using Files.App.Data.Models;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.App.Helpers;
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 @@ -4,7 +4,7 @@
using CommunityToolkit.WinUI.Notifications;
using Files.App.Commands;
using Files.App.Contexts;
using Files.App.DataModels;
using Files.App.Data.Models;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.App.Filesystem.Cloud;
Expand Down
2 changes: 2 additions & 0 deletions src/Files.App/BaseLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
using VA = Vanara.Windows.Shell;
using DispatcherQueueTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
using SortDirection = Files.Shared.Enums.SortDirection;
using Files.App.Data.EventArguments;
using Files.App.Data.Models;

namespace Files.App
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.EventArguments.Bundles
namespace Files.App.Data.EventArguments.Bundles
{
public class BundlesOpenPathEventArgs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.EventArguments
namespace Files.App.Data.EventArguments
{
public class LayoutModeEventArgs
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Files.App.Helpers.LayoutPreferences;

namespace Files.App.EventArguments
namespace Files.App.Data.EventArguments
{
public class LayoutPreferenceEventArgs
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Files.App.DataModels
namespace Files.App.Data.Factories
{
public static class SecurityAdvancedAccessControlItemFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Windows.Storage;
using Windows.Storage.Streams;

namespace Files.App.DataModels.NavigationControlItems
namespace Files.App.Data.Items
{
public class DriveItem : ObservableObject, INavigationControlItem, ILocatableFolder
{
Expand Down Expand Up @@ -212,7 +212,7 @@ public async Task UpdatePropertiesAsync()
SpaceText = GetSizeString();

if (MaxSpace.Bytes > 0 && FreeSpace.Bytes > 0) // Make sure we don't divide by 0
PercentageUsed = 100.0f - ((float)(FreeSpace.Bytes / MaxSpace.Bytes) * 100.0f);
PercentageUsed = 100.0f - (float)(FreeSpace.Bytes / MaxSpace.Bytes) * 100.0f;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Files.Backend.ViewModels.FileTags;

namespace Files.App.DataModels.NavigationControlItems
namespace Files.App.Data.Items
{
public class FileTagItem : INavigationControlItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Filesystem
namespace Files.App.Data.Items
{
public interface INavigationControlItem : IComparable<INavigationControlItem>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.UI.Xaml.Media.Imaging;
using System.IO;

namespace Files.App.DataModels.NavigationControlItems
namespace Files.App.Data.Items
{
public class LocationItem : ObservableObject, INavigationControlItem
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.ComponentModel;
using Files.Backend.Enums;
using Microsoft.UI.Xaml;

namespace Files.App.DataModels
namespace Files.App.Data.Items
{
public class NavigationViewItemButtonStyleItem : ObservableObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using System.Collections.ObjectModel;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Extensions;
using Files.App.Filesystem;
using Files.Backend.Enums;
using Files.Backend.Helpers;
using Microsoft.UI.Xaml;
using System.Collections.Generic;
using System.Linq;

namespace Files.App.DataModels
namespace Files.App.Data.Items
{
public static class PropertiesNavigationViewItemFactory
{
Expand Down Expand Up @@ -102,7 +96,7 @@ public static ObservableCollection<NavigationViewItemButtonStyleItem> Initialize
var securityItemEnabled = !isLibrary && !listedItem.IsRecycleBinItem;
var hashItemEnabled = !(isFolder && !listedItem.IsArchive) && !isLibrary && !listedItem.IsRecycleBinItem;
var detailsItemEnabled = fileExt is not null && !isShortcut && !isLibrary;
var customizationItemEnabled = !isLibrary && ((isFolder && !listedItem.IsArchive) || (isShortcut && !listedItem.IsLinkItem));
var customizationItemEnabled = !isLibrary && (isFolder && !listedItem.IsArchive || isShortcut && !listedItem.IsLinkItem);
var compatibilityItemEnabled = FileExtensionHelpers.IsExecutableFile(listedItem is ShortcutItem sht ? sht.TargetPath : fileExt, true);

if (!securityItemEnabled)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.DataModels.NavigationControlItems
namespace Files.App.Data.Items
{
public class WslDistroItem : INavigationControlItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.UI.Xaml.Controls;
using Windows.ApplicationModel.DataTransfer;

namespace Files.App.DataModels
namespace Files.App.Data.Models
{
public class AppModel : ObservableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Files.Backend.Models;
using Microsoft.UI.Xaml.Media.Imaging;

namespace Files.App.AppModels
namespace Files.App.Data.Models
{
/// <inheritdoc cref="IImageModel"/>
internal sealed class BitmapImageModel : IImageModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.WinUI;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.ServicesImplementation;
using Files.App.UserControls.Widgets;
using System.Collections.Specialized;
using System.IO;
using System.Text.Json.Serialization;
using Windows.Storage.FileProperties;

namespace Files.App.DataModels
namespace Files.App.Data.Models
{
public class SidebarPinnedModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Microsoft.UI.Xaml.Media.Imaging;

namespace Files.App.DataModels
namespace Files.App.Data.Models
{
public class SuggestionModel : ObservableObject
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.UI.Xaml;
using System.Threading;

namespace Files.App.DataModels
namespace Files.App.Data.Parameters
{
public class PropertiesPageNavigationParameter
{
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
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:dataitems="using:Files.App.Data.Items"
xmlns:helpers="using:Files.App.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigationcontrolitems="using:Files.App.DataModels.NavigationControlItems"
Title="{helpers:ResourceString Name=ReorderSidebarItemsDialogText}"
DefaultButton="Primary"
IsPrimaryButtonEnabled="True"
Expand Down Expand Up @@ -34,7 +34,7 @@
Grid.Row="1"
ItemsSource="{x:Bind ViewModel.SidebarFavoriteItems, Mode=OneWay}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="navigationcontrolitems:LocationItem">
<DataTemplate x:DataType="dataitems:LocationItem">
<Grid
AllowDrop="True"
AutomationProperties.AutomationId="{x:Bind Text}"
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Dialogs/ReorderSidebarItemsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.WinUI.UI;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Extensions;
using Files.App.ViewModels.Dialogs;
using Files.Backend.ViewModels.Dialogs;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/Cloud/CloudDrivesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.WinUI;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Extensions;
using Files.App.Helpers;
using Files.Shared;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/FileTagsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License. See the LICENSE.

using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.Backend.Services.Settings;
using Microsoft.Extensions.Logging;
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/LibraryLocationItem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Helpers;
using Files.Shared;
using System.Collections.ObjectModel;
Expand Down
1 change: 1 addition & 0 deletions src/Files.App/Filesystem/LibraryManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.Data.Items;
using Files.App.Dialogs;
using Files.App.Extensions;
using Files.App.Shell;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/QuickAccessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.WinUI.Helpers;
using Files.App.DataModels;
using Files.App.Data.Models;
using Files.App.Helpers;
using Files.App.ServicesImplementation;
using Files.App.UserControls.Widgets;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/Search/FolderSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.WinUI;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Extensions;
using Files.App.Filesystem.StorageItems;
using Files.App.Helpers;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/Security/AccessControlEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Files.App.DataModels;
using Files.App.Data.Factories;
using Files.App.Extensions;
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using CommunityToolkit.Mvvm.DependencyInjection;
using Files.App.Contexts;
using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Extensions;
using Files.App.Filesystem.StorageItems;
using Files.App.Helpers;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Filesystem/WSLDistroManager.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Helpers;
using System;
using System.Collections.Generic;
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Filesystem/WindowsStorageDeviceWatcher.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2023 Files Community
// Licensed under the MIT License. See the LICENSE.

using Files.App.DataModels.NavigationControlItems;
using Files.App.Data.Items;
using Files.App.Helpers;
using Files.App.Helpers.MMI;
using Files.Backend.Models;
Expand Down Expand Up @@ -96,7 +96,7 @@ private async void Watcher_Added(DeviceWatcher sender, DeviceInformation args)
return;
}

DataModels.NavigationControlItems.DriveType type;
Data.Items.DriveType type;
try
{
// Check if this drive is associated with a drive letter
Expand All @@ -105,7 +105,7 @@ private async void Watcher_Added(DeviceWatcher sender, DeviceInformation args)
}
catch (ArgumentException)
{
type = DataModels.NavigationControlItems.DriveType.Removable;
type = Data.Items.DriveType.Removable;
}

var driveItem = await DriveItem.CreateFromPropertiesAsync(root, deviceId, type);
Expand Down
8 changes: 6 additions & 2 deletions src/Files.App/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
global using global::System.Threading.Tasks;
global using global::System.ComponentModel;
global using global::System.Diagnostics;
global using SystemIO = global::System.IO;

// Windows Community Toolkit
global using global::CommunityToolkit.Mvvm.ComponentModel;
Expand All @@ -22,8 +23,11 @@
global using global::Files.App.Helpers;
global using global::Files.App.Extensions;
global using global::Files.App.Filesystem;
global using global::Files.App.DataModels;
global using global::Files.App.EventArguments;
global using global::Files.App.Data.EventArguments;
global using global::Files.App.Data.Factories;
global using global::Files.App.Data.Items;
global using global::Files.App.Data.Models;
global using global::Files.App.Data.Parameters;
global using global::Files.App.Interacts;
global using global::Files.App.ViewModels;
global using global::Files.Backend.Services.Settings;
Expand Down
Loading

0 comments on commit d8d10c2

Please sign in to comment.