-
July 14th, 2013, 01:02 PM
#1
out of memory exception reading large files.
I am encrypting and storing 2 files in 1 and extracting it. Application like iExpress.or winzip or win rar.My code works but for big files it gives error out of memory exception
encrypting and storing section =
byte[] buffer = Properties.Resources.stub;
string sp = "[SPLITTER]";
File.WriteAllBytes(sfd.FileName, buffer);
byte[] file1 = Secure(File.ReadAllBytes(textBox1.Text));
byte[] file2 = Secure(File.ReadAllBytes(textBox2.Text));
File.AppendAllText(sfd.FileName, sp + Convert.ToBase64String(file1) + sp + F1 + sp + Convert.ToBase64String(file2) + sp + F2);
and here extracting and decrypting
string source = File.ReadAllText(Application.ExecutablePath);
string[] stringSeparators = new string[] { "[SPLITTER]" };
string[] Drop = source.Split(stringSeparators, StringSplitOptions.None);
byte[] file1 = Unsecure(Convert.FromBase64String(Drop[1]));
byte[] file2 = Unsecure(Convert.FromBase64String(Drop[3]));
File.WriteAllBytes(TempDir + Drop[2], file1);
File.WriteAllBytes(TempDir + Drop[4], file2);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|