コード例 #1
0
        /// <summary>
        /// 解压安装包
        /// </summary>
        void ExtractPackage(BackgroundWorker worker, DoWorkEventArgs e111)
        {
            Trace.TraceInformation("开始解压缩升级包");
            OnPackageExtractionBegin(new PackageEventArgs(null));

            var count = Packages.Count;
            var index = 0;
            var fze   = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();

            fze.ProcessFile += (s, e) => worker.ReportProgress(Utility.GetPercentProgress(index, count), $"正在解压缩:{e.Name}");
            var fz = new ICCEmbedded.SharpZipLib.Zip.FastZip(fze);

            if (!string.IsNullOrEmpty(Context.UpdateMeta.PackagePassword))
            {
                fz.Password = Context.UpdateMeta.PackagePassword;
            }

            foreach (var pkg in Packages)
            {
                index++;

                Trace.TraceInformation("正在解压缩 " + pkg.Name);
                OnPackageExtractionBegin(new PackageEventArgs(pkg));

                fz.ExtractZip(pkg.LocalSavePath, Context.UpdateNewFilePath, null);

                OnPackageExtractionEnd(new PackageEventArgs(pkg));
                Trace.TraceInformation("完成解压缩 " + pkg.Name);
            }

            OnPackageExtractionEnd(new PackageEventArgs(null));
            Trace.TraceInformation("完成解压缩升级包");
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: goldmon/BPiaoBao
 /// <summary>
 /// 文件解压
 /// </summary>
 /// <param name="zipFilePath"></param>
 /// <param name="targetDir"></param>
 private void UnZipFile(string zipFilePath, string targetDir)
 {
     if (!File.Exists(zipFilePath))
     {
         throw new Exception("文件不存在!");
     }
     ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
     ICCEmbedded.SharpZipLib.Zip.FastZip       fz  = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
     fz.ExtractZip(zipFilePath, targetDir, "");
 }
コード例 #3
0
 private static void UnZipFile(string zipFilePath, string targetDir)
 {
     try
     {
         ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
         ICCEmbedded.SharpZipLib.Zip.FastZip       fz  = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
         fz.ExtractZip(zipFilePath, targetDir, "");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 private void UnZipFile(string zipFilePath, string targetDir)
 {
     try
     {
         ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
         ICCEmbedded.SharpZipLib.Zip.FastZip       fz  = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
         fz.ExtractZip(zipFilePath, targetDir, "");
     }
     catch (Exception ex)
     {
         WriteLogHelper.WriteLog_client("UnZipFile error", ex);
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: zecak/CarryBag
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var files = System.IO.Directory.GetFiles(txtDir.Text, "随身袋.exe");
                if (files.Length == 1)
                {
                    System.Diagnostics.FileVersionInfo fv = System.Diagnostics.FileVersionInfo.GetVersionInfo(System.IO.Path.GetFullPath(files[0]));
                    var asmTitle = fv.ProductName;
                    var asmVer = fv.ProductVersion;
                    txtAppName.Text = asmTitle;
                    txtCVer.Text = asmVer;
                    System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.GetFullPath(files[0]));
                    txtUpdateTime.Text = file.LastWriteTime.ToShortDateString();
                }

                txtDes.Text = System.IO.File.ReadAllText((@"..\..\..\随身袋\bin\Release\CarryBag\使用说明.txt"));

                System.IO.File.Delete("update.zip");

                ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
                ICCEmbedded.SharpZipLib.Zip.FastZip fz = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
                fz.CreateZip("update.zip", txtDir.Text, true, "");

                System.IO.FileInfo file2 = new System.IO.FileInfo(System.IO.Path.GetFullPath("update.zip"));
                txtPackageSize.Text = file2.Length.ToString();

                UpdateInfo uinfo = new UpdateInfo();
                uinfo.AppName = txtAppName.Text;
                uinfo.AppVersion = txtCVer.Text;
                uinfo.Desc = txtDes.Text;
                uinfo.RequiredMinVersion = txtMinVer.Text;
                uinfo.PackageName = txtPackageName.Text;
                uinfo.PackageSize = txtPackageSize.Text;
                uinfo.UpdateTime = txtUpdateTime.Text;

                EasyFramework.Serialize.XMLHelper.Serialize("update.xml", uinfo);
            }
            catch { }
        }
コード例 #6
0
		/// <summary>
		/// 解开安装包
		/// </summary>
		void ExtractPackage(RunworkEventArgs rt)
		{
			Trace.TraceInformation("开始解压缩升级包");
			rt.PostEvent(() => OnPackageExtractionBegin(new PackageEventArgs(null)));

			var fze = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
			fze.ProcessFile += (s, e) => rt.ReportProgress(0, 0, string.Format(SR.Updater_ExtractingFile, e.Name));
			var fz = new ICCEmbedded.SharpZipLib.Zip.FastZip(fze);
			if (!string.IsNullOrEmpty(Context.UpdateInfo.PackagePassword))
			{
				fz.Password = Context.UpdateInfo.PackagePassword;
			}

			foreach (var pkg in PackagesToUpdate)
			{
				Trace.TraceInformation("正在解压缩 " + pkg.PackageName);
				rt.PostEvent(() => OnPackageExtractionBegin(new PackageEventArgs(pkg)));

				fz.ExtractZip(pkg.LocalSavePath, Context.UpdateNewFilePath, null);

				rt.PostEvent(() => OnPackageExtractionEnd(new PackageEventArgs(pkg)));
				Trace.TraceInformation("完成解压缩 " + pkg.PackageName);
			}

			rt.PostEvent(() => OnPackageExtractionEnd(new PackageEventArgs(null)));
			Trace.TraceInformation("完成解压缩升级包");
		}
コード例 #7
0
 private static void UnZipFile(string zipFilePath, string targetDir)
 {
     ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
     ICCEmbedded.SharpZipLib.Zip.FastZip       fz  = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
     fz.ExtractZip(zipFilePath, targetDir, "");
 }
コード例 #8
0
 private static void UnZipFile(string zipFilePath, string targetDir)
 {
     ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
     ICCEmbedded.SharpZipLib.Zip.FastZip fz = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
     fz.ExtractZip(zipFilePath, targetDir, "");
 }
コード例 #9
0
ファイル: Updater.cs プロジェクト: jiguixin/MyLibrary
 /// <summary>
 /// 解开安装包
 /// </summary>
 void ExtractPackage(RunworkEventArgs e)
 {
     e.ReportProgress(0, 0, Infrastructure.Crosscutting.Updater.SR.Updater_ExtractPackage);
     ICCEmbedded.SharpZipLib.Zip.FastZipEvents evt = new ICCEmbedded.SharpZipLib.Zip.FastZipEvents();
     evt.ProcessFile += (s, f) =>
     {
         e.ReportProgress(0, 0, "正在解压缩 " + System.IO.Path.GetFileName(f.Name));
     };
     ICCEmbedded.SharpZipLib.Zip.FastZip fz = new ICCEmbedded.SharpZipLib.Zip.FastZip(evt);
     if (!string.IsNullOrEmpty(UpdateInfo.PackagePassword)) fz.Password = UpdateInfo.PackagePassword;
     fz.ExtractZip(UpdatePackageFilePath, UpdateSourceDirectory, "");
 }