C#文件加密方法匯總
本文實(shí)例匯總了C#文件加密方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
1、AES加密類
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Utils
{
/// <summary>
/// AES加密解密
/// </summary>
public class AES
{
#region 加密
#region 加密字符串
/// <summary>
/// AES 加密(高級(jí)加密標(biāo)準(zhǔn),是下一代的加密算法標(biāo)準(zhǔn),速度快,安全級(jí)別高,目前 AES 標(biāo)準(zhǔn)的一個(gè)實(shí)現(xiàn)是 Rijndael 算法)
/// </summary>
/// <param name="EncryptString">待加密密文</param>
/// <param name="EncryptKey">加密密鑰</param>
public static string AESEncrypt(string EncryptString, string EncryptKey)
{
return Convert.ToBase64String(AESEncrypt(Encoding.Default.GetBytes(EncryptString), EncryptKey));
}
#endregion
#region 加密字節(jié)數(shù)組
/// <summary>
/// AES 加密(高級(jí)加密標(biāo)準(zhǔn),是下一代的加密算法標(biāo)準(zhǔn),速度快,安全級(jí)別高,目前 AES 標(biāo)準(zhǔn)的一個(gè)實(shí)現(xiàn)是 Rijndael 算法)
/// </summary>
/// <param name="EncryptString">待加密密文</param>
/// <param name="EncryptKey">加密密鑰</param>
public static byte[] AESEncrypt(byte[] EncryptByte, string EncryptKey)
{
if (EncryptByte.Length == 0) { throw (new Exception("明文不得為空")); }
if (string.IsNullOrEmpty(EncryptKey)) { throw (new Exception("密鑰不得為空")); }
byte[] m_strEncrypt;
byte[] m_btIV = Convert.FromBase64String("Rkb4jvUy/ye7Cd7k89QQgQ==");
byte[] m_salt = Convert.FromBase64String("gsf4jvkyhye5/d7k8OrLgM==");
Rijndael m_AESProvider = Rijndael.Create();
try
{
MemoryStream m_stream = new MemoryStream();
PasswordDeriveBytes pdb = new PasswordDeriveBytes(EncryptKey, m_salt);
ICryptoTransform transform = m_AESProvider.CreateEncryptor(pdb.GetBytes(32), m_btIV);
CryptoStream m_csstream = new CryptoStream(m_stream, transform, CryptoStreamMode.Write);
m_csstream.Write(EncryptByte, 0, EncryptByte.Length);
m_csstream.FlushFinalBlock();
m_strEncrypt = m_stream.ToArray();
m_stream.Close(); m_stream.Dispose();
m_csstream.Close(); m_csstream.Dispose();
}
catch (IOException ex) { throw ex; }
catch (CryptographicException ex) { throw ex; }
catch (ArgumentException ex) { throw ex; }
catch (Exception ex) { throw ex; }
finally { m_AESProvider.Clear(); }
return m_strEncrypt;
}
#endregion
#endregion
#region 解密
#region 解密字符串
/// <summary>
/// AES 解密(高級(jí)加密標(biāo)準(zhǔn),是下一代的加密算法標(biāo)準(zhǔn),速度快,安全級(jí)別高,目前 AES 標(biāo)準(zhǔn)的一個(gè)實(shí)現(xiàn)是 Rijndael 算法)
/// </summary>
/// <param name="DecryptString">待解密密文</param>
/// <param name="DecryptKey">解密密鑰</param>
public static string AESDecrypt(string DecryptString, string DecryptKey)
{
return Convert.ToBase64String(AESDecrypt(Encoding.Default.GetBytes(DecryptString), DecryptKey));
}
#endregion
#region 解密字節(jié)數(shù)組
/// <summary>
/// AES 解密(高級(jí)加密標(biāo)準(zhǔn),是下一代的加密算法標(biāo)準(zhǔn),速度快,安全級(jí)別高,目前 AES 標(biāo)準(zhǔn)的一個(gè)實(shí)現(xiàn)是 Rijndael 算法)
/// </summary>
/// <param name="DecryptString">待解密密文</param>
/// <param name="DecryptKey">解密密鑰</param>
public static byte[] AESDecrypt(byte[] DecryptByte, string DecryptKey)
{
if (DecryptByte.Length == 0) { throw (new Exception("密文不得為空")); }
if (string.IsNullOrEmpty(DecryptKey)) { throw (new Exception("密鑰不得為空")); }
byte[] m_strDecrypt;
byte[] m_btIV = Convert.FromBase64String("Rkb4jvUy/ye7Cd7k89QQgQ==");
byte[] m_salt = Convert.FromBase64String("gsf4jvkyhye5/d7k8OrLgM==");
Rijndael m_AESProvider = Rijndael.Create();
try
{
MemoryStream m_stream = new MemoryStream();
PasswordDeriveBytes pdb = new PasswordDeriveBytes(DecryptKey, m_salt);
ICryptoTransform transform = m_AESProvider.CreateDecryptor(pdb.GetBytes(32), m_btIV);
CryptoStream m_csstream = new CryptoStream(m_stream, transform, CryptoStreamMode.Write);
m_csstream.Write(DecryptByte, 0, DecryptByte.Length);
m_csstream.FlushFinalBlock();
m_strDecrypt = m_stream.ToArray();
m_stream.Close(); m_stream.Dispose();
m_csstream.Close(); m_csstream.Dispose();
}
catch (IOException ex) { throw ex; }
catch (CryptographicException ex) { throw ex; }
catch (ArgumentException ex) { throw ex; }
catch (Exception ex) { throw ex; }
finally { m_AESProvider.Clear(); }
return m_strDecrypt;
}
#endregion
#endregion
}
}
2、文件加密類
using System.IO;
using System;
namespace Utils
{
/// <summary>
/// 文件加密類
/// </summary>
public class FileEncrypt
{
#region 變量
/// <summary>
/// 一次處理的明文字節(jié)數(shù)
/// </summary>
public static readonly int encryptSize = 10000000;
/// <summary>
/// 一次處理的密文字節(jié)數(shù)
/// </summary>
public static readonly int decryptSize = 10000016;
#endregion
#region 加密文件
/// <summary>
/// 加密文件
/// </summary>
public static void EncryptFile(string path, string pwd, RefreshFileProgress refreshFileProgress)
{
try
{
if (File.Exists(path + ".temp")) File.Delete(path + ".temp");
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
if (fs.Length > 0)
{
using (FileStream fsnew = new FileStream(path + ".temp", FileMode.OpenOrCreate, FileAccess.Write))
{
if (File.Exists(path + ".temp")) File.SetAttributes(path + ".temp", FileAttributes.Hidden);
int blockCount = ((int)fs.Length - 1) / encryptSize + 1;
for (int i = 0; i < blockCount; i++)
{
int size = encryptSize;
if (i == blockCount - 1) size = (int)(fs.Length - i * encryptSize);
byte[] bArr = new byte[size];
fs.Read(bArr, 0, size);
byte[] result = AES.AESEncrypt(bArr, pwd);
fsnew.Write(result, 0, result.Length);
fsnew.Flush();
refreshFileProgress(blockCount, i + 1); //更新進(jìn)度
}
fsnew.Close();
fsnew.Dispose();
}
fs.Close();
fs.Dispose();
FileAttributes fileAttr = File.GetAttributes(path);
File.SetAttributes(path, FileAttributes.Archive);
File.Delete(path);
File.Move(path + ".temp", path);
File.SetAttributes(path, fileAttr);
}
}
}
catch (Exception ex)
{
File.Delete(path + ".temp");
throw ex;
}
}
#endregion
#region 解密文件
/// <summary>
/// 解密文件
/// </summary>
public static void DecryptFile(string path, string pwd, RefreshFileProgress refreshFileProgress)
{
try
{
if (File.Exists(path + ".temp")) File.Delete(path + ".temp");
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
if (fs.Length > 0)
{
using (FileStream fsnew = new FileStream(path + ".temp", FileMode.OpenOrCreate, FileAccess.Write))
{
if (File.Exists(path + ".temp")) File.SetAttributes(path + ".temp", FileAttributes.Hidden);
int blockCount = ((int)fs.Length - 1) / decryptSize + 1;
for (int i = 0; i < blockCount; i++)
{
int size = decryptSize;
if (i == blockCount - 1) size = (int)(fs.Length - i * decryptSize);
byte[] bArr = new byte[size];
fs.Read(bArr, 0, size);
byte[] result = AES.AESDecrypt(bArr, pwd);
fsnew.Write(result, 0, result.Length);
fsnew.Flush();
refreshFileProgress(blockCount, i + 1); //更新進(jìn)度
}
fsnew.Close();
fsnew.Dispose();
}
fs.Close();
fs.Dispose();
FileAttributes fileAttr = File.GetAttributes(path);
File.SetAttributes(path, FileAttributes.Archive);
File.Delete(path);
File.Move(path + ".temp", path);
File.SetAttributes(path, fileAttr);
}
}
}
catch (Exception ex)
{
File.Delete(path + ".temp");
throw ex;
}
}
#endregion
}
/// <summary>
/// 更新文件加密進(jìn)度
/// </summary>
public delegate void RefreshFileProgress(int max, int value);
}
3、文件夾加密類
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Utils;
namespace EncryptFile.Utils
{
/// <summary>
/// 文件夾加密類
/// </summary>
public class DirectoryEncrypt
{
#region 加密文件夾及其子文件夾中的所有文件
/// <summary>
/// 加密文件夾及其子文件夾中的所有文件
/// </summary>
public static void EncryptDirectory(string dirPath, string pwd, RefreshDirProgress refreshDirProgress, RefreshFileProgress refreshFileProgress)
{
string[] filePaths = Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories);
for (int i = 0; i < filePaths.Length; i++)
{
FileEncrypt.EncryptFile(filePaths[i], pwd, refreshFileProgress);
refreshDirProgress(filePaths.Length, i + 1);
}
}
#endregion
#region 解密文件夾及其子文件夾中的所有文件
/// <summary>
/// 解密文件夾及其子文件夾中的所有文件
/// </summary>
public static void DecryptDirectory(string dirPath, string pwd, RefreshDirProgress refreshDirProgress, RefreshFileProgress refreshFileProgress)
{
string[] filePaths = Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories);
for (int i = 0; i < filePaths.Length; i++)
{
FileEncrypt.DecryptFile(filePaths[i], pwd, refreshFileProgress);
refreshDirProgress(filePaths.Length, i + 1);
}
}
#endregion
}
/// <summary>
/// 更新文件夾加密進(jìn)度
/// </summary>
public delegate void RefreshDirProgress(int max, int value);
}
4、跨線程訪問控制委托
using System;
using System.Windows.Forms;
namespace Utils
{
/// <summary>
/// 跨線程訪問控件的委托
/// </summary>
public delegate void InvokeDelegate();
/// <summary>
/// 跨線程訪問控件類
/// </summary>
public class InvokeUtil
{
/// <summary>
/// 跨線程訪問控件
/// </summary>
/// <param name="ctrl">Form對(duì)象</param>
/// <param name="de">委托</param>
public static void Invoke(Control ctrl, Delegate de)
{
if (ctrl.IsHandleCreated)
{
ctrl.BeginInvoke(de);
}
}
}
}
5、Form1.cs文件
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 Utils;
using System.Threading;
using EncryptFile.Utils;
namespace EncryptFile
{
public partial class Form1 : Form
{
#region 變量
/// <summary>
/// 一次處理的明文字節(jié)數(shù)
/// </summary>
public static int encryptSize = 10000000;
/// <summary>
/// 一次處理的密文字節(jié)數(shù)
/// </summary>
public static int decryptSize = 10000016;
#endregion
#region 構(gòu)造函數(shù)
public Form1()
{
InitializeComponent();
}
#endregion
#region 加密文件
private void btnEncrypt_Click(object sender, EventArgs e)
{
#region 驗(yàn)證
if (txtPwd.Text == "")
{
MessageBox.Show("密碼不能為空", "提示");
return;
}
if (txtPwdCfm.Text == "")
{
MessageBox.Show("確認(rèn)密碼不能為空", "提示");
return;
}
if (txtPwdCfm.Text != txtPwd.Text)
{
MessageBox.Show("兩次輸入的密碼不相同", "提示");
return;
}
#endregion
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Thread thread = new Thread(new ParameterizedThreadStart(delegate(object obj)
{
try
{
InvokeDelegate invokeDelegate = delegate()
{
pbFile.Value = 0;
lblProgressFile.Text = "0%";
pbDir.Visible = false;
lblProgressDir.Visible = false;
pbFile.Visible = false;
lblProgressFile.Visible = false;
lblShowPath.Text = "文件:" + openFileDialog1.FileName;
lblShowPath.Visible = true;
DisableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
DateTime t1 = DateTime.Now;
FileEncrypt.EncryptFile(openFileDialog1.FileName, txtPwd.Text, RefreshFileProgress);
DateTime t2 = DateTime.Now;
string t = t2.Subtract(t1).TotalSeconds.ToString("0.00");
if (MessageBox.Show("加密成功,耗時(shí)" + t + "秒", "提示") == DialogResult.OK)
{
invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
catch (Exception ex)
{
if (MessageBox.Show("加密失敗:" + ex.Message, "提示") == DialogResult.OK)
{
InvokeDelegate invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
}));
thread.Start();
}
}
#endregion
#region 解密文件
private void btnDecrypt_Click(object sender, EventArgs e)
{
#region 驗(yàn)證
if (txtPwd.Text == "")
{
MessageBox.Show("密碼不能為空", "提示");
return;
}
#endregion
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Thread thread = new Thread(new ParameterizedThreadStart(delegate(object obj)
{
try
{
InvokeDelegate invokeDelegate = delegate()
{
pbFile.Value = 0;
lblProgressFile.Text = "0%";
pbDir.Visible = false;
lblProgressDir.Visible = false;
pbFile.Visible = false;
lblProgressFile.Visible = false;
lblShowPath.Text = "文件:" + openFileDialog1.FileName;
lblShowPath.Visible = true;
DisableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
DateTime t1 = DateTime.Now;
FileEncrypt.DecryptFile(openFileDialog1.FileName, txtPwd.Text, RefreshFileProgress);
DateTime t2 = DateTime.Now;
string t = t2.Subtract(t1).TotalSeconds.ToString("0.00");
if (MessageBox.Show("解密成功,耗時(shí)" + t + "秒", "提示") == DialogResult.OK)
{
invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
catch (Exception ex)
{
if (MessageBox.Show("解密失?。? + ex.Message, "提示") == DialogResult.OK)
{
InvokeDelegate invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
}));
thread.Start();
}
}
#endregion
#region 文件夾加密
private void btnEncryptDir_Click(object sender, EventArgs e)
{
#region 驗(yàn)證
if (txtPwd.Text == "")
{
MessageBox.Show("密碼不能為空", "提示");
return;
}
if (txtPwdCfm.Text == "")
{
MessageBox.Show("確認(rèn)密碼不能為空", "提示");
return;
}
if (txtPwdCfm.Text != txtPwd.Text)
{
MessageBox.Show("兩次輸入的密碼不相同", "提示");
return;
}
#endregion
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
if (MessageBox.Show(string.Format("確定加密文件夾{0}?", folderBrowserDialog1.SelectedPath),
"提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
return;
}
Thread thread = new Thread(new ParameterizedThreadStart(delegate(object obj)
{
try
{
InvokeDelegate invokeDelegate = delegate()
{
pbDir.Value = 0;
lblProgressDir.Text = "0%";
pbFile.Value = 0;
lblProgressFile.Text = "0%";
pbDir.Visible = true;
lblProgressDir.Visible = true;
pbFile.Visible = false;
lblProgressFile.Visible = false;
lblShowPath.Text = "文件夾:" + folderBrowserDialog1.SelectedPath;
lblShowPath.Visible = true;
DisableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
DateTime t1 = DateTime.Now;
DirectoryEncrypt.EncryptDirectory(folderBrowserDialog1.SelectedPath, txtPwd.Text, RefreshDirProgress, RefreshFileProgress);
DateTime t2 = DateTime.Now;
string t = t2.Subtract(t1).TotalSeconds.ToString("0.00");
if (MessageBox.Show("加密成功,耗時(shí)" + t + "秒", "提示") == DialogResult.OK)
{
invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
catch (Exception ex)
{
if (MessageBox.Show("加密失敗:" + ex.Message, "提示") == DialogResult.OK)
{
InvokeDelegate invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
}));
thread.Start();
}
}
#endregion
#region 文件夾解密
private void btnDecryptDir_Click(object sender, EventArgs e)
{
#region 驗(yàn)證
if (txtPwd.Text == "")
{
MessageBox.Show("密碼不能為空", "提示");
return;
}
#endregion
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
if (MessageBox.Show(string.Format("確定解密文件夾{0}?", folderBrowserDialog1.SelectedPath),
"提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
return;
}
Thread thread = new Thread(new ParameterizedThreadStart(delegate(object obj)
{
try
{
InvokeDelegate invokeDelegate = delegate()
{
pbDir.Value = 0;
lblProgressDir.Text = "0%";
pbFile.Value = 0;
lblProgressFile.Text = "0%";
pbDir.Visible = true;
lblProgressFile.Visible = true;
pbFile.Visible = false;
lblProgressFile.Visible = false;
lblShowPath.Text = "文件夾:" + folderBrowserDialog1.SelectedPath;
lblShowPath.Visible = true;
DisableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
DateTime t1 = DateTime.Now;
DirectoryEncrypt.DecryptDirectory(folderBrowserDialog1.SelectedPath, txtPwd.Text, RefreshDirProgress, RefreshFileProgress);
DateTime t2 = DateTime.Now;
string t = t2.Subtract(t1).TotalSeconds.ToString("0.00");
if (MessageBox.Show("解密成功,耗時(shí)" + t + "秒", "提示") == DialogResult.OK)
{
invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
catch (Exception ex)
{
if (MessageBox.Show("解密失?。? + ex.Message, "提示") == DialogResult.OK)
{
InvokeDelegate invokeDelegate = delegate()
{
EnableBtns();
};
InvokeUtil.Invoke(this, invokeDelegate);
}
}
}));
thread.Start();
}
}
#endregion
#region 更新文件加密進(jìn)度
/// <summary>
/// 更新文件加密進(jìn)度
/// </summary>
public void RefreshFileProgress(int max, int value)
{
InvokeDelegate invokeDelegate = delegate()
{
if (max > 1)
{
pbFile.Visible = true;
lblProgressFile.Visible = true;
}
else
{
pbFile.Visible = false;
lblProgressFile.Visible = false;
}
pbFile.Maximum = max;
pbFile.Value = value;
lblProgressFile.Text = value * 100 / max + "%";
};
InvokeUtil.Invoke(this, invokeDelegate);
}
#endregion
#region 更新文件夾加密進(jìn)度
/// <summary>
/// 更新文件夾加密進(jìn)度
/// </summary>
public void RefreshDirProgress(int max, int value)
{
InvokeDelegate invokeDelegate = delegate()
{
pbDir.Maximum = max;
pbDir.Value = value;
lblProgressDir.Text = value * 100 / max + "%";
};
InvokeUtil.Invoke(this, invokeDelegate);
}
#endregion
#region 顯示密碼
private void cbxShowPwd_CheckedChanged(object sender, EventArgs e)
{
if (cbxShowPwd.Checked)
{
txtPwd.PasswordChar = default(char);
txtPwdCfm.PasswordChar = default(char);
}
else
{
txtPwd.PasswordChar = '*';
txtPwdCfm.PasswordChar = '*';
}
}
#endregion
#region 關(guān)閉窗體事件
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (progressPanel.Visible)
{
MessageBox.Show("正在處理文件,請(qǐng)等待…", "提示");
e.Cancel = true;
}
}
#endregion
#region 控制按鈕狀態(tài)
/// <summary>
/// 禁用按鈕
/// </summary>
public void DisableBtns()
{
progressPanel.Visible = true;
btnEncrypt.Enabled = false;
btnDecrypt.Enabled = false;
btnEncryptDir.Enabled = false;
btnDecryptDir.Enabled = false;
}
/// <summary>
/// 啟用按鈕
/// </summary>
public void EnableBtns()
{
lblShowPath.Visible = false;
progressPanel.Visible = false;
btnEncrypt.Enabled = true;
btnDecrypt.Enabled = true;
btnEncryptDir.Enabled = true;
btnDecryptDir.Enabled = true;
}
#endregion
}
}
完整實(shí)例代碼點(diǎn)擊此處本站下載。
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
- C#自定義RSA加密解密及RSA簽名和驗(yàn)證類實(shí)例
- 基于私鑰加密公鑰解密的RSA算法C#實(shí)現(xiàn)方法
- c# rsa注冊(cè)實(shí)現(xiàn)加密文字
- C#實(shí)現(xiàn)對(duì)AES加密和解密的方法
- c#多種加解密示例(md5加密解密)
- C#的3DES加密解密算法實(shí)例代碼
- C#加密解密文件小工具實(shí)現(xiàn)代碼
- 基于C#對(duì)用戶密碼使用MD5加密與解密
- C#常用字符串加密解密方法封裝代碼
- C#實(shí)現(xiàn)的AES加密解密完整實(shí)例
- c# 實(shí)現(xiàn)MD5,SHA1,SHA256,SHA512等常用加密算法源代碼
- C#編寫的Base64加密和解密類
- C# RSA分段加解密實(shí)現(xiàn)方法詳解
相關(guān)文章
Unity利用材質(zhì)自發(fā)光實(shí)現(xiàn)物體閃爍
這篇文章主要為大家詳細(xì)介紹了Unity利用材質(zhì)自發(fā)光實(shí)現(xiàn)物體閃爍,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-04-04C#畢業(yè)設(shè)計(jì)之Winform零壓健身房管理系統(tǒng)
本文介紹了個(gè)人的《零壓健身房管理系統(tǒng)(扁平化)》的基本流程和功能點(diǎn)的介紹,虛心接受各位的意見,歡迎在提出寶貴的意見,大家一起探討學(xué)習(xí)2021-09-09C# Record構(gòu)造函數(shù)的行為更改詳解
C# 9 中的record類型是僅具有只讀屬性的輕量級(jí)、不可變數(shù)據(jù)類型(或輕量級(jí)類),下面這篇文章主要給大家介紹了關(guān)于C# Record構(gòu)造函數(shù)的行為更改的相關(guān)資料,需要的朋友可以參考下2021-08-08C#實(shí)現(xiàn)創(chuàng)建標(biāo)簽PDF文件的示例代碼
標(biāo)簽PDF文件包含描述文檔結(jié)構(gòu)和各種文檔元素順序的元數(shù)據(jù),是一種包含后端提供的可訪問標(biāo)記,管理閱讀順序和文檔內(nèi)容表示的邏輯結(jié)構(gòu)的PDF文件。本文將用C#實(shí)現(xiàn)創(chuàng)建標(biāo)簽PDF文件,需要的可以參考一下2022-08-08C#程序提示“正由另一進(jìn)程使用,因此該進(jìn)程無法訪問該文件”的解決辦法
這篇文章主要介紹了C#程序提示“正由另一進(jìn)程使用,因此該進(jìn)程無法訪問該文件”的解決辦法,本文通過改寫程序代碼實(shí)現(xiàn)解決這個(gè)問題,需要的朋友可以參考下2015-06-06