Skip to content

Commit 6af0733

Browse files
authored
Merge pull request #3056 from Saibamen/fix_csproj
Fix csproj duplicates and warnings
2 parents 90a1ac7 + 5d0b77a commit 6af0733

File tree

96 files changed

+135
-384
lines changed

Some content is hidden

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

96 files changed

+135
-384
lines changed

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

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ public class TaskRecyclerTests
55
private int MySlowMethod1()
66
{
77
Thread.Sleep(1000);
8-
return (new Random()).Next();
8+
return new Random().Next();
99
}
1010

11-
class TestClass
11+
private class TestClass
1212
{
1313
public TestClass() {}
1414

1515
public string SlowMethod2()
1616
{
1717
Thread.Sleep(1000);
18-
return (new Random()).Next().ToString();
18+
return new Random().Next().ToString();
1919
}
2020

2121
public string SlowMethod3()
2222
{
2323
Thread.Sleep(1000);
24-
return (new Random()).Next().ToString();
24+
return new Random().Next().ToString();
2525
}
2626
}
2727

2828
private int MySlowMethod4(int argument)
2929
{
3030
Thread.Sleep(1000);
31-
return (new Random()).Next() + (argument - argument);
31+
return new Random().Next() + (argument - argument);
3232
}
3333

3434
[Fact]
@@ -131,7 +131,6 @@ public void TestTaskRecycler_Class_String()
131131
string result2 = task2.GetAwaiter().GetResult();
132132
Assert.Equal(result1, result2);
133133

134-
135134
var class1_copy = class1;
136135

137136
// The SAME method from the SAME instance, even when called
@@ -153,7 +152,6 @@ public void TestTaskRecycler_Class_String()
153152
// Ensure the last call was not permanently cached
154153
Assert.NotEqual(result1, result3);
155154

156-
157155
// The SAME method from two DIFFERENT instances should NOT be
158156
// cached, so the results should differ
159157
var task7 = TaskRecycler<string>.RunOrAttachAsync(class1.SlowMethod3);

src/UniGetUI.Core.Classes.Tests/UniGetUI.Core.Classes.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

src/UniGetUI.Core.Classes/TaskRecycler.cs

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
using System.Collections.Concurrent;
2-
using System.Diagnostics;
3-
using UniGetUI.Core.Logging;
4-
using WinRT.Interop;
52

63
namespace UniGetUI.Core.Classes;
74

