• 大小: 439KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: C#
  • 标签: C#  源码  

资源简介

C# 文件加密器 源码 C# 文件加密器 源码

资源截图

代码片段和文件信息

/*
 * 程序名称:FileEncryption(文件加密)
 * 
 * 时    间:1:24 2010/1/17
 * 
 * 作    者:王文壮
 * 
 * 邮    箱:WangWenzhuang_net@163.com
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
using FileEncryption.Properties;

namespace FileEncryption
{
    public partial class MainForm : Form
    {

        #region 构造函数
        public MainForm()
        {
            InitializeComponent();
            this.skinEngine1.SkinStream = new MemoryStream(Resources.Calmness);
            this.textBoxFilePath.Text = FilePath;
            if (!string.IsNullOrEmpty(this.textBoxFilePath.Text))
            {
                this.textBoxPassword.Focus();
                this.textBoxPassword.Select();
            }
            else
            {
                this.buttonOpen.Focus();
                this.buttonOpen.Select();
            }
        }
        #endregion

        #region 变量

        #region 全局消息
        private string msg;
        #endregion

        #region 文件路径
        public static string FilePath;
        #endregion

        #endregion

        #region 事件

        #region 文件拖入窗体
        private void MainForm_DragDrop(object sender DragEventArgs e)
        {
            this.textBoxFilePath.Text = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            this.textBoxPassword.Focus();
            this.textBoxPassword.Select();
        }

        private void MainForm_DragEnter(object sender DragEventArgs e)
        {
            e.Effect = DragDropEffects.Copy;
        }
        #endregion

        #region 打开
        private void buttonOpen_Click(object sender EventArgs e)
        {
            if (this.openFileDialog.ShowDialog() == DialogResult.OK)
            {
                this.textBoxFilePath.Text = this.openFileDialog.FileName;
                this.textBoxPassword.Focus();
                this.textBoxPassword.Select();
            }
        }
        #endregion

        #region 单选按钮事件
        private void radioButton_Click(object sender EventArgs e)
        {
            JudgeWhetherTheButton();
        }
        #endregion

        #region 所有文本框Text值更改时判断按钮是否可用
        private void textBox_TextChanged(object sender EventArgs e)
        {
            JudgeWhetherTheButton();
        }
        #endregion

        #region 加密
        private void buttonEncrypt_Click(object sender EventArgs e)
        {
            if (this.IsPassword())
            {
                FilePath = this.textBoxFilePath.Text.Trim();
                if (!File.Exists(FilePath))
                {
                    this.msg = “文件不存在!“;
                }
                else
                {
                    byte[] expressly ciphertext;
                    try
      

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      20139  2010-05-26 23:14  FileEncryption\FileEncryption\bin\Release\Calmness.ssk

     文件        490  2009-06-11 05:14  FileEncryption\FileEncryption\bin\Release\FileEncryption.vshost.exe.manifest

     文件     516096  2009-04-03 14:37  FileEncryption\FileEncryption\bin\Release\IrisSkin2.dll

     文件     232960  2010-12-20 22:51  FileEncryption\FileEncryption\bin\Release\文件加密.exe

     文件      38400  2010-12-20 22:51  FileEncryption\FileEncryption\bin\Release\文件加密.pdb

     文件      11608  2010-12-20 22:51  FileEncryption\FileEncryption\bin\Release\文件加密.vshost.exe

     文件        490  2010-03-17 22:39  FileEncryption\FileEncryption\bin\Release\文件加密.vshost.exe.manifest

     文件       4309  2010-12-20 22:10  FileEncryption\FileEncryption\FileEncryption.csproj

     文件        573  2010-12-20 22:09  FileEncryption\FileEncryption\FileEncryption.csproj.user

     文件      97566  2009-05-12 19:54  FileEncryption\FileEncryption\FileEncryption.ico

     文件      14224  2010-05-27 00:50  FileEncryption\FileEncryption\MainForm.cs

     文件      12999  2010-05-26 22:47  FileEncryption\FileEncryption\MainForm.Designer.cs

     文件     152870  2010-05-26 22:47  FileEncryption\FileEncryption\MainForm.resx

     文件       5582  2010-12-20 22:10  FileEncryption\FileEncryption\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1495  2010-01-17 02:00  FileEncryption\FileEncryption\obj\Debug\FileEncryption.application

     文件       1624  2010-03-24 22:39  FileEncryption\FileEncryption\obj\Debug\FileEncryption.csproj.FileListAbsolute.txt

     文件        850  2010-03-13 19:50  FileEncryption\FileEncryption\obj\Debug\FileEncryption.csproj.GenerateResource.Cache

     文件     213504  2010-03-24 22:39  FileEncryption\FileEncryption\obj\Debug\FileEncryption.exe

     文件       2636  2010-01-17 02:00  FileEncryption\FileEncryption\obj\Debug\FileEncryption.exe.manifest

     文件      98132  2010-03-13 19:47  FileEncryption\FileEncryption\obj\Debug\FileEncryption.MainForm.resources

     文件      32256  2010-03-24 22:39  FileEncryption\FileEncryption\obj\Debug\FileEncryption.pdb

     文件        180  2010-03-13 19:47  FileEncryption\FileEncryption\obj\Debug\FileEncryption.Properties.Resources.resources

     文件       4608  2010-03-13 19:47  FileEncryption\FileEncryption\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        320  2010-01-20 16:43  FileEncryption\FileEncryption\obj\FileEncryption.csproj.FileList.txt

     文件       1206  2010-01-17 02:00  FileEncryption\FileEncryption\obj\FileEncryption.csproj.FileListAbsolute.txt

     文件       5673  2010-12-20 22:51  FileEncryption\FileEncryption\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache

     文件       2289  2010-12-20 22:51  FileEncryption\FileEncryption\obj\Release\FileEncryption.csproj.FileListAbsolute.txt

     文件        894  2010-05-26 22:48  FileEncryption\FileEncryption\obj\Release\FileEncryption.csproj.GenerateResource.Cache

     文件      98132  2010-12-20 22:12  FileEncryption\FileEncryption\obj\Release\FileEncryption.MainForm.resources

     文件      20353  2010-12-20 22:12  FileEncryption\FileEncryption\obj\Release\FileEncryption.Properties.Resources.resources

............此处省略29个文件信息

评论

共有 条评论