c# 怎样为文件夹加密??
求高手帮忙提供给文件夹加密的方法,谢谢了~~
------解决方案--------------------/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
if(foldeOpen.ShowDialog ()==DialogResult.OK )
{
try
{
if(foldeOpen.SelectedPath .Substring (3,10)=="Documents ")
{
MessageBox.Show ("我不建议C盘下的文件夹伪装,这样可能会导致系统出问题");
}
else
{
AfoldePath.Text =foldeOpen.SelectedPath;
}
}
catch
{
if(foldeOpen.SelectedPath.Length >=4)
{
AfoldePath.Text =foldeOpen.SelectedPath;
}
else
{
MessageBox.Show ("无法对盘符进行伪装.");
}
}
}
}
private void AddPassword_Click(object sender, System.EventArgs e)
{
try
{
ProcessStartInfo p3=new ProcessStartInfo ("attrib.exe",@"-s -r -a -h "+AfoldePath.Text);
p3.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden;
Process.Start (p3);
ProcessStartInfo p1=new ProcessStartInfo ("attrib.exe",@"-s -r -a -h "+AfoldePath.Text+@"\desktop.ini");
p1.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden;
Process.Start (p1);
StreamWriter sw2=new StreamWriter (AfoldePath.Text+@"\desktop.ini" );
sw2.WriteLine (@"[.ShellClassInfo]" );
sw2.WriteLine ("CLSID="+GetPasType());
sw2.Close ();
ProcessStartInfo p =new ProcessStartInfo ("attrib.exe",@"+s +a +h +r "+AfoldePath.Text+@"\desktop.ini");
p.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden;
Process.Start (p);
ProcessStartInfo p2=new ProcessStartInfo ("attrib.exe",@"+s +r "+AfoldePath.Text);
p2.WindowStyle= System.Diagnostics.ProcessWindowStyle.Hidden;
Process.Start (p2);
}
catch(Exception ee)