Пример #1
0
        private void buttonItem30_Click(object sender, EventArgs e)
        {
            if (gridweb.CurrentCell == null)
            {
                return;
            }

            DataTable dt       = gridweb.DataSource as DataTable;
            int       rowindex = gridweb.CurrentCell.RowIndex;
            int       Id       = Convert.ToInt32(dt.Rows[rowindex]["Id"]);
            string    name     = dt.Rows[rowindex]["name"].ToString();
            string    ptype    = dt.Rows[rowindex]["plugintype"].ToString();
            string    srcpath  = dt.Rows[rowindex]["srcpath"].ToString();
            //string designdoc = dt.Rows[rowindex]["designdoc"].ToString();
            string url = CommonHelper.plugin_serverurl + srcpath;

            if (srcpath == "")
            {
                return;
            }

            string localpath = "";

            switch (ptype)
            {
            case "web":
                localpath = CommonHelper.WebPlatformPath + "\\ModulePlugin\\" + name + "_src.zip";
                break;

            case "winform":
                localpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name + "_src.zip";
                break;

            case "wcf":
                localpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name + "_src.zip";
                break;
            }

            frmprogress progress = new frmprogress();
            //下载
            UpDownLoadFileHelper updown = new UpDownLoadFileHelper();

            updown.Cdelegate = new UpDownLoadFileHelper.controldelegate(progress.refreshControl);
            updown.UpDown    = UpDownLoadFileHelper.updown.载;
            updown.Completed = delegate()
            {
                progress.Close();
                MessageBoxEx.Show("源代码下载完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            };
            updown.Cancelled = delegate()
            {
                progress.Close();
                MessageBoxEx.Show("下载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            };
            updown.Start(url, localpath);
            progress.ShowDialog();

            //MessageBoxEx.Show("暂未开放!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }
Пример #2
0
        //插件打包上传
        private void btnpackup_Click(object sender, EventArgs e)
        {
            try
            {
                if (File.Exists(prjpath + ".zip"))
                {
                    File.Delete(prjpath + ".zip");
                }

                string temp = prjpath + "_temp";
                Directory.CreateDirectory(temp);
                foreach (issueClass ic in plugin.issue)
                {
                    if (ic.type == "dir")
                    {
                        if (ic.source != "")
                        {
                            CommonHelper.CopyFolder(prjpath + "\\" + ic.source, temp + "\\" + ic.path);
                        }
                        else
                        {
                            if (Directory.Exists(prjpath + "\\" + ic.path))
                            {
                                CommonHelper.CopyFolder(prjpath + "\\" + ic.path, temp + "\\" + ic.path);
                            }
                            else
                            {
                                Directory.CreateDirectory(temp + "\\" + ic.path);
                            }
                        }
                    }
                    else if (ic.type == "file")
                    {
                        if (ic.source != "")
                        {
                            new FileInfo(prjpath + "\\" + ic.source).CopyTo(temp + "\\" + ic.path, true);
                        }
                        else
                        {
                            new FileInfo(prjpath + "\\" + ic.path).CopyTo(temp + "\\" + ic.path, true);
                        }
                    }
                }


                FastZipHelper.compress(temp, prjpath + ".zip");
                Directory.Delete(temp, true);
                //txtdownloadpath.Text = prjpath + ".zip";


                txtpluginsize.Text = CommonHelper.GetFileCountSize(prjpath + ".zip");


                frmprogress progress = new frmprogress();


                string url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=uploadfile";

                //上传
                UpDownLoadFileHelper updown = new UpDownLoadFileHelper();
                updown.Cdelegate = new UpDownLoadFileHelper.controldelegate(progress.refreshControl);
                updown.UpDown    = UpDownLoadFileHelper.updown.;
                updown.Completed = delegate()
                {
                    txtdownloadpath.Text = "/ModulePlugin/efwplus_website/pluginpackage/" + prjname + ".zip";
                    //System.Threading.Thread.Sleep(2000);
                    progress.Close();
                };
                updown.Cancelled = delegate()
                {
                    progress.Close();
                };
                updown.Start(url, prjpath + ".zip");
                progress.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("上传插件包失败!\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #3
0
        //更新插件
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridlocal.CurrentCell == null)
                {
                    return;
                }
                List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
                PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];

                string          url          = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=getplugin_client&name=" + pc.name;
                HttpWebResponse response     = HttpWebResponseUtility.CreateGetHttpResponse(url, null, null, null);
                string          ret          = HttpWebResponseUtility.GetHttpData(response);
                string          pversion     = (HttpWebResponseUtility.ToResult(ret) as JavaScriptObject)["pversion"].ToString();
                string          downloadpath = (HttpWebResponseUtility.ToResult(ret) as JavaScriptObject)["downloadpath"].ToString();
                string          p_url        = CommonHelper.plugin_serverurl + downloadpath;

                string path          = "";
                string localpath     = "";
                string pluginsysFile = "";
                if (pc.plugintype == "WebModulePlugin")
                {
                    path          = CommonHelper.WebPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WebPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WebPlatformPath + "\\Config\\pluginsys.xml";
                }
                else if (pc.plugintype == "WinformModulePlugin")
                {
                    path          = CommonHelper.WinformPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                }
                else if (pc.plugintype == "WcfModulePlugin")
                {
                    path          = CommonHelper.WinformPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                }
                PluginXmlManage.pluginfile = path;
                pluginxmlClass plugin = PluginXmlManage.getpluginclass();
                if (pversion == plugin.version)
                {
                    //MessageBox.Show("不用更新,已经是最新版的插件!");
                    MessageBoxEx.Show("不用更新,已经是最新版的插件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                frmprogress progress = new frmprogress();

                //下载
                UpDownLoadFileHelper updown = new UpDownLoadFileHelper();
                updown.Cdelegate = new UpDownLoadFileHelper.controldelegate(progress.refreshControl);
                updown.UpDown    = UpDownLoadFileHelper.updown.载;
                updown.Completed = delegate()
                {
                    progress.Close();
                    //先卸载原来插件
                    PluginSysManage.pluginsysFile = pluginsysFile;
                    PluginSysManage.DeletePlugin(pc.plugintype, pc.name);
                    Directory.Delete(new FileInfo(path).Directory.FullName, true);

                    //解压安装
                    if (CommonHelper.PluginSetup(localpath) == true)
                    {
                        File.Delete(localpath);
                        MessageBoxEx.Show("更新完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                };
                updown.Cancelled = delegate()
                {
                    progress.Close();

                    MessageBoxEx.Show("下载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                };
                updown.Start(p_url, localpath);
                progress.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("更新失败!\r\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #4
0
        //下载安装
        private void btnDownSetup_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridweb.CurrentCell == null)
                {
                    return;
                }

                DataTable dt           = gridweb.DataSource as DataTable;
                int       rowindex     = gridweb.CurrentCell.RowIndex;
                int       Id           = Convert.ToInt32(dt.Rows[rowindex]["Id"]);
                string    name         = dt.Rows[rowindex]["name"].ToString();
                string    title        = dt.Rows[rowindex]["title"].ToString();
                string    downloadpath = dt.Rows[rowindex]["downloadpath"].ToString();
                string    ptype        = dt.Rows[rowindex]["plugintype"].ToString();
                string    url          = CommonHelper.plugin_serverurl + downloadpath;

                string localpath = "";
                //string pluginpath = "";
                //string pluginsyspath = "";
                bool ishave = false;
                switch (ptype)
                {
                case "web":
                    localpath = CommonHelper.WebPlatformPath + "\\ModulePlugin\\" + name + ".zip";
                    //pluginpath = CommonHelper.WebPlatformPath + "\\ModulePlugin\\" + name;
                    //pluginsyspath = CommonHelper.WebPlatformPath + "\\Config\\pluginsys.xml";
                    PluginSysManage.pluginsysFile = CommonHelper.WebPlatformPath + "\\Config\\pluginsys.xml";
                    if (PluginSysManage.ContainsPlugin("WebModulePlugin", name))
                    {
                        ishave = true;
                    }
                    break;

                case "winform":
                    localpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name + ".zip";
                    //pluginpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name;
                    //pluginsyspath = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                    PluginSysManage.pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                    if (PluginSysManage.ContainsPlugin("WinformModulePlugin", name))
                    {
                        ishave = true;
                    }
                    break;

                case "wcf":
                    localpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name + ".zip";
                    //pluginpath = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + name;
                    //pluginsyspath = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                    PluginSysManage.pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                    if (PluginSysManage.ContainsPlugin("WcfModulePlugin", name))
                    {
                        ishave = true;
                    }
                    break;
                }
                //先判断此插件本地是否存在
                if (ishave == true)
                {
                    //MessageBox.Show("你选择的插件本地已安装!");
                    MessageBoxEx.Show("你选择的插件本地已安装!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                frmprogress progress = new frmprogress();

                //上传
                UpDownLoadFileHelper updown = new UpDownLoadFileHelper();
                updown.Cdelegate = new UpDownLoadFileHelper.controldelegate(progress.refreshControl);
                updown.UpDown    = UpDownLoadFileHelper.updown.载;
                updown.Completed = delegate()
                {
                    progress.Close();
                    //解压安装
                    if (CommonHelper.PluginSetup(localpath) == true)
                    {
                        File.Delete(localpath);
                        //MessageBox.Show("已下载,并且完成安装!");
                        MessageBoxEx.Show("已下载,并且完成安装!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadPluginData1("-1");//本地插件
                    }
                };
                updown.Cancelled = delegate()
                {
                    progress.Close();
                    //MessageBox.Show("下载失败!");
                    MessageBoxEx.Show("下载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                };
                updown.Start(url, localpath);
                progress.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("下载失败!\r\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }