public static void Registers(IEnumerable <System.Reflection.Assembly> assembly) { WebRuntime.Register(typeof(UMC.Data.Reflection).Assembly); foreach (var a in assembly)//mscorlib, { var mpps = a.GetCustomAttributes(typeof(MappingAttribute), false); if (mpps.Length > 0) { WebRuntime.Register(a); } } }
static WebRuntime() { Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine(" $$ $$ $$$$$$$$ $$$$$$$ $$$$$$$$ "); Console.WriteLine(" $$ $$ $$ $$$$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$ $$ $$ $$ $$ $$ "); Console.WriteLine(" $$$$$$$ $$ $$ $$ $$$$$$$$ "); Console.WriteLine(" "); Console.WriteLine(" "); var dics = new System.IO.DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory).GetFiles("*.dll", SearchOption.TopDirectoryOnly); var last = DateTime.Now;// Utility.TimeSpan();// dic.LastWriteTime); foreach (var f in dics) { if (last > f.LastWriteTime) { last = f.LastWriteTime; } } String mapFile = Utility.MapPath("App_Data/register.net"); var lastTime = Utility.TimeSpan(last); String m = Utility.Reader(mapFile); if (String.IsNullOrEmpty(m) == false) { Hashtable map = JSON.Deserialize(m) as Hashtable; if (map.ContainsKey("time")) { if (Utility.IntParse(map["time"].ToString(), 0) == lastTime) { Array mapings = map["data"] as Array; if (mapings != null) { int l = mapings.Length; for (int i = 0; i < l; i++) { String v = mapings.GetValue(i) as string; WebRuntime.Register(Type.GetType(v)); } } } } } if (isScanning() == false) { Reflection.instance.ScanningClass(); ; Utility.Writer(mapFile, JSON.Serialize(new WebMeta().Put("time", lastTime).Put("data", WebRuntime.RegisterCls())), false); } WebRuntime.webFactorys.Sort((x, y) => y.Weight.CompareTo(x.Weight)); var em = WebRuntime.flows.GetEnumerator(); while (em.MoveNext()) { em.Current.Value.Sort((x, y) => y.Weight.CompareTo(x.Weight)); } }