Skip to content

Commit 23bc797

Browse files
committed
fix: Cleanup
1 parent 3647d49 commit 23bc797

File tree

5 files changed

+52
-54
lines changed

5 files changed

+52
-54
lines changed

Nickvision.Desktop.Tests/GitHubUpdaterServiceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public void Case001_Initialize()
4040
}
4141
Assert.IsNotNull(_client);
4242
_updaterService = new GitHubUpdaterService(new AppInfo("org.nickvision.tubeconverter", "Nickvision Parabolic", "Parabolic")
43-
{
44-
SourceRepository = new Uri("https://github.com/NickvisionApps/Parabolic")
45-
},
43+
{
44+
SourceRepository = new Uri("https://github.com/NickvisionApps/Parabolic")
45+
},
4646
_client);
4747
Assert.IsNotNull(_updaterService);
4848
}

Nickvision.Desktop/Application/AppVersion.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,12 @@ public static bool TryParse(string version, out AppVersion? appVersion)
8383

8484
public static bool operator !=(AppVersion? pv, Version? v) => !(pv == v);
8585

86-
public override bool Equals(object? obj) =>
87-
obj switch
88-
{
89-
AppVersion pv => this == pv,
90-
Version v => this == v,
91-
var _ => false
92-
};
86+
public override bool Equals(object? obj) => obj switch
87+
{
88+
AppVersion pv => this == pv,
89+
Version v => this == v,
90+
var _ => false
91+
};
9392

9493
public override int GetHashCode() => ToString().GetHashCode();
9594

Nickvision.Desktop/Application/ServiceCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public void Dispose()
4343
/// <param name="implementation">The object of the service interface</param>
4444
/// <typeparam name="T">The service interface</typeparam>
4545
/// <returns>The object to the service if successfully added, else null</returns>
46-
public T? Add<T>(T implementation) where T : IService => _services.TryAdd(typeof(T), implementation) ? implementation : default(T?);
46+
public T? Add<T>(T implementation) where T : IService => _services.TryAdd(typeof(T), implementation) ? implementation : default;
4747

4848
/// <summary>
4949
/// Gets a service from the collection.
5050
/// </summary>
5151
/// <typeparam name="T">The service interface</typeparam>
5252
/// <returns>The object matching the service interface if found, else null</returns>
53-
public T? Get<T>() where T : IService => _services.TryGetValue(typeof(T), out var service) ? (T)service : default(T?);
53+
public T? Get<T>() where T : IService => _services.TryGetValue(typeof(T), out var service) ? (T)service : default;
5454

5555
/// <summary>
5656
/// Gets whether a service from the collection with the interface type exists.

Nickvision.Desktop/System/Environment.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ public static IEnumerable<string> PathVariable
143143
/// <param name="info">The AppInfo object for the app</param>
144144
/// <param name="extra">Any extra information to include in the debug information string</param>
145145
/// <returns>The debug information string</returns>
146-
public static string GetDebugInformation(AppInfo info, string extra = "") =>
147-
$"""
146+
public static string GetDebugInformation(AppInfo info, string extra = "") => $"""
148147
App: {info.Name}
149148
Version: {info.Version}
150149

Nickvision.Desktop/System/SystemSecretService.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public bool Add(Secret secret)
4040
#pragma warning disable CA1416
4141
var stringPtr = Marshal.StringToHGlobalUni(secret.Value);
4242
var res = AdvApi32.CredWrite(new AdvApi32.CREDENTIAL
43-
{
44-
AttributeCount = 0,
45-
Attributes = nint.Zero,
46-
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
47-
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
48-
TargetName = new StrPtrAuto(secret.Name),
49-
UserName = new StrPtrAuto("default"),
50-
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
51-
CredentialBlob = stringPtr
52-
},
43+
{
44+
AttributeCount = 0,
45+
Attributes = nint.Zero,
46+
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
47+
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
48+
TargetName = new StrPtrAuto(secret.Name),
49+
UserName = new StrPtrAuto("default"),
50+
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
51+
CredentialBlob = stringPtr
52+
},
5353
0);
5454
Marshal.FreeHGlobal(stringPtr);
5555
return res;
@@ -114,16 +114,16 @@ public async Task<bool> AddAsync(Secret secret)
114114
#pragma warning disable CA1416
115115
var stringPtr = Marshal.StringToHGlobalUni(secret.Value);
116116
var res = await Task.Run(() => AdvApi32.CredWrite(new AdvApi32.CREDENTIAL
117-
{
118-
AttributeCount = 0,
119-
Attributes = nint.Zero,
120-
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
121-
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
122-
TargetName = new StrPtrAuto(secret.Name),
123-
UserName = new StrPtrAuto("default"),
124-
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
125-
CredentialBlob = stringPtr
126-
},
117+
{
118+
AttributeCount = 0,
119+
Attributes = nint.Zero,
120+
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
121+
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
122+
TargetName = new StrPtrAuto(secret.Name),
123+
UserName = new StrPtrAuto("default"),
124+
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
125+
CredentialBlob = stringPtr
126+
},
127127
0));
128128
Marshal.FreeHGlobal(stringPtr);
129129
return res;
@@ -464,16 +464,16 @@ public bool Update(Secret secret)
464464
}
465465
var stringPtr = Marshal.StringToHGlobalUni(secret.Value);
466466
var res = AdvApi32.CredWrite(new AdvApi32.CREDENTIAL
467-
{
468-
AttributeCount = 0,
469-
Attributes = nint.Zero,
470-
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
471-
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
472-
TargetName = new StrPtrAuto(secret.Name),
473-
UserName = new StrPtrAuto("default"),
474-
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
475-
CredentialBlob = stringPtr
476-
},
467+
{
468+
AttributeCount = 0,
469+
Attributes = nint.Zero,
470+
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
471+
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
472+
TargetName = new StrPtrAuto(secret.Name),
473+
UserName = new StrPtrAuto("default"),
474+
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
475+
CredentialBlob = stringPtr
476+
},
477477
0);
478478
Marshal.FreeHGlobal(stringPtr);
479479
return res;
@@ -538,16 +538,16 @@ public async Task<bool> UpdateAsync(Secret secret)
538538
}
539539
var stringPtr = Marshal.StringToHGlobalUni(secret.Value);
540540
var res = await Task.Run(() => AdvApi32.CredWrite(new AdvApi32.CREDENTIAL
541-
{
542-
AttributeCount = 0,
543-
Attributes = nint.Zero,
544-
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
545-
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
546-
TargetName = new StrPtrAuto(secret.Name),
547-
UserName = new StrPtrAuto("default"),
548-
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
549-
CredentialBlob = stringPtr
550-
},
541+
{
542+
AttributeCount = 0,
543+
Attributes = nint.Zero,
544+
Type = AdvApi32.CRED_TYPE.CRED_TYPE_GENERIC,
545+
Persist = AdvApi32.CRED_PERSIST.CRED_PERSIST_LOCAL_MACHINE,
546+
TargetName = new StrPtrAuto(secret.Name),
547+
UserName = new StrPtrAuto("default"),
548+
CredentialBlobSize = (uint)Encoding.Unicode.GetByteCount(secret.Value),
549+
CredentialBlob = stringPtr
550+
},
551551
0));
552552
Marshal.FreeHGlobal(stringPtr);
553553
return res;

0 commit comments

Comments
 (0)