Skip to content

Commit 0224b92

Browse files
committed
Run code cleanup
1 parent 299c2b0 commit 0224b92

File tree

101 files changed

+364
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+364
-802
lines changed

src/ExternalLibraries.FilePickers/Classes/FileOpenDialogRCW.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Runtime.InteropServices;
2-
using ExternalLibraries.Pickers.Guids;
1+
using ExternalLibraries.Pickers.Guids;
2+
using System.Runtime.InteropServices;
33

44
namespace ExternalLibraries.Pickers.Classes;
55

src/ExternalLibraries.FilePickers/Classes/FileSaveDialogRCW.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Runtime.InteropServices;
2-
using ExternalLibraries.Pickers.Guids;
1+
using ExternalLibraries.Pickers.Guids;
2+
using System.Runtime.InteropServices;
33

44
namespace ExternalLibraries.Pickers.Classes;
55

src/ExternalLibraries.FilePickers/Classes/Helper.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using System.Runtime.InteropServices;
4-
using ExternalLibraries.Pickers.Enums;
1+
using ExternalLibraries.Pickers.Enums;
52
using ExternalLibraries.Pickers.Interfaces;
63
using ExternalLibraries.Pickers.Structures;
4+
using System.Runtime.InteropServices;
75

86
namespace ExternalLibraries.Pickers.Classes;
97

src/ExternalLibraries.FilePickers/Enums/FOS.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
3-
namespace ExternalLibraries.Pickers.Enums;
1+
namespace ExternalLibraries.Pickers.Enums;
42

53
[Flags]
64
// https://learn.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions

src/ExternalLibraries.FilePickers/FileOpenPicker.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using ExternalLibraries.Pickers.Classes;
1+
using ExternalLibraries.Pickers.Classes;
42
using ExternalLibraries.Pickers.Enums;
53

64
namespace ExternalLibraries.Pickers;

src/ExternalLibraries.FilePickers/FileSavePicker.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using ExternalLibraries.Pickers.Classes;
1+
using ExternalLibraries.Pickers.Classes;
42
using ExternalLibraries.Pickers.Enums;
53

64
namespace ExternalLibraries.Pickers;

src/ExternalLibraries.FilePickers/FolderPicker.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using ExternalLibraries.Pickers.Classes;
1+
using ExternalLibraries.Pickers.Classes;
32
using ExternalLibraries.Pickers.Enums;
43

54
namespace ExternalLibraries.Pickers;

src/ExternalLibraries.FilePickers/Interfaces/FileOpenDialog.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System.Runtime.InteropServices;
2-
using ExternalLibraries.Pickers.Classes;
1+
using ExternalLibraries.Pickers.Classes;
32
using ExternalLibraries.Pickers.Guids;
3+
using System.Runtime.InteropServices;
44

55
namespace ExternalLibraries.Pickers.Interfaces;
66

src/ExternalLibraries.FilePickers/Interfaces/FileSaveDialog.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System.Runtime.InteropServices;
2-
using ExternalLibraries.Pickers.Classes;
1+
using ExternalLibraries.Pickers.Classes;
32
using ExternalLibraries.Pickers.Guids;
3+
using System.Runtime.InteropServices;
44

55
namespace ExternalLibraries.Pickers.Interfaces;
66

src/ExternalLibraries.FilePickers/Interfaces/IFileDialog.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using System;
2-
using System.Runtime.CompilerServices;
3-
using System.Runtime.InteropServices;
4-
using ExternalLibraries.Pickers.Enums;
1+
using ExternalLibraries.Pickers.Enums;
52
using ExternalLibraries.Pickers.Guids;
63
using ExternalLibraries.Pickers.Structures;
4+
using System.Runtime.CompilerServices;
5+
using System.Runtime.InteropServices;
76

87
namespace ExternalLibraries.Pickers.Interfaces;
98

src/ExternalLibraries.FilePickers/Interfaces/IFileDialogEvents.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Runtime.CompilerServices;
2-
using System.Runtime.InteropServices;
3-
using ExternalLibraries.Pickers.Enums;
1+
using ExternalLibraries.Pickers.Enums;
42
using ExternalLibraries.Pickers.Guids;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
55

66
namespace ExternalLibraries.Pickers.Interfaces;
77

src/ExternalLibraries.FilePickers/Interfaces/IFileOpenDialog.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Runtime.CompilerServices;
2-
using System.Runtime.InteropServices;
3-
using ExternalLibraries.Pickers.Guids;
1+
using ExternalLibraries.Pickers.Guids;
42
using ExternalLibraries.Pickers.Structures;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
55

66
namespace ExternalLibraries.Pickers.Interfaces;
77

