Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <summary>
        /// 读取前置扩展程序
        /// </summary>
        /// <returns></returns>
        protected virtual List <IExtendApp> ReadXmlCreateApp()
        {
            List <IExtendApp> list = new List <IExtendApp>();

            System.Xml.XmlNodeList aaa = this.ConfigXml.GetNodeList("descendant::Prepose");
            foreach (System.Xml.XmlNode node in aaa)
            {
                if (node.Attributes != null)
                {
                    string     fullClassName = node.SelectSingleNode("descendant::FullClassName").InnerText;
                    IExtendApp newpapp       = CreateExtendAppIns(fullClassName);
                    if (newpapp == null || newpapp.IsHealth == false)
                    {
                        //前置启动失败 系统自动关闭
                        Lemon.SendMsgError("前置启动程序加载失败:" + fullClassName + " 系统无法运行。");
                        Application.Exit();
                    }
                    else
                    {
                        list.Add(newpapp);
                    }
                }
            }
            return(list);
        }
Exemple #3
0
        public PluginConnectionResult Connect(IPluginHost _app)
        {
            IExtendApp app = _app as IExtendApp;

            if (app != null)
            {
                //注册
                app.Register(this, app_OnExtendModuleRequest, app_OnExtendModulePost);
                Cms.Plugins.MapExtendPluginRoute("admin/dpicker", app.GetAttribute(this).WorkIndent);
            }

            return(PluginConnectionResult.Success);
        }
Exemple #4
0
        public PluginConnectionResult Connect(IPluginHost app)
        {
            IExtendApp _app = app as IExtendApp;

            if (_app != null)
            {
                RequestProxry req = new RequestProxry(_app);
                _app.Register(this, req.HandleGet, req.HandlePost);
                // Cms.Plugins.MapExtendPluginRoute(this);
            }

            return(PluginConnectionResult.Success);
        }
Exemple #5
0
        /// <summary>
        /// 创建扩展程序实例
        /// </summary>
        /// <param name="FullClassName"></param>
        /// <returns></returns>
        protected virtual IExtendApp CreateExtendAppIns(string FullClassName)
        {
            IExtendApp newobj = null;
            IModule    m      = Lemon.ModuleLaunch(FullClassName);

            if (m != null)
            {
                if (m.GetType().GetInterface("IExtendApp") != null)
                {
                    newobj = (IExtendApp)m;
                }
            }
            return(newobj);
        }
Exemple #6
0
 /// <summary>
 /// 设置模块功能
 /// </summary>
 protected virtual void SetSwap(IExtendApp Papp)
 {
     if (Papp.GetType().GetInterface("IModule") == null)
     {
         return;
     }
     //((IModule)Papp).AddSwapping();
     //if (Papp.GetType().GetInterface("IModuleMapForm")!=null)
     //{
     //    ((IMainForm)this.Startup.SystemFrm).MapFormSwapData.Add(Papp.GetType().BaseType.FullName,(IModule)Papp);
     //}
     //else if (Papp.GetType().GetInterface("IModuleSystem")!=null)
     //{
     //    ((IMainForm)this.Startup.SystemFrm).SystemSwapData.Add(Papp.GetType().BaseType.FullName, (IModule)Papp);
     //}
 }
Exemple #7
0
        public PluginConnectionResult Connect(IPluginHost app)
        {
            IExtendApp _app = app as IExtendApp;

            if (_app != null)
            {
                Config.Init(this);

                RequestProxry req = new RequestProxry(_app, this);
                _app.Register(this, req.HandleGet, req.HandlePost);
                _app.MapExtendPluginRoute(this);
                _app.MapExtendPluginRoute(this, "wxm");
                this.init();
            }


            return(PluginConnectionResult.Success);
        }
