public static Assembly ResolveHandler(object sender, ResolveEventArgs e) { byte[] asmBuff; var demangledName = DemangleName(e.Name.Split(',')[0]); using (var resStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(demangledName)) { asmBuff = new byte[resStream.Length]; resStream.Read(asmBuff, 0, asmBuff.Length); asmBuff = Decompressor.D(asmBuff); } return(Assembly.Load(asmBuff)); }
public static void Main(string[] args) { var buff = new byte[0]; using (var asmStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("X")) { buff = new byte[asmStream.Length]; asmStream.Read(buff, 0, buff.Length); buff = Decompressor.D(buff); } var T = new Thread(run); T.SetApartmentState(ApartmentState.STA); T.Start(new[] { (object)buff, args }); }