@@ -21,12 +18,10 @@ namespace UniGetUI.Core.Classes;
2118
*/
2219
public static class TaskRecycler<ReturnT>
2320
{
24-
private static ConcurrentDictionary<int, Task<ReturnT>> _tasks = new();
25-
21+
private static readonly ConcurrentDictionary<int, Task<ReturnT>> _tasks = new();
2622

2723
// ---------------------------------------------------------------------------------------------------------------
2824

29-
3025
/// Asynchronous entry point for 0 parameters
3126
public static Task<ReturnT> RunOrAttachAsync(Func<ReturnT> method, int cacheTimeSecs = 0)
3227
{
@@ -57,10 +52,8 @@ public static Task<ReturnT> RunOrAttachAsync<Param1T, Param2T, Param3T>(Func<Par
5752
return _runTaskAndWait(new Task<ReturnT>(() => method(arg1, arg2, arg3)), hash, cacheTimeSecs);
5853
}
5954

60-
6155
// ---------------------------------------------------------------------------------------------------------------
6256

63-
6457
/// Synchronous entry point for 0 parameters
6558
public static ReturnT RunOrAttach(Func<ReturnT> method, int cacheTimeSecs = 0)
6659
=> RunOrAttachAsync(method, cacheTimeSecs).GetAwaiter().GetResult();
@@ -79,10 +72,8 @@ public static ReturnT RunOrAttach<Param1T, Param2T, Param3T>(Func<Param1T, Param
7972
Param2T arg2, Param3T arg3, int cacheTimeSecs = 0)
8073
=> RunOrAttachAsync(method, arg1, arg2, arg3, cacheTimeSecs).GetAwaiter().GetResult();
8174

82-
8375
// ---------------------------------------------------------------------------------------------------------------
8476

85-
8677
/// <summary>
8778
/// Instantly removes a function call from the cache, even if the associated task has not
8879
/// finished yet. Any previous call will finish as expected. New calls won't attach to any
@@ -93,10 +84,8 @@ public static ReturnT RunOrAttach<Param1T, Param2T, Param3T>(Func<Param1T, Param
9384
public static void RemoveFromCache(Func<ReturnT> method)
9485
=> _removeFromCache(method.GetHashCode(), 0);
9586

96-
9787
// ---------------------------------------------------------------------------------------------------------------
9888

99-
10089
/// <summary>
10190
/// Handles running the task if no such task was found on cache, and returning the cached task if it was found.
10291
/// </summary>
@@ -134,15 +123,14 @@ private static async Task<ReturnT> _runTaskAndWait(Task<ReturnT> task, int hash,
134123
/// </summary>
135124
private static async void _removeFromCache(int hash, int cacheTimeSecsSecs)
136125
{
137-
if(cacheTimeSecsSecs > 0)
126+
if (cacheTimeSecsSecs > 0)
138127
await Task.Delay(cacheTimeSecsSecs * 1000);
139128

140129
_tasks.Remove(hash, out _);
141130
}
142131
}
143132

144-
145133
public static class TaskRecyclerTelemetry
146134
{
147-
public static int DeduplicatedCalls = 0;
135+
public static int DeduplicatedCalls;
148136
}

src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
@@ -18,10 +18,6 @@
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<Nullable>enable</Nullable>
23-
</PropertyGroup>
24-
2521
<ItemGroup>
2622
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
2723
</ItemGroup>

src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

src/UniGetUI.Core.Data/CoreData.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics;
1+
using System.Diagnostics;
22
using System.Net;
33
using System.Text.Json;
44
using System.Text.Json.Serialization.Metadata;
@@ -160,7 +160,6 @@ public static string UniGetUI_DefaultBackupDirectory
160160
/// </summary>
161161
public const int NewShortcutsNotificationTag = 1236;
162162

163-
164163
/// <summary>
165164
/// A path pointing to the location where the app is installed
166165
/// </summary>

src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
@@ -18,10 +18,6 @@
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<Nullable>enable</Nullable>
23-
</PropertyGroup>
24-
2521
<ItemGroup>
2622
<ProjectReference Include="..\UniGetUI.Core.Logger\UniGetUI.Core.Logging.csproj" />
2723
</ItemGroup>

src/UniGetUI.Core.IconEngine.Tests/UniGetUI.Core.IconEngine.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

src/UniGetUI.Core.IconStore/IconCacheEngine.cs

-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
using System.Collections.ObjectModel;
22
using System.Security.Cryptography;
3-
using Windows.ApplicationModel;
4-
using Windows.Graphics.Imaging;
5-
using Windows.UI;
63
using PhotoSauce.MagicScaler;
74
using UniGetUI.Core.Classes;
85
using UniGetUI.Core.Data;
96
using UniGetUI.Core.Logging;
10-
using UniGetUI.Core.Tools;
117

128
namespace UniGetUI.Core.IconEngine
139
{
@@ -230,7 +226,6 @@ cachedIconFile is not null &&
230226
return null;
231227
}
232228

233-
234229
/// <summary>
235230
/// The given image will be downsized to the expected size of an icon, if required
236231
/// </summary>
@@ -278,10 +273,8 @@ private static void DownsizeImage(string cachedIconFile, string extension)
278273
Logger.Error($"An error occurred while downsizing the image file {cachedIconFile}");
279274
Logger.Error(ex);
280275
}
281-
282276
}
283277

284-
285278
/// <summary>
286279
/// Checks whether a cached image is valid or not depending on the size (in bytes) of the image
287280
/// </summary>

src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
@@ -18,10 +18,6 @@
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<Nullable>enable</Nullable>
23-
</PropertyGroup>
24-
2521
<ItemGroup>
2622
<ProjectReference Include="..\UniGetUI.Core.Data\UniGetUI.Core.Data.csproj" />
2723
<ProjectReference Include="..\UniGetUI.Core.Logger\UniGetUI.Core.Logging.csproj" />

src/UniGetUI.Core.Language.Tests/UniGetUI.Core.LanguageEngine.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public Dictionary<string, string> LoadLanguageFile(string LangKey)
8181

8282
Dictionary<string, string> LangDict = BundledContents.ToDictionary(x => x.Key, x => x.Value?.ToString() ?? "");
8383

84-
8584
string CachedLangFileToLoad = Path.Join(CoreData.UniGetUICacheDirectory_Lang, "lang_" + LangKey + ".json");
8685

8786
if (Settings.Get("DisableLangAutoUpdater"))

src/UniGetUI.Core.LanguageEngine/UniGetUI.Core.LanguageEngine.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
@@ -18,10 +18,6 @@
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<Nullable>enable</Nullable>
23-
</PropertyGroup>
24-
2521
<ItemGroup>
2622
<PackageReference Include="MessageFormat" Version="7.1.2" />
2723
</ItemGroup>

src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
@@ -18,10 +18,6 @@
1818
<Configurations>Debug;Release</Configurations>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
22-
<Nullable>enable</Nullable>
23-
</PropertyGroup>
24-
2521
<ItemGroup>
2622
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
2723
</ItemGroup>

src/UniGetUI.Core.Logging.Tests/UniGetUI.Core.Logging.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

src/UniGetUI.Core.Settings.Tests/SettingsTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ public void TestListSettings(string SettingName, string[] ls1Array, int[] ls2Arr
149149
public void TestDictionarySettings(string SettingName, string[] keyArray, int[] intArray, string[] strArray)
150150
{
151151
Dictionary<string, SerializableTest?> test = [];
152-
Dictionary<string, string> emptyDictionary = [];
153152
Dictionary<string, SerializableTest?> nonEmptyDictionary = [];
154153
nonEmptyDictionary["this should not be null; something's wrong"] = null;
155154

src/UniGetUI.Core.Settings.Tests/UniGetUI.Core.Settings.Tests.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
77
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
88
<Platforms>x64</Platforms>
9-
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10-
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
9+
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
10+
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
1111
<SdkVersion>8.0.401</SdkVersion>
1212
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1313
<PublishSelfContained>true</PublishSelfContained>
1414
<Authors>Martí Climent and the contributors</Authors>
1515
<PublisherName>Martí Climent</PublisherName>
16-
<Nullable>enable</Nullable>
1716
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1817
<Configurations>Debug;Release</Configurations>
1918
</PropertyGroup>

0 commit comments

Comments
 (0)