From: Manuel Pfemeter Date: Wed, 29 Jan 2020 21:21:46 +0000 (+0100) Subject: Beautify code X-Git-Tag: submit/tizen/20210909.063632~9653^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=255b411575d501f3637b39297fae54a649715179;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Beautify code --- diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs index 5e0a74c..b5cad61 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/Registry.cs @@ -70,8 +70,7 @@ namespace Microsoft.Win32 public static object? GetValue(string keyName, string valueName, object defaultValue) { - string subKeyName; - RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName); + RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out string subKeyName); using (RegistryKey? key = basekey.OpenSubKey(subKeyName)) { @@ -86,8 +85,7 @@ namespace Microsoft.Win32 public static void SetValue(string keyName, string valueName, object value, RegistryValueKind valueKind) { - string subKeyName; - RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName); + RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out string subKeyName); using (RegistryKey key = basekey.CreateSubKey(subKeyName)) { diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs index dda39d1..6c80edd 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Security; -using System.Security.AccessControl; /* Note on transaction support: @@ -85,8 +84,7 @@ namespace Microsoft.Win32 private unsafe RegistryKey CreateSubKeyInternalCore(string subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions) { - Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES); - int disposition = 0; + Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default; // By default, the new key will be writable. int ret = Interop.Advapi32.RegCreateKeyEx(_hkey, @@ -97,7 +95,7 @@ namespace Microsoft.Win32 GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree) | (int)_regView, ref secAttrs, out SafeRegistryHandle result, - out disposition); + out int _); if (ret == 0 && !result.IsInvalid) { @@ -335,12 +333,11 @@ namespace Microsoft.Win32 } // open the base key so that RegistryKey.Handle will return a valid handle - SafeRegistryHandle result; ret = Interop.Advapi32.RegOpenKeyEx(baseKey, null, 0, GetRegistryKeyAccess(IsWritable()) | (int)_regView, - out result); + out SafeRegistryHandle result); if (ret == 0 && !result.IsInvalid) { diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKeyPermissionCheck.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKeyPermissionCheck.cs index 92b8b01..f69b6ee 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKeyPermissionCheck.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKeyPermissionCheck.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; - namespace Microsoft.Win32 { public enum RegistryKeyPermissionCheck @@ -11,5 +9,5 @@ namespace Microsoft.Win32 Default = 0, ReadSubTree = 1, ReadWriteSubTree = 2, - }; + } } diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryOptions.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryOptions.cs index 112efd2..e288412 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryOptions.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryOptions.cs @@ -11,5 +11,5 @@ namespace Microsoft.Win32 { None = Interop.Advapi32.RegistryOptions.REG_OPTION_NON_VOLATILE, // 0x0000 Volatile = Interop.Advapi32.RegistryOptions.REG_OPTION_VOLATILE, // 0x0001 - }; + } } diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryView.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryView.cs index 0bfe1a5..22b153c 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryView.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryView.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; - namespace Microsoft.Win32 { public enum RegistryView @@ -11,5 +9,5 @@ namespace Microsoft.Win32 Default = 0, // 0x0000 operate on the default registry view Registry64 = Interop.Advapi32.RegistryView.KEY_WOW64_64KEY, // 0x0100 operate on the 64-bit registry view Registry32 = Interop.Advapi32.RegistryView.KEY_WOW64_32KEY, // 0x0200 operate on the 32-bit registry view - }; + } } diff --git a/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistryRights.cs b/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistryRights.cs index 61e5371..4e5de44 100644 --- a/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistryRights.cs +++ b/src/libraries/Microsoft.Win32.Registry/src/System/Security/AccessControl/RegistryRights.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32; - namespace System.Security.AccessControl { // We derived this enum from the definitions of KEY_READ and such from