Ciao
Per studio, sto cercando di creare un programma per copiare file.
Ho problemi di permessi usando la classe FileStream.
Se lancio il Debug mi da questo errore:
System.UnauthorizedAccessException: 'Access to the path 'E:\' is denied.'
Aggiungo lo script:
fsIn = new FileStream(source, FileMode.Open);
fsOut = new FileStream(dest, FileMode.Create);
byte[] bt = new byte[1048756]; //1MB
int readByte;
while ((readByte = fsIn.Read(bt, 0, bt.Length)) > 0)
{
fsOut.Write(bt, 0, readByte);
worker.ReportProgress((int)(fsIn.Position * 100 / fsIn.Length));
}
fsIn.Close();
fsOut.Close();
Grazie anticipatamente
|