资源简介
C#软件授权源码(亲测可用)
代码片段和文件信息
using System;
using System.IO;
using System.IO.Compression;
using System.Windows.Forms;
class clsZip
{
public void CompressFile(string sourceFile string destinationFile)
{
// make sure the source file is there
if (File.Exists(sourceFile) == false)
throw new FileNotFoundException();
// Create the streams and byte arrays needed
byte[] buffer = null;
FileStream sourceStream = null;
FileStream destinationStream = null;
GZipStream compressedStream = null;
try
{
// Read the bytes from the source file into a byte array
sourceStream = new FileStream(sourceFile FileMode.Open FileAccess.Read FileShare.Read);
// Read the source stream values into the buffer
buffer = new byte[sourceStream.Length];
int checkCounter = sourceStream.Read(buffer 0 buffer.Length);
if (checkCounter != buffer.Length)
{
throw new ApplicationException();
}
// Open the FileStream to write to
destinationStream = new FileStream(destinationFile FileMode.OpenOrCreate FileAccess.Write);
// Create a compression stream pointing to the destiantion stream
compressedStream = new GZipStream(destinationStream CompressionMode.Compress true);
// Now write the compressed data to the destination file
compressedStream.Write(buffer 0 buffer.Length);
}
catch (ApplicationException ex)
{
MessageBox.Show(ex.Message “压缩文件时发生错误:“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
finally
{
// Make sure we allways close all streams
if (sourceStream != null)
sourceStream.Close();
if (compressedStream != null)
compressedStream.Close();
if (destinationStream != null)
destinationStream.Close();
}
}
public void DecompressFile(string sourceFile string destinationFile)
{
// make sure the source file is there
if (File.Exists(sourceFile) == false)
throw new FileNotFoundException();
// Create the streams and byte arrays needed
FileStream sourceStream = null;
FileStream destinationStream = null;
GZipStream decompressedStream = null;
byte[] quartetBuffer = null;
try
{
// Read in the compressed source stream
sourceStream = new FileStream(sourceFile FileMode.Open);
// Create a compression stream pointing to the destiantion stream
decompressedStream = new GZipStream(sourceStream CompressionMode.Decompress true);
// Read the footer to determine the length of the destiantion file
quartetBuffer = new byte[4];
int
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9728 2019-02-28 15:05 C#软件授权源码(亲测可用)\使用前需知.doc
文件 10240 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\bin\Debug\许可安装.exe
文件 24064 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\bin\Debug\许可安装.pdb
文件 21656 2015-12-11 21:03 C#软件授权源码(亲测可用)\软件授权\许可安装\bin\Debug\许可安装.vshost.exe
文件 490 2013-03-18 17:00 C#软件授权源码(亲测可用)\软件授权\许可安装\bin\Debug\许可安装.vshost.exe.manifest
文件 4597 2015-12-11 20:53 C#软件授权源码(亲测可用)\软件授权\许可安装\clsZip.cs
文件 987 2019-01-31 14:06 C#软件授权源码(亲测可用)\软件授权\许可安装\Form1.cs
文件 3095 2019-01-31 14:06 C#软件授权源码(亲测可用)\软件授权\许可安装\Form1.Designer.cs
文件 6025 2019-01-31 14:06 C#软件授权源码(亲测可用)\软件授权\许可安装\Form1.resx
文件 791 2019-01-31 14:05 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6094 2019-01-31 14:04 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 709 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.csproj.FileListAbsolute.txt
文件 847 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.csproj.GenerateResource.Cache
文件 10240 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.exe
文件 180 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.Form1.resources
文件 24064 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.pdb
文件 180 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可安装\obj\Debug\许可安装.Properties.Resources.resources
文件 473 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Program.cs
文件 1366 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Properties\AssemblyInfo.cs
文件 2876 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Properties\Resources.Designer.cs
文件 5612 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Properties\Resources.resx
文件 1099 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Properties\Settings.Designer.cs
文件 249 2015-12-11 20:30 C#软件授权源码(亲测可用)\软件授权\许可安装\Properties\Settings.settings
文件 3584 2015-12-11 20:54 C#软件授权源码(亲测可用)\软件授权\许可安装\许可安装.csproj
文件 25745 2015-12-11 21:16 C#软件授权源码(亲测可用)\软件授权\许可打包\bin\Debug\Bin.dll
文件 9728 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可打包\bin\Debug\许可打包.exe
文件 24064 2015-12-11 21:08 C#软件授权源码(亲测可用)\软件授权\许可打包\bin\Debug\许可打包.pdb
文件 4597 2015-12-11 20:48 C#软件授权源码(亲测可用)\软件授权\许可打包\clsZip.cs
文件 612 2019-01-31 14:07 C#软件授权源码(亲测可用)\软件授权\许可打包\Form1.cs
文件 2834 2019-01-31 14:07 C#软件授权源码(亲测可用)\软件授权\许可打包\Form1.Designer.cs
............此处省略103个文件信息
- 上一篇:Winform可视化打印模板设计(完整版)
- 下一篇:C#手写识别程序源码(完整版)
相关资源
- C# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论