コード例 #1
0
        public static void Reload(ISingletonWatcher inst)
        {
            var PyhsicalPath = PathHelper.GetDataPath(inst.WatcherFile);

            if (!File.Exists(PyhsicalPath))
            {
                PyhsicalPath = ResourceHelper.CopyToAppData(inst.GetType(), inst.WatcherFile);
            }

            using (StreamReader reader = new StreamReader(PyhsicalPath, Encoding.UTF8))
            {
                var json  = reader.ReadToEnd().Replace("\n", "").Replace("\r", "").Trim();
                var type  = inst.GetType();
                var other = JsonConvert.DeserializeObject(json, type);
                MyReflectionHelper.InvokeMethod(typeof(Mapper), "Map", new Type[] { type, type }, null, new[] { other, inst });
                // Mapper.Map(, this);
            }
        }
コード例 #2
0
ファイル: MetaDataHelper.cs プロジェクト: lowonion/DataShow
 public static MetaData GetMetaData(Type type)
 {
     return(_cacheMetaData.GetOrAdd(type, t => MyReflectionHelper.InvokeMethod(typeof(MetaDataHelper), "GetMetaData", new Type[] { t }) as MetaData));
 }