/trunk/Winify/Utilities/Miscellaneous.cs |
@@ -28,10 +28,7 @@ |
using (var key = Registry.CurrentUser.OpenSubKey |
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) |
{ |
if (key == null) |
{ |
return false; |
} |
if (key == null) return false; |
|
switch (enable) |
{ |
@@ -64,18 +61,12 @@ |
/// <remarks>Do not enable double buffering on RDP: https://devblogs.microsoft.com/oldnewthing/20060103-12/?p=32793</remarks> |
public static bool SetDoubleBuffered(this Control control) |
{ |
if (SystemInformation.TerminalServerSession) |
{ |
return false; |
} |
if (SystemInformation.TerminalServerSession) return false; |
|
var dgvType = control.GetType(); |
var pi = dgvType.GetProperty("DoubleBuffered", |
BindingFlags.Instance | BindingFlags.NonPublic); |
if (pi == null) |
{ |
return false; |
} |
if (pi == null) return false; |
|
pi.SetValue(control, true, null); |
|
@@ -100,10 +91,7 @@ |
|
using (var manifestResourceStream = assembly.GetManifestResourceStream(resource)) |
{ |
if (manifestResourceStream == null) |
{ |
return null; |
} |
if (manifestResourceStream == null) return null; |
|
var memoryStream = new MemoryStream(); |
|
@@ -144,17 +132,11 @@ |
{ |
while (ea.MoveNext()) |
{ |
if (ea.Current == null) |
{ |
continue; |
} |
if (ea.Current == null) continue; |
|
foreach (var ib in eb) |
{ |
if (cmp.Invoke(ea.Current, ib)) |
{ |
continue; |
} |
if (cmp.Invoke(ea.Current, ib)) continue; |
|
yield return ea.Current; |
|
@@ -180,17 +162,13 @@ |
using (var rk = localMachineX64View.OpenSubKey(location)) |
{ |
if (rk == null) |
{ |
throw new KeyNotFoundException( |
string.Format("Key Not Found: {0}", location)); |
} |
|
var machineGuid = rk.GetValue(name); |
if (machineGuid == null) |
{ |
throw new IndexOutOfRangeException( |
string.Format("Index Not Found: {0}", name)); |
} |
|
return machineGuid.ToString(); |
} |