Skip to content

Instantly share code, notes, and snippets.

@urasandesu
Last active August 29, 2015 13:56
Show Gist options
  • Save urasandesu/9166630 to your computer and use it in GitHub Desktop.
Save urasandesu/9166630 to your computer and use it in GitHub Desktop.
namespace System
{
public struct DateTime
{
public static DateTime Now
{
get
{
// スタブでやっていたことの逆が挿入される。
var holder = default(IndirectionHolder<IndirectionFunc<DateTime>>);
if (LooseCrossDomainAccessor.TryGet(out holder))
{
var info = new IndirectionInfo();
info.AssemblyName = "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
info.Token = 0x060002D2;
var get_Now = default(IndirectionFunc<DateTime>);
if (holder.TryGet(info, out get_Now))
{
return get_Now();
}
}
// 元の処理がそのままコピーされる。
return DateTime.UtcNow.ToLocalTime();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment