Esempio n. 1
0
        private void InitPlugin()
        {
            List <PluginClass> plist  = new List <PluginClass>();
            List <PluginClass> plist2 = PluginSysManage.GetAllPlugin();

            plist.AddRange(plist2.FindAll(x => (x.plugintype == "WcfModulePlugin")));

            for (int i = 0; i < plist.Count; i++)
            {
                FileInfo finfo = new FileInfo(PluginSysManage.localpath + "\\" + plist[i].path);
                PluginXmlManage.pluginfile = finfo.FullName;
                pluginxmlClass plugin = PluginXmlManage.getpluginclass();
                plist[i].version = plugin.version;
                plist[i].author  = plugin.author;
            }
            gridlocal.DataSource = plist;
        }
Esempio n. 2
0
        private void btnPack_Click(object sender, EventArgs e)
        {
            if (gridlocal.CurrentCell == null)
            {
                return;
            }
            List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
            PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];


            saveFileDialog.FileName = pc.name;
            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string bagpath = saveFileDialog.FileName;
                if (File.Exists(bagpath))
                {
                    File.Delete(bagpath);
                }

                string   path    = PluginSysManage.localpath + "\\" + pc.path;
                string   prjname = null;
                string   prjpath = null;
                FileInfo finfo   = new FileInfo(path);
                if (finfo.Exists)
                {
                    prjpath = finfo.Directory.FullName;
                    prjname = finfo.Directory.Name;
                }
                PluginXmlManage.pluginfile = path;
                pluginxmlClass plugin = PluginXmlManage.getpluginclass();

                string temp = prjpath + "_temp";
                Directory.CreateDirectory(temp);
                foreach (issueClass ic in plugin.issue)
                {
                    if (ic.type == "dir")
                    {
                        if (ic.source != "")
                        {
                            CopyFolder(prjpath + "\\" + ic.source, temp + "\\" + ic.path);
                        }
                        else
                        {
                            if (Directory.Exists(prjpath + "\\" + ic.path))
                            {
                                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, bagpath);
                Directory.Delete(temp, true);
            }
        }