hola a todos, hoy les queria preguntar sobre un error de un código:
[System.Runtime.InteropServices.DllImport("KERNEL32.DLL", EntryPoint = "RtlZeroMemory")]
public static extern bool ZeroMemory(ref string Destination, int Length);
static void EncryptFile(string sInputFilename,
string sOutputFilename,
string sKey)
{
FileStream fsInput = new FileStream(sInputFilename,
FileMode.Open,
FileAccess.Read);
FileStream fsEncrypted = new FileStream(sOutputFilename,
FileMode.Create,
FileAccess.Write);
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
ICryptoTransform desencrypt = DES.CreateEncryptor();
CryptoStream cryptostream = new CryptoStream(fsEncrypted,
desencrypt,
CryptoStreamMode.Write);
byte[] bytearrayinput = new byte[fsInput.Length - 1];
fsInput.Read(bytearrayinput, 0, bytearrayinput.Length);
cryptostream.Write(bytearrayinput, 0, bytearrayinput.Length);
}
y el error que me da es este:
Excepción no controlada del tipo 'System.IO.IOException' en mscorlib.dll
Información adicional: El proceso no puede obtener acceso al archivo 'C:\Users\Admin\Documents\Visual Studio 2015\Projects\ingresos y gastos\ingresos y gastos\bin\x64\Debug\0.ig' porque está siendo utilizado en otro proceso.
si alguien me puede ayudar se lo agradeceria mucho.
un cordial saludo.