public void OnChange(string virtualPath) { lock (_syncObject) { try { var coder = XPCCoder.Create(virtualPath); if (coder == null) { return; } coder.Generate(); XPCAssembly.Delete(coder.VirtualPath);//删除程序集 } catch (Exception ex) { throw ex; } finally { //清空缓存 XamlUtil.RecoverMemory(); } } }
internal static void Generate(string virtualPath) { XPCCoder coder = XPCCoder.Create(virtualPath); if (coder == null) { return; } coder.Generate();//生成代码 if (!IsIgnore(coder)) { if (WriteCode(coder) || !XPCAssembly.Exists(coder)) { try { //重新生成程序集 XPCAssembly.Compile(coder); } catch (Exception ex) { throw ex; } } } }