示例#1
0
 private void OnDataReceivedEventHandler(object sender, DataReceivedEventArgs args)
 {
     if(DataReceivedEventHandler != null)
     {
         DataReceivedEventHandler(sender, args);
     }
 }
示例#2
0
文件: Program.cs 项目: xxy1991/cozy
        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");
            }
        }