src/ExternalLibraries.FilePickers/Interfaces/IModalWindow.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System;
1+
using ExternalLibraries.Pickers.Guids;
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
4-
using ExternalLibraries.Pickers.Guids;
54

65
namespace ExternalLibraries.Pickers.Interfaces;
76

src/ExternalLibraries.FilePickers/Interfaces/IShellItem.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System;
1+
using ExternalLibraries.Pickers.Enums;
2+
using ExternalLibraries.Pickers.Guids;
23
using System.Runtime.CompilerServices;
34
using System.Runtime.InteropServices;
4-
using ExternalLibraries.Pickers.Enums;
5-
using ExternalLibraries.Pickers.Guids;
65

76
namespace ExternalLibraries.Pickers.Interfaces;
87

src/ExternalLibraries.FilePickers/Interfaces/IShellItemArray.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
using System;
2-
using System.Runtime.CompilerServices;
3-
using System.Runtime.InteropServices;
4-
using ExternalLibraries.Pickers.Enums;
1+
using ExternalLibraries.Pickers.Enums;
52
using ExternalLibraries.Pickers.Guids;
63
using ExternalLibraries.Pickers.Structures;
4+
using System.Runtime.CompilerServices;
5+
using System.Runtime.InteropServices;
76

87
namespace ExternalLibraries.Pickers.Interfaces;
98

src/ExternalLibraries.FilePickers/Structures/PROPERTYKEY.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Runtime.InteropServices;
1+
using System.Runtime.InteropServices;
32

43
namespace ExternalLibraries.Pickers.Structures;
54

