public static Img FromHashedFile(string str, string stringKey, CallBackDelegate callBack, LogDelegate Log) { string newStr = null; Log("Parsing key.."); List <int> key = Img.ParseKey(stringKey, callBack); Log("Key parsed successfully..\nUnhashing the file using the key.."); newStr = Img.Unhash(str, key, callBack); Log("Done"); Img img = Img.FromBase64String(newStr, false); img.IsHashed = true; img.HashedBase64String = newStr; return(img); }
private void OpenFile(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { Log("Loading file.."); Thread LoadFileThread = new Thread(() => { try { Img = Img.FromBase64String(openFileDialog.FileName, true); Log("File loaded successfully.."); pictureBox1.Image = Img.Image; } catch (Exception) { MessageBox.Show("An error has occured. Make sure that you've selected valid file type and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log("", false); } }); LoadFileThread.Start(); } }