/// <summary> /// 初始化插件 /// </summary> /// <param name="_app"></param> /// <returns></returns> public PluginConnectionResult Connect(IPluginHost _app) { IExtendApp app = _app as IExtendApp; if (app != null) { //注册 app.Register(this, app_OnExtendModuleRequest, app_OnExtendModulePost); Cms.Plugins.MapExtendPluginRoute("xmlrpc", app.GetAttribute(this).WorkIndent); } blogService = new WeblogRPCService(); //初始化设置 attr = this.GetAttribute(); bool isChanged = false; if (attr.Settings.Contains("enable_base64_image")) { WeblogRPCService.EnableBase64Images = attr.Settings["enable_base64_image"] == "yes"; } else { WeblogRPCService.EnableBase64Images = false; attr.Settings.Set("enable_base64_image", "no"); isChanged = true; } if (isChanged) { attr.Settings.Flush(); } return(PluginConnectionResult.Success); }
void app_OnExtendModulePost(HttpContext t, ref bool handled) { if (blogService == null) { blogService = new WeblogRPCService(); } t.Handler = blogService; t.Handler.ProcessRequest(t); handled = true; }