Exemple #8
0
 internal RequestHandle(IExtendApp app)
 {
     this._app = app;
     //            workSpace = Config.PluginAttrs.WorkSpace;
     //            log = new LogFile(workSpace + "log.txt");
     //
     //            imgWidth = int.Parse(Config.PluginAttrs.Settings["img.width"]);
     //            imgHeight = int.Parse(Config.PluginAttrs.Settings["img.height"]);
     //
     //            if (Config.PluginAttrs.Settings.Contains("quality"))
     //            {
     //                quality = long.Parse(Config.PluginAttrs.Settings["quality"]);
     //            }
     //
     //            if (Config.PluginAttrs.Settings.Contains("compress"))
     //            {
     //                compress = long.Parse(Config.PluginAttrs.Settings["compress"]);
     //            }
     //
     //
     //            float waterMarkPercent = float.Parse(Config.PluginAttrs.Settings["img.water.percent"]);
     //            if (waterMarkPercent == 0F) waterMarkPercent = 1;
     //
     //            waterPath = workSpace + "watermark_resize.png";
     //            Image srcImg = new Bitmap(workSpace + "watermark.png");
     //            byte[] data = GraphicsHelper.DrawBySize(srcImg,
     //                ImageSizeMode.SuitWidth,
     //                (int)(srcImg.Width * waterMarkPercent),
     //                (int)(srcImg.Height * waterMarkPercent),
     //                ImageFormat.Png,
     //                100L,
     //                100L,
     //                null);
     //
     //            using (FileStream fs = new FileStream(waterPath, FileMode.OpenOrCreate, FileAccess.Write))
     //            {
     //                fs.Write(data, 0, data.Length);
     //                fs.Flush();
     //                fs.Dispose();
     //            }
     //
     //            srcImg.Dispose();
 }
Exemple #9
0
 internal RequestHandle(IExtendApp app)
 {
     this._app = app;
     //            workSpace = Config.PluginAttrs.WorkSpace;
     //            log = new LogFile(workSpace + "log.txt");
     //
     //            imgWidth = int.Parse(Config.PluginAttrs.Settings["img.width"]);
     //            imgHeight = int.Parse(Config.PluginAttrs.Settings["img.height"]);
     //
     //            if (Config.PluginAttrs.Settings.Contains("quality"))
     //            {
     //                quality = long.Parse(Config.PluginAttrs.Settings["quality"]);
     //            }
     //
     //            if (Config.PluginAttrs.Settings.Contains("compress"))
     //            {
     //                compress = long.Parse(Config.PluginAttrs.Settings["compress"]);
     //            }
     //
     //
     //            float waterMarkPercent = float.Parse(Config.PluginAttrs.Settings["img.water.percent"]);
     //            if (waterMarkPercent == 0F) waterMarkPercent = 1;
     //
     //            waterPath = workSpace + "watermark_resize.png";
     //            Image srcImg = new Bitmap(workSpace + "watermark.png");
     //            byte[] data = GraphicsHelper.DrawBySize(srcImg,
     //                ImageSizeMode.SuitWidth,
     //                (int)(srcImg.Width * waterMarkPercent),
     //                (int)(srcImg.Height * waterMarkPercent),
     //                ImageFormat.Png,
     //                100L,
     //                100L,
     //                null);
     //
     //            using (FileStream fs = new FileStream(waterPath, FileMode.OpenOrCreate, FileAccess.Write))
     //            {
     //                fs.Write(data, 0, data.Length);
     //                fs.Flush();
     //                fs.Dispose();
     //            }
     //
     //            srcImg.Dispose();
 }
Exemple #10
0
 public ManageHandle(IExtendApp app, IPlugin plugin)
 {
     this._app        = app;
     this._plugin     = plugin;
     this._baseHandle = new BaseHandle(app, plugin);
 }
Exemple #11
0
 public RequestProxry(IExtendApp app)
 {
     this._app = app;
     this._handler = new RequestHandle(app);
 }
Exemple #12
0
 public BaseHandle(IExtendApp app, IPlugin plugin)
 {
     this._app    = app;
     this._plugin = plugin;
 }
Exemple #13
0
 public RequestProxry(IExtendApp app)
 {
     this._app     = app;
     this._handler = new RequestHandle(app);
 }
Exemple #14
0
 public BaseHandle(IExtendApp app, IPlugin plugin)
 {
     this._app = app;
     this._plugin = plugin;
 }
Exemple #15
0
 public RequestProxry(IExtendApp app, IPlugin plugin)
 {
     this._app       = app;
     this._handler   = new RequestHandle(plugin);
     this._mgHandler = new ManageHandle(app, plugin);
 }
Exemple #16
0
 public ManageHandle(IExtendApp app,IPlugin plugin)
 {
     this._app = app;
     this._plugin = plugin;
     this._baseHandle = new BaseHandle(app,plugin);
 }
Exemple #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Papp"></param>
 protected virtual void SetPreEvent(IExtendApp Papp)
 {
     Protein.Enzyme.Design.ClassDrive cd = new Protein.Enzyme.Design.ClassDrive();
     cd.MethodDelegate(this.startup.SystemFrm
                       , "Prepose", Papp, "Launch");
 }
Exemple #18
0
 public RequestProxry(IExtendApp app, IPlugin plugin)
 {
     this._app = app;
     this._handler = new RequestHandle(plugin);
     this._mgHandler = new ManageHandle(app,plugin);
 }