private void OnDataReceivedEventHandler(object sender, DataReceivedEventArgs args) { if(DataReceivedEventHandler != null) { DataReceivedEventHandler(sender, args); } }
private static void OnDataEvent(object sender, DataReceivedEventArgs e) { Console.WriteLine(e.Data.Length); var md5Byte = _Md5.ComputeHash(e.Data); var sb = new StringBuilder(); for(int i = 0; i < md5Byte.Length; ++i) { sb.Append(md5Byte[i].ToString("x2")); } var fileName = sb.ToString(); using (var ms = new MemoryStream(e.Data)) { Image.FromStream(ms).Save(fileName + ".jpg"); } }