Skip to content

Commit 76cf988

Browse files
committed
Code refactoring and minor tweaks to SystemInformation
1 parent e1781c9 commit 76cf988

File tree

4 files changed

+147
-144
lines changed

4 files changed

+147
-144
lines changed

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
using System;
66
using System.Collections.Generic;
7-
using System.Reflection;
8-
using System.Runtime.Serialization;
97
using System.Threading.Tasks;
108
using Windows.Storage;
119

@@ -77,7 +75,7 @@ public bool KeyExists(string compositeKey, string key)
7775
/// <param name="key">Key of the object</param>
7876
/// <param name="default">Default value of the object</param>
7977
/// <returns>The T object</returns>
80-
public T Read<T>(string key, T @default = default(T))
78+
public T Read<T>(string key, T @default = default)
8179
{
8280
if (!Settings.Values.TryGetValue(key, out var value) || value == null)
8381
{
@@ -95,7 +93,7 @@ public bool KeyExists(string compositeKey, string key)
9593
/// <param name="key">Key of the object</param>
9694
/// <param name="default">Default value of the object</param>
9795
/// <returns>The T object</returns>
98-
public T Read<T>(string compositeKey, string key, T @default = default(T))
96+
public T Read<T>(string compositeKey, string key, T @default = default)
9997
{
10098
ApplicationDataCompositeValue composite = (ApplicationDataCompositeValue)Settings.Values[compositeKey];
10199
if (composite != null)
@@ -120,9 +118,6 @@ public bool KeyExists(string compositeKey, string key)
120118
/// <param name="value">Object to save</param>
121119
public void Save<T>(string key, T value)
122120
{
123-
var type = typeof(T);
124-
var typeInfo = type.GetTypeInfo();
125-
126121
Settings.Values[key] = serializer.Serialize(value);
127122
}
128123

@@ -182,7 +177,7 @@ public Task<bool> FileExistsAsync(string filePath)
182177
/// <param name="filePath">Path to the file that contains the object</param>
183178
/// <param name="default">Default value of the object</param>
184179
/// <returns>Waiting task until completion with the object in the file</returns>
185-
public async Task<T> ReadFileAsync<T>(string filePath, T @default = default(T))
180+
public async Task<T> ReadFileAsync<T>(string filePath, T @default = default)
186181
{
187182
string value = await StorageFileHelper.ReadTextFromFileAsync(Folder, filePath);
188183
return (value != null) ? serializer.Deserialize<T>(value) : @default;

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System.Runtime.Serialization;
65
using Windows.Storage;
76

87
namespace Microsoft.Toolkit.Uwp.Helpers

0 commit comments

Comments
 (0)