src/UniGetUI.Core.Classes.Tests/PersonTests.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Xunit;
2-
3-
namespace UniGetUI.Core.Classes.Tests
1+
namespace UniGetUI.Core.Classes.Tests
42
{
53
public class PersonTests
64
{

src/UniGetUI.Core.Classes.Tests/SingletonBaseTest.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Xunit;
2-
3-
namespace UniGetUI.Core.Classes.Tests
1+
namespace UniGetUI.Core.Classes.Tests
42
{
53
public class SingletonBaseTest
64
{
@@ -19,16 +17,16 @@ private class InheritedClass2 : SingletonBase<InheritedClass2>
1917
[Fact]
2018
public void TestSingletonClass()
2119
{
22-
var Type1Instance1 = InheritedClass1.Instance;
20+
InheritedClass1 Type1Instance1 = InheritedClass1.Instance;
2321
Type1Instance1.Attribute1 = 1;
2422

25-
var Type1Instance2 = InheritedClass1.Instance;
23+
InheritedClass1 Type1Instance2 = InheritedClass1.Instance;
2624
Type1Instance2.Attribute1 = 3;
2725

2826
Assert.Equal(Type1Instance1.Attribute1, Type1Instance2.Attribute1);
2927
Assert.Equal(Type1Instance1, Type1Instance2);
3028

31-
var Type2Instance1 = new InheritedClass2();
29+
InheritedClass2 Type2Instance1 = new();
3230
Type2Instance1.Attribute1 = 2;
3331

3432
Assert.NotEqual(Type1Instance1.Attribute1, Type2Instance1.Attribute1);

src/UniGetUI.Core.Classes.Tests/SortableObservableCollectionTests.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Xunit;
2-
31
namespace UniGetUI.Core.Classes.Tests
42
{
53
public class SortableObservableCollectionTests
@@ -8,8 +6,8 @@ public class SortableObservableCollectionTests
86
public void TestSortableCollection()
97
{
108
int EventTriggeredCount = 0;
11-
12-
var SortableCollection = new SortableObservableCollection<int>();
9+
10+
SortableObservableCollection<int> SortableCollection = new();
1311
SortableCollection.CollectionChanged += (s, e) => { EventTriggeredCount++; };
1412
SortableCollection.SortingSelector = (s) => { return s; };
1513
SortableCollection.Add(1);

src/UniGetUI.Core.Classes/SingletonBase.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace UniGetUI.Core.Classes
1+
namespace UniGetUI.Core.Classes
82
{
93
public abstract class SingletonBase<T> where T : SingletonBase<T>
104
{

src/UniGetUI.Core.Data.Tests/CoreTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public void CheckOtherAttributes()
2525
Assert.NotEmpty(CoreData.VersionName);
2626
Assert.NotEqual(0, CoreData.VersionNumber);
2727
Assert.True(File.Exists(CoreData.IgnoredUpdatesDatabaseFile), "The Ignored Updates database file does not exist, but it should have been created automatically.");
28-
29-
var notif_1 = CoreData.VolatileNotificationIdCounter;
30-
var notif_2 = CoreData.VolatileNotificationIdCounter;
28+
29+
int notif_1 = CoreData.VolatileNotificationIdCounter;
30+
int notif_2 = CoreData.VolatileNotificationIdCounter;
3131
Assert.NotEqual(notif_1, notif_2);
3232

33-
var notif_3 = CoreData.UpdatesAvailableNotificationId;
34-
var notif_4 = CoreData.UpdatesAvailableNotificationId;
33+
int notif_3 = CoreData.UpdatesAvailableNotificationId;
34+
int notif_4 = CoreData.UpdatesAvailableNotificationId;
3535
Assert.True(notif_3 == notif_4, "The UpdatesAvailableNotificationId must be always the same");
3636
Assert.NotEqual(0, CoreData.UpdatesAvailableNotificationId);
3737

src/UniGetUI.Core.Data/CoreData.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System.Linq.Expressions;
2-
using System.Reflection.Metadata.Ecma335;
3-
using UniGetUI.Core.Logging;
4-
using Windows.Storage.Search;
5-
using Windows.System.Diagnostics;
1+
using UniGetUI.Core.Logging;
62

73
namespace UniGetUI.Core.Data
84
{
@@ -31,7 +27,7 @@ public static string UniGetUIInstallationOptionsDirectory
3127
{
3228
get
3329
{
34-
var path = Path.Join(UniGetUIDataDirectory, "InstallationOptions");
30+
string path = Path.Join(UniGetUIDataDirectory, "InstallationOptions");
3531
if(!Directory.Exists(path)) Directory.CreateDirectory(path);
3632
return path;
3733
}

src/UniGetUI.Core.IconEngine.Tests/IconCacheEngineTests.cs

+18-25
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Security.Cryptography;
5-
using System.Text;
6-
using System.Threading.Tasks;
7-
using UniGetUI.Core.Data;
8-
using UniGetUI.Core.Tools;
1+
using UniGetUI.Core.Data;
92

103
namespace UniGetUI.Core.IconEngine.Tests
114
{
@@ -18,19 +11,19 @@ public static class IconCacheEngineTests
1811
public static async Task TestCacheEngineForSha256(string url, byte[] data, string managerName, string packageId)
1912
{
2013
string extension = url.Split(".")[^1];
21-
var expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
14+
string expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
2215
if(File.Exists(expectedFile)) File.Delete(expectedFile);
2316

24-
CacheableIcon icon = new CacheableIcon(new Uri(url), data);
25-
var path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
17+
CacheableIcon icon = new(new Uri(url), data);
18+
string path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
2619
Assert.Equal(expectedFile, path);
2720
Assert.True(File.Exists(path));
2821

29-
var oldModificationDate = File.GetLastWriteTime(path);
22+
DateTime oldModificationDate = File.GetLastWriteTime(path);
3023

3124
icon = new CacheableIcon(new Uri(url.Replace("icon", "nonexistingicon")), data);
3225
path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
33-
var newModificationDate = File.GetLastWriteTime(path);
26+
DateTime newModificationDate = File.GetLastWriteTime(path);
3427

3528
Assert.Equal(oldModificationDate, newModificationDate);
3629
Assert.Equal(expectedFile, path);
@@ -42,27 +35,27 @@ public static async Task TestCacheEngineForSha256(string url, byte[] data, strin
4235
public static async Task TestCacheEngineForPackageVersion(string url, string version, string managerName, string packageId)
4336
{
4437
string extension = url.Split(".")[^1];
45-
var expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
38+
string expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
4639
if (File.Exists(expectedFile)) File.Delete(expectedFile);
4740

48-
CacheableIcon icon = new CacheableIcon(new Uri(url), version);
49-
var path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
41+
CacheableIcon icon = new(new Uri(url), version);
42+
string path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
5043
Assert.Equal(expectedFile, path);
5144
Assert.True(File.Exists(path));
5245

53-
var oldModificationDate = File.GetLastWriteTime(path);
46+
DateTime oldModificationDate = File.GetLastWriteTime(path);
5447

5548
icon = new CacheableIcon(new Uri(url), version);
5649
path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
57-
var newModificationDate = File.GetLastWriteTime(path);
50+
DateTime newModificationDate = File.GetLastWriteTime(path);
5851

5952
Assert.Equal(oldModificationDate, newModificationDate);
6053
Assert.Equal(expectedFile, path);
6154
Assert.True(File.Exists(path));
6255

6356
icon = new CacheableIcon(new Uri(url), version+"-beta0");
6457
path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
65-
var newNewModificationDate = File.GetLastWriteTime(path);
58+
DateTime newNewModificationDate = File.GetLastWriteTime(path);
6659

6760
Assert.NotEqual(oldModificationDate, newNewModificationDate);
6861
Assert.Equal(expectedFile, path);
@@ -75,27 +68,27 @@ public static async Task TestCacheEngineForPackageVersion(string url, string ver
7568
public static async Task TestCacheEngineForPackageSize(string url, long size, string managerName, string packageId)
7669
{
7770
string extension = url.Split(".")[^1];
78-
var expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
71+
string expectedFile = Path.Join(CoreData.UniGetUICacheDirectory_Icons, managerName, packageId + "." + extension);
7972
if (File.Exists(expectedFile)) File.Delete(expectedFile);
8073

81-
CacheableIcon icon = new CacheableIcon(new Uri(url), size);
82-
var path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
74+
CacheableIcon icon = new(new Uri(url), size);
75+
string path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
8376
Assert.Equal(expectedFile, path);
8477
Assert.True(File.Exists(path));
8578

86-
var oldModificationDate = File.GetLastWriteTime(path);
79+
DateTime oldModificationDate = File.GetLastWriteTime(path);
8780

8881
icon = new CacheableIcon(new Uri(url), size);
8982
path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
90-
var newModificationDate = File.GetLastWriteTime(path);
83+
DateTime newModificationDate = File.GetLastWriteTime(path);
9184

9285
Assert.Equal(oldModificationDate, newModificationDate);
9386
Assert.Equal(expectedFile, path);
9487
Assert.True(File.Exists(path));
9588

9689
icon = new CacheableIcon(new Uri(url), size+1);
9790
path = await IconCacheEngine.DownloadIconOrCache(icon, managerName, packageId);
98-
var newNewModificationDate = File.GetLastWriteTime(path);
91+
DateTime newNewModificationDate = File.GetLastWriteTime(path);
9992

10093
Assert.NotEqual(oldModificationDate, newNewModificationDate);
10194
Assert.Equal(expectedFile, path);

src/UniGetUI.Core.IconEngine.Tests/IconDatabaseTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public async Task LoadIconsAndScreenshotsDatabaseTest()
1212

1313
await iconStore.LoadIconAndScreenshotsDatabaseAsync();
1414

15-
var iconCount = iconStore.GetIconCount();
15+
IconDatabase.IconCount iconCount = iconStore.GetIconCount();
1616
Assert.NotEqual(0, iconCount.PackagesWithIconCount);
1717
Assert.NotEqual(0, iconCount.PackagesWithScreenshotCount);
1818
Assert.NotEqual(0, iconCount.TotalScreenshotCount);
@@ -23,10 +23,10 @@ public async Task TestGetExistingIconAndImagesAsync()
2323
{
2424
await iconStore.LoadIconAndScreenshotsDatabaseAsync();
2525

26-
var icon = iconStore.GetIconUrlForId("__test_entry_DO_NOT_EDIT_PLEASE");
26+
string icon = iconStore.GetIconUrlForId("__test_entry_DO_NOT_EDIT_PLEASE");
2727
Assert.Equal("https://this.is.a.test/url/used_for/automated_unit_testing.png", icon);
2828

29-
var screenshots = iconStore.GetScreenshotsUrlForId("__test_entry_DO_NOT_EDIT_PLEASE");
29+
string[] screenshots = iconStore.GetScreenshotsUrlForId("__test_entry_DO_NOT_EDIT_PLEASE");
3030
Assert.Equal(3, screenshots.Length);
3131
Assert.Equal("https://image_number.com/1.png", screenshots[0]);
3232
Assert.Equal("https://image_number.com/2.png", screenshots[1]);
@@ -38,10 +38,10 @@ public async Task TestGetNonExistingIconAndImagesAsync()
3838
{
3939
await iconStore.LoadIconAndScreenshotsDatabaseAsync();
4040

41-
var nonexistent_icon = iconStore.GetIconUrlForId("__test_entry_THIS_ICON_DOES_NOT_EXTST");
41+
string nonexistent_icon = iconStore.GetIconUrlForId("__test_entry_THIS_ICON_DOES_NOT_EXTST");
4242
Assert.Empty(nonexistent_icon);
4343

44-
var nonexistent_screenshots = iconStore.GetScreenshotsUrlForId("__test_entry_THIS_ICON_DOES_NOT_EXTST");
44+
string[] nonexistent_screenshots = iconStore.GetScreenshotsUrlForId("__test_entry_THIS_ICON_DOES_NOT_EXTST");
4545
Assert.Empty(nonexistent_screenshots);
4646
}
4747
}

0 commit comments

Comments
 (0)