Changeset 13 for Common/Registry.cs
- Timestamp:
- Feb 8, 2021, 4:23:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Registry.cs
r9 r13 1 using System;1 using System; 2 2 using System.Collections.Generic; 3 3 using System.Linq; … … 35 35 } 36 36 37 public static long GetValueLong(this RegistryKey regKey, string name, long defaultValue) 38 { 39 object value = regKey.GetValue(name, defaultValue); 40 if (value is long) return (long)value; 41 else return defaultValue; 42 } 43 37 44 public static float GetValueFloat(this RegistryKey regKey, string name, float defaultValue) 38 45 { 39 46 object value = regKey.GetValue(name, defaultValue.ToString()); 40 float num;41 if (float.TryParse((string)value, out num))47 if (float.TryParse((string) value, out float num)) 48 { 42 49 return num; 50 } 43 51 else return defaultValue; 44 52 } … … 60 68 } 61 69 70 public static void SetValueLong(this RegistryKey regKey, string name, long value) 71 { 72 regKey.SetValue(name, value); 73 } 74 62 75 public static void SetValueFloat(this RegistryKey regKey, string name, float value) 63 76 {
Note:
See TracChangeset
for help on using the changeset viewer.