Comments
2 comments
-
Until a configuration parameter can be set here is the worst hack I've ever wrote :
DateTime simulationTime = new DateTime(2008, 06, 06); Stopwatch elapsedTime = new Stopwatch(); elapsedTime.Start(); DateTime currentTime = DateTime.Now.ToUniversalTime(); SystemDateTime.SetSystemDateTime(simulationTime.ToUniversalTime()); IServiceProvider serviceProvider = new ApplicationManager(null); elapsedTime.Stop(); TimeSpan timespan = new TimeSpan(elapsedTime.ElapsedTicks); currentTime.Add(timespan); SystemDateTime.SetSystemDateTime(currentTime.ToUniversalTime());
And the class to set time (thanks to http://pinvoke.net/default.aspx/kernel32.SetLocalTime ) :using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace Posttrade.Rate.Accounting.RulesExplorer.Sources.Business { public static class SystemDateTime { public struct SystemTime { public ushort Year; public ushort Month; public ushort DayOfWeek; public ushort Day; public ushort Hour; public ushort Minute; public ushort Second; public ushort Millisecond; }; [DllImport("kernel32.dll", EntryPoint = "GetSystemTime", SetLastError = true)] public extern static void Win32GetSystemTime(ref SystemTime sysTime); [DllImport("kernel32.dll", EntryPoint = "SetSystemTime", SetLastError = true)] public extern static bool Win32SetSystemTime(ref SystemTime sysTime); public static void SetSystemDateTime(DateTime datetime) { // Set system date and time SystemTime updatedTime = new SystemTime(); updatedTime.Year = (ushort)datetime.Year; updatedTime.Month = (ushort)datetime.Month; updatedTime.Day = (ushort)datetime.Day; // UTC time; it will be modified according to the regional settings of the target computer so the actual hour might differ updatedTime.Hour = (ushort)datetime.Hour; updatedTime.Minute = (ushort)datetime.Minute; updatedTime.Second = (ushort)datetime.Second; // Call the unmanaged function that sets the new date and time instantly Win32SetSystemTime(ref updatedTime); } } }
-
So, no other way to disable .net reflector update ?
is it planned in futur release ?
Add comment
Please sign in to leave a comment.
I use reflector in my application :
The version of reflector .net is out of date, so when .net call : "new ApplicationManager(null)" the following popup show up :
"This version of .NET Reflector is out of date"
I don't want to update it (because computer can't access to internet and reflector remove itself) or change system clock before "new ApplicationManager(null)" and reset it after.
Is there any configuration parameter (in reflector.exe.config) or anything else to disable update ?
Thank you for your help !