资源简介
c#对文件加密,代码测试通过,可以参考学习使用谢谢。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Security.Cryptography;
using Microsoft.Win32;
namespace ProtectFile
{
public partial class Frm_Main : Form
{
public Frm_Main()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
private void Form1_Load(object sender EventArgs e)
{
FileMenu(Application.ExecutablePath + “0“ Application.ExecutablePath);
string[] str = Environment.GetCommandLineArgs();
try
{
string strFile = ““;
for (int i = 2; i < str.Length; i++)
strFile += str[i];
FileInfo FInfo = new FileInfo(strFile);
if (FInfo.Extension.ToLower() == “.mr“)
{
textBox1.Text = strFile;
button2.Enabled = false;
button3.Enabled = true;
}
}
catch { }
}
//选择加密、解密文件
private void button1_Click(object sender EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog1.FileName;
FileInfo FInfo = new FileInfo(textBox1.Text);
if (FInfo.Extension.ToLower() == “.mr“)
{
button2.Enabled = false;
button3.Enabled = true;
}
else
{
button2.Enabled = true;
button3.Enabled = false;
}
}
}
//加密
private void button2_Click(object sender EventArgs e)
{
if (textBox1.Text != ““)
{
if (textBox2.Text.Length < 6)
MessageBox.Show(“密码不能小于6位!“ “警告“ MessageBoxButtons.OK MessageBoxIcon.Warning);
else
{
EDncrypt myEDncrypt = new EDncrypt(textBox1.Text textBox2.Text progressBar1);
myEDncrypt.StartEncrypt();
progressBar1.Value = 0;
}
}
}
//解密
private void button3_Click(object sender EventArgs e)
{
if (textBox1.Text != ““)
{
if (textBox2.Text.Length < 6)
MessageBox.Show(“密码不能小于6位!“ “警告“ MessageBoxButtons.OK MessageBoxIcon.Warning);
else
{
EDncrypt myEDncrypt = new EDncrypt(textBox1.Text textBox2.Text progressBar1);
myEDncrypt.StartDncrypt();
progressBar1.Value = 0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-03-27 17:41 ProtectFile\
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\
文件 8294 2016-12-21 17:08 ProtectFile\ProtectFile\Frm_Main.Designer.cs
文件 10801 2016-12-21 17:08 ProtectFile\ProtectFile\Frm_Main.cs
文件 6017 2016-12-21 17:08 ProtectFile\ProtectFile\Frm_Main.resx
文件 495 2016-12-21 17:08 ProtectFile\ProtectFile\Program.cs
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\Properties\
文件 1376 2016-12-21 19:31 ProtectFile\ProtectFile\Properties\AssemblyInfo.cs
文件 2862 2016-12-21 19:31 ProtectFile\ProtectFile\Properties\Resources.Designer.cs
文件 5612 2016-12-21 19:31 ProtectFile\ProtectFile\Properties\Resources.resx
文件 1111 2016-12-21 19:31 ProtectFile\ProtectFile\Properties\Settings.Designer.cs
文件 249 2016-12-21 19:31 ProtectFile\ProtectFile\Properties\Settings.settings
文件 4146 2016-12-21 17:08 ProtectFile\ProtectFile\ProtectFile.csproj
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\bin\
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\bin\Debug\
文件 16896 2016-12-21 21:30 ProtectFile\ProtectFile\bin\Debug\ProtectFile.exe
文件 40448 2016-12-21 21:30 ProtectFile\ProtectFile\bin\Debug\ProtectFile.pdb
文件 14328 2016-12-21 21:30 ProtectFile\ProtectFile\bin\Debug\ProtectFile.vshost.exe
文件 490 2016-12-21 21:30 ProtectFile\ProtectFile\bin\Debug\ProtectFile.vshost.exe.manifest
文件 766 2016-12-21 21:30 ProtectFile\ProtectFile\bin\Debug\加密.ico
目录 0 2018-08-11 11:36 ProtectFile\ProtectFile\bin\Release\
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\obj\
目录 0 2017-03-27 17:41 ProtectFile\ProtectFile\obj\Debug\
文件 7160 2016-12-21 21:30 ProtectFile\ProtectFile\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 180 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.Form1.resources
文件 180 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.Frm_Main.resources
文件 180 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.Properties.Resources.resources
文件 2673 2016-12-21 21:30 ProtectFile\ProtectFile\obj\Debug\ProtectFile.csproj.FileListAbsolute.txt
文件 908 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.csproj.GenerateResource.Cache
文件 16896 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.exe
文件 40448 2016-12-21 21:29 ProtectFile\ProtectFile\obj\Debug\ProtectFile.pdb
............此处省略5个文件信息
相关资源
- AES文件加密.rar
- c#文件加密解密工具含源码及工程文件
- C#文件加密解密及备份恢复工具
- C#作的文件加密器很不错的
- C#文件加密及其播放器(亲测可用)
- C# 文件加密器 源码
- RSA文件加解密C#源代码
- c#文件夹及文件加密
- C#文件加密解密完整项目
-
c#中对xm
l文件加密和解密完整代码 - C# exe文件加密源码
- AEC文件加密核心代码测试
- 文件加密解密软件设计含源文件
- DES文件加密和RSA字符串加密最终版.
- 文件加密解密软件
- .NET下用C#写的AES算法文件加密解密工
- C#文件加密
- 文件加密解密软件
- C# 二进制文件加密
- C# 文件加密工具源码
- C# EXE文件加密器源代码
- 用RSA证书文件加密和解密
- 文件加密解密程序
- C# 文件加密解密
- C# 文件加密解密(支持签名)
- C# 实现 文件加密保护的
- 文件加密、解密源码(可用于保护隐
评论
共有 条评论