summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Performance/PowerManagement.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/Performance/PowerManagement.cs')
-rw-r--r--src/DotNetOpenAuth.Test/Performance/PowerManagement.cs35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/DotNetOpenAuth.Test/Performance/PowerManagement.cs b/src/DotNetOpenAuth.Test/Performance/PowerManagement.cs
index 66492f3..81c6e7a 100644
--- a/src/DotNetOpenAuth.Test/Performance/PowerManagement.cs
+++ b/src/DotNetOpenAuth.Test/Performance/PowerManagement.cs
@@ -6,23 +6,15 @@
namespace DotNetOpenAuth.Test.Performance {
using System;
- using System.Runtime.InteropServices;
- using System.Diagnostics;
using System.ComponentModel;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
/// <summary>
/// PowerManagement allows you to access the funtionality of the Control Panel -> Power Options
/// dialog in windows. (Currently we only use VISTA APIs).
/// </summary>
internal static class PowerManagment {
- internal static class PowerProfiles {
- internal static Guid HighPerformance = new Guid(0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c);
-
- internal static Guid Balanced = new Guid(0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e);
-
- internal static Guid PowerSaver = new Guid(0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a);
- }
-
internal static unsafe Guid CurrentPolicy {
get {
Guid* retPolicy = null;
@@ -33,7 +25,8 @@ namespace DotNetOpenAuth.Test.Performance {
ret = *retPolicy;
Marshal.FreeHGlobal((IntPtr)retPolicy);
}
- } catch (Exception) { }
+ } catch (Exception) {
+ }
return ret;
}
@@ -46,6 +39,20 @@ namespace DotNetOpenAuth.Test.Performance {
}
}
+ [DllImport("powrprof.dll")]
+ private static unsafe extern int PowerGetActiveScheme(IntPtr reservedZero, ref Guid* policyGuidRet);
+
+ [DllImport("powrprof.dll")]
+ private static extern int PowerSetActiveScheme(IntPtr reservedZero, ref Guid policyGuid);
+
+ internal static class PowerProfiles {
+ internal static Guid HighPerformance = new Guid(0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c);
+
+ internal static Guid Balanced = new Guid(0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e);
+
+ internal static Guid PowerSaver = new Guid(0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a);
+ }
+
internal class PowerSetting : IDisposable {
/// <summary>
/// The power policy in effect when this instance was constructed.
@@ -72,11 +79,5 @@ namespace DotNetOpenAuth.Test.Performance {
}
}
}
-
- [DllImport("powrprof.dll")]
- private static unsafe extern int PowerGetActiveScheme(IntPtr ReservedZero, ref Guid* policyGuidRet);
-
- [DllImport("powrprof.dll")]
- private static extern int PowerSetActiveScheme(IntPtr ReservedZero, ref Guid policyGuid);
}
} \ No newline at end of file