private void Border_MouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         vce.Play();
         RenderTargetBitmap bmp = new RenderTargetBitmap(
             (int)vce.ActualWidth,
             (int)vce.ActualHeight,
             96, 96, PixelFormats.Default);
         bmp.Render(vce);
         BitmapEncoder encoder = new JpegBitmapEncoder();
         encoder.Frames.Add(BitmapFrame.Create(bmp));
         using (MemoryStream ms = new MemoryStream())
         {
             encoder.Save(ms);
             byte[] a = ms.ToArray();
             byte[] b = Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(He.lsd.NAME + ".FaceData"), FanyiBox.MD5.EncryptToMD5string(He.lsd.NAME + ".FaceData")));
             vce.Stop();
             var client = new Baidu.Aip.Face.Face("75bl82qIt9Rtly6Na6wqYUmm", "pMO9ZSQSsZFNvMMnXy5L3GaQbpWG6Fyw");
             var images = new byte[][] { a, b };
             var result = double.Parse(client.FaceMatch(images).First.First.Last.Last.First.ToString());
             if (result >= 90)
             {
                 if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + He.lsd.NAME + "@qq.com.st"))
                 {
                     He.Settings = (SettingsData)JSON.JsonToObject(Encoding.Default.GetString(Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + He.lsd.NAME + "@qq.com.st"), FanyiBox.MD5.EncryptToMD5string(He.lsd.NAME + "@qq.com.st")))), He.Settings);
                 }
                 else
                 {
                     He.SaveSettings(He.lsd.NAME + "@qq.com");
                 }
                 (Resources["OnLoaded1"] as Storyboard).Begin();
                 tr.Start();
             }
             else
             {
                 txb.Text = "识别失败";
             }
         }
     }
     catch { txb.Text = "识别失败"; }
 }
        private async void NaAsync(object sender, WebBrowserNavigatedEventArgs e)
        {
            if (index != 0)
            {
                if (wb.DocumentTitle == "我的QQ中心")
                {
                    op.IsOpen = false;
                    var qq = He.Text(wb.Document.Cookie, "uin=o", ";", 0);
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + qq + @"@qq.com.st"))
                    {
                        He.Settings = (SettingsData)JSON.JsonToObject(Encoding.Default.GetString(Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + qq + @"@qq.com.st"), FanyiBox.MD5.EncryptToMD5string(qq + "@qq.com.st")))), He.Settings);
                    }
                    else
                    {
                        He.SaveSettings(qq + "@qq.com");
                    }
                    var     sl = He.Text(await Uuuhh.GetWebAsync("http://r.pengyou.com/fcg-bin/cgi_get_portrait.fcg?uins=" + qq, Encoding.Default), "portraitCallBack(", ")", 0);
                    JObject o  = JObject.Parse(sl);
                    try
                    {
                        await Uuuhh.HttpDownloadFileAsync($"http://q2.qlogo.cn/headimg_dl?bs=qq&dst_uin={qq}&spec=100", AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg");

                        var image = new System.Drawing.Bitmap(AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg");
                        TX.Background = new ImageBrush(image.ToImageSource());
                    }
                    catch { }
                    He.Settings.RobotName      = o[qq][6].ToString();
                    He.Settings.UserImage      = AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg";
                    He.Settings.LemonAreeunIts = qq + "@qq.com";
                    He.Settings.RNBM           = (Boolean)RM.IsChecked;
                    He.SaveSettings();
                    He.lsd.NAME = qq;
                    He.lsd.RNBM = (Boolean)RM.IsChecked;
                    He.lsd.TX   = AppDomain.CurrentDomain.BaseDirectory + qq + ".jpg";
                    He.SaveLoadSettings();
                    (Resources["OnLoaded1"] as Storyboard).Begin();
                    tr.Start();
                }
                else if (wb.DocumentText.Contains("安全验证"))
                {
                    op.IsOpen = true;
                    rk.Text   = "请输入验证码";
                }
                else
                {
                    rk.Text = "登录失败,请检查账号和密码."; op.IsOpen = false;
                }
            }
            else
            {
                index++;
            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (He.lsd.RNBM)
     {
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + He.lsd.NAME + "@qq.com.st"))
         {
             He.Settings = (SettingsData)JSON.JsonToObject(Encoding.Default.GetString(Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + He.lsd.NAME + "@qq.com.st"), FanyiBox.MD5.EncryptToMD5string(He.lsd.NAME + "@qq.com.st")))), He.Settings);
         }
         else
         {
             He.SaveSettings(He.lsd.NAME + "@qq.com");
         }
         (Resources["OnLoaded1"] as Storyboard).Begin();
         tr.Start();
     }
     Email.Text = He.lsd.NAME;
     if (System.IO.File.Exists(He.lsd.TX))
     {
         var image = new System.Drawing.Bitmap(He.lsd.TX);
         TX.Background = new ImageBrush(image.ToImageSource());
     }
     RM.IsChecked = He.lsd.RNBM;
 }
Example #4
0
 public App()//
 {
     if (He.Settings.isWebProxy)
     {
         if (He.Settings.WebProxyUri != "")
         {
             He.proxy.Address     = new Uri(He.Settings.WebProxyUri);
             He.proxy.Credentials = new NetworkCredential(He.Settings.WebProxyUser, He.Settings.WebProxyPassWord);
         }
     }
     if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"Settings.st"))
     {
         He.lsd = (LoadSettingsData)JSON.JsonToObject(Encoding.Default.GetString(Convert.FromBase64String(He.TextDecrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"Settings.st"), FanyiBox.MD5.EncryptToMD5string("Settings.st")))), He.lsd);
     }
     else
     {
         He.SaveLoadSettings();
     }
     Current.DispatcherUnhandledException       += Current_DispatcherUnhandledException;
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     Startup += delegate {
         bool ret;
         mutex = new Mutex(true, "Lemon App", out ret);
         if (!ret)
         {
             Environment.Exit(0);
         }
     };
 }