Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("是否压缩当前目录的所有文件夹,y:是 n:否");
            string s = Console.ReadLine();

            if (s == "y")
            {
                string        basepath    = AppDomain.CurrentDomain.BaseDirectory;
                DirectoryInfo basedirinfo = new DirectoryInfo(basepath);
                foreach (DirectoryInfo dir in basedirinfo.GetDirectories())
                {
                    FastZipHelper.compress(dir.FullName, dir.FullName + ".zip");
                    Console.WriteLine("正在压缩" + dir.FullName + "...");
                }
                Console.WriteLine("压缩完成");
                Console.ReadLine();
            }
        }
Esempio n. 2
0
        private void btnzip_Click(object sender, EventArgs e)
        {
            List <string> paths   = getexceptDir();
            string        srcfile = prjpath + "_src";

            if (File.Exists(srcfile + ".zip"))
            {
                File.Delete(srcfile + ".zip");
            }

            Directory.CreateDirectory(srcfile);

            CommonHelper.CopyFolder(prjpath, srcfile, paths);
            FastZipHelper.compress(srcfile, srcfile + ".zip");
            Directory.Delete(srcfile, true);

            srcfile_zip = srcfile + ".zip";
            isOk        = true;

            this.Close();
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        //安装插件升级包
        public static void SetUpPluginUpgrade()
        {
            string pufile = System.Windows.Forms.Application.StartupPath + "\\pluginupgrade.txt";

            if (File.Exists(pufile) == true)
            {
                List <string> addplugin    = new List <string>(); //新增插件
                List <string> updateplugin = new List <string>(); //更新插件
                List <string> deleteplugin = new List <string>(); //删除插件

                using (StreamReader sr = new StreamReader(pufile))
                {
                    string addrow = sr.ReadLine();
                    addplugin = addrow.Split(':')[1].Split(',').ToList();

                    string updaterow = sr.ReadLine();
                    updateplugin = updaterow.Split(':')[1].Split(',').ToList();

                    string deleterow = sr.ReadLine();
                    deleteplugin = deleterow.Split(':')[1].Split(',').ToList();
                }

                //删除
                File.Delete(pufile);

                foreach (string p in addplugin)
                {
                    if (p.Trim() != "")
                    {
                        string path = rootpath + "ModulePlugin\\" + p;
                        //删除本地插件
                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }
                        //解压插件包
                        string zipfile = rootpath + @"FileStore\PluginUpgrade\" + p + ".zip";
                        FastZipHelper.decompress(rootpath + "ModulePlugin\\", zipfile);
                        //修改pluginsys.xml配置文件
                        string pluginfile = "ModulePlugin\\" + p + "\\plugin.xml";
                        PluginSysManage.AddPlugin(pluginfile);
                    }
                }

                foreach (string p in updateplugin)
                {
                    if (p.Trim() != "")
                    {
                        string path = rootpath + "ModulePlugin\\" + p;
                        //删除本地插件
                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }
                        //解压插件包
                        string zipfile = rootpath + @"FileStore\PluginUpgrade\" + p + ".zip";
                        FastZipHelper.decompress(rootpath + "ModulePlugin\\", zipfile);
                        //修改pluginsys.xml配置文件
                        string pluginfile = "ModulePlugin\\" + p + "\\plugin.xml";
                        PluginSysManage.RemovePlugin(p);
                        PluginSysManage.AddPlugin(pluginfile);
                    }
                }

                foreach (string p in deleteplugin)
                {
                    if (p.Trim() != "")
                    {
                        string path = rootpath + "ModulePlugin\\" + p;
                        //修改pluginsys.xml配置文件
                        PluginSysManage.RemovePlugin(p);
                        //删除本地插件
                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }
                    }
                }
            }
        }