private IntPtr HotKeyHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == WM_HOTKEY) { if (wParam.ToInt32() == 124) { new WelcomeWindow().Show(); this.WindowState = WindowState.Normal; this.Activate(); } else if (wParam.ToInt32() == 125) { new SaerchWindow().Show(); } else if (wParam.ToInt32() == 126) { new CaptureWindow().Show(); } else if (wParam.ToInt32() == 127) { Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"/Note.exe"); } else if (wParam.ToInt32() == 128) { He.SaveControlImage(this, "data.bmp"); } else if (wParam.ToInt32() == 129) { new MG().Show(); } } return(IntPtr.Zero); }
private void Font_SelectionChanged(object sender, SelectionChangedEventArgs e) { FontFamily = (Font.SelectedItem as ListBoxItem).FontFamily; He.Settings.FontFamilly = (Font.SelectedItem as ListBoxItem).FontFamily.Source; He.SaveSettings(); popup.IsOpen = false; }
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); } }; }
private void TX_MouseDown(object sender, MouseButtonEventArgs e) { Microsoft.Win32.OpenFileDialog o = new Microsoft.Win32.OpenFileDialog(); if (o.ShowDialog() == true) { var image = new System.Drawing.Bitmap(o.FileName); TX.Background = new ImageBrush(image.ToImageSource()); He.Settings.UserImage = o.FileName; He.SaveSettings(); } }
private void textBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { if (textBox.Text != "") { GetWeather(textBox.Text); He.Settings.WeatherInfo = textBox.Text; He.SaveSettings(); } } }
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++; } }
public static async System.Threading.Tasks.Task <string> NewText(string con) { HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create("https://git.oschina.net/TwilightLemon/Updata/raw/master/UNVTX"); hwr.Proxy = He.proxy; var o = await hwr.GetResponseAsync(); StreamReader sr = new StreamReader(o.GetResponseStream()); var st = He.Text(await sr.ReadToEndAsync(), "----UTX-START---", "----UTX-STOP---", 0); return(st.Replace(".", "\r\n")); }
private void Border_MouseDown(object sender, MouseButtonEventArgs e) { ListJson lj = new ListJson(); if (He.Settings.MusicList != "") { lj = MusicControl.JsonToObject(He.Settings.MusicList, lj) as ListJson; } lj.List.Add(new ListItem() { ItemText = (this.Music as Music) }); He.Settings.MusicList = MusicControl.ToJSON(lj); He.SaveSettings(); }
private void textBlock4_MouseDown(object sender, MouseButtonEventArgs e) { DOWN.Visibility = Visibility.Visible; listBox.Visibility = Visibility.Collapsed; string guid = "20D919A4D7700FBC424740E8CED80C6F"; string ioo = Uuuhh.GetWeb($"http://59.37.96.220/base/fcgi-bin/fcg_musicexpress2.fcg?version=12&miniversion=92&key=19914AA57A96A9135541562F16DAD6B885AC8B8B5420AC567A0561D04540172E&guid={guid}"); string vkey = He.Text(ioo, "key=\"", "\" speedrpttype", 0); string uri = $"http://182.247.250.19/streamoc.music.tc.qq.com/M500{musicid}.mp3?vkey={vkey}&guid={guid}"; WebClient dc = new WebClient(); dc.Proxy = He.proxy; dc.DownloadFileAsync(new Uri(uri), AppDomain.CurrentDomain.BaseDirectory + $@"MusicDownload/{textBlock1.Text}.mp3"); dc.DownloadFileCompleted += OK; dc.DownloadProgressChanged += DownloadFileCompleted; }
private void Window_MouseMove(object sender, MouseEventArgs e) { if (Left > SystemParameters.WorkArea.Height - 200) { (Resources["l"] as Storyboard).Begin(); } else { (Resources["r"] as Storyboard).Begin(); } var d = this.RestoreBounds; He.Settings.HaTop = new OnRect { x = d.X, y = d.Y, width = d.Width, height = d.Height }; He.SaveSettings(); }
private async void qrcode_MouseDown(object sender, MouseButtonEventArgs e) { wb.Navigate("http://ui.ptlogin2.qq.com/cgi-bin/login?appid=1006102&s_url=http://id.qq.com/index.html&hide_close_icon=1"); await Task.Delay(1000); string str = wb.Document.Body.OuterHtml; MatchCollection matches; matches = Regex.Matches(str, @"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase); var t = matches[1].Value.ToString(); Regex reg = new Regex(@"<img.*?src=""(?<src>[^""]*)""[^>]*>", RegexOptions.IgnoreCase); MatchCollection mc = reg.Matches(t); var content = mc[0].Groups["src"].Value; t = He.Text(content + "\"", "t=", "\"", 0); qrcode.Background = new ImageBrush(new BitmapImage(new Uri(content))); // op.IsOpen = true; index = 0; }
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 = "识别失败"; } }
public static async System.Threading.Tasks.Task <bool> IsLemonNew(string con) { try { HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create("https://git.oschina.net/TwilightLemon/Updata/raw/master/UNVTX"); hwr.Proxy = He.proxy; var o = await hwr.GetResponseAsync(); StreamReader sr = new StreamReader(o.GetResponseStream()); string html5 = He.Text(await sr.ReadToEndAsync(), "----UVN-START---", "----UVN-STOP---", 0); if (con == html5) { return(false); } else { return(true); } } catch { return(false); } }
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; }
private void Border_MouseDown_1(object sender, MouseButtonEventArgs e) { if (os == 0) { os = 1; RotateTransform rtf = new RotateTransform(); (sender as Border).RenderTransform = rtf; DoubleAnimation dbAscending = new DoubleAnimation(0, 170, TimeSpan.FromSeconds(0.3)); rtf.BeginAnimation(RotateTransform.AngleProperty, dbAscending); textBox1.Text = He.Settings.SearchUrl; } else { os = 0; RotateTransform rtf = new RotateTransform(); (sender as Border).RenderTransform = rtf; DoubleAnimation dbAscending = new DoubleAnimation(170, 0, TimeSpan.FromSeconds(0.3)); rtf.BeginAnimation(RotateTransform.AngleProperty, dbAscending); He.Settings.SearchUrl = textBox1.Text; He.SaveSettings(); textBox1.Text = "搜索"; } }
private async Task LoadapisAsync(string info = "news_hot") { try { jz.Text = "加载中"; jz.Visibility = Visibility.Visible; var s = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; ass = await Uuuhh.GetWebDataAsync($"https://www.toutiao.com/api/pc/feed/?category={info}&utm_source=toutiao&widen=1&tadrequire=true&max_behot_time={s}&max_behot_time_tmp={s}&as=A1156950D5231C8&cp=59051331BC08CE1", Encoding.UTF8); JObject o = JObject.Parse(ass); int i = 0; while (i++ != 5) { if (o["data"][i].ToString().Contains("广告") == true) { continue; } string title = o["data"][i]["title"].ToString(); string time = He.StampToDateTime(o["data"][i]["behot_time"].ToString()).ToString(); string sousce = o["data"][i]["source"].ToString(); string url = "http://www.toutiao.com" + o["data"][i]["source_url"].ToString(); string text = ""; if (o["data"][i].ToString().Contains("abstract") == true) { text = o["data"][i]["abstract"].ToString(); } WP.Children.Add(new NewsList(title, time, sousce, url, text) { Width = this.ActualWidth }); } jz.Visibility = Visibility.Collapsed; O.BeginAnimation(MarginProperty, new ThicknessAnimation(new Thickness(0, 86, 0, 0), new Thickness(0, 36, 0, 0), TimeSpan.FromSeconds(0.2))); } catch (Exception ex) { jz.Text = "加载失败"; Console.WriteLine(ex.Message); Console.WriteLine(ass); } }
private void border_MouseDown(object sender, MouseButtonEventArgs e) { this.Visibility = Visibility.Collapsed; He.Settings.MIDLIST.Remove(this.MID); He.SaveSettings(); }
private async void io(object sender, EventArgs e) { // try { s.Data = Geometry.Parse("M2.432,11.997L13.69,1.714c0.393-0.392,0.393-1.028,0-1.42c-0.393-0.392-1.031-0.392-1.424,0L0.286,11.236c-0.21,0.209-0.299,0.487-0.285,0.76c-0.014,0.274,0.075,0.551,0.285,0.76l11.98,10.942c0.393,0.392,1.031,0.392,1.424,0c0.393-0.392,0.393-1.028,0-1.42L2.432,11.997z"); string i = ""; if (listBox.SelectedIndex != listBox.Items.Count) { i = (listBox.Items[listBox.SelectedIndex + 1] as MusicItemControl).Content; listBox.SelectedItem = listBox.Items[listBox.SelectedIndex + 1]; } else { i = (listBox.Items[0] as MusicItemControl).Content; listBox.SelectedItem = listBox.Items[0]; } isR = true; textBlock1.Text = i; lrcname.Text = ((listBox.SelectedItem as MusicItemControl).Music as string[])[1]; zk.Text = ((listBox.SelectedItem as MusicItemControl).Music as string[])[3]; img = ((listBox.SelectedItem as MusicItemControl).Music as string[])[22]; He.on = $"https://y.gtimg.cn/music/photo_new/T002R300x300M000{img}.jpg"; tx.Background = new ImageBrush(new BitmapImage(new Uri(He.on))); musicid = ((listBox.SelectedItem as MusicItemControl).Music as string[])[20]; // if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3")) //{ // musicurl = $"http://cc.stream.qqmusic.qq.com/C100{musicid}.m4a?fromtag=52"; string guid = "20D919A4D7700FBC424740E8CED80C6F"; string ioo = Uuuhh.GetWeb($"http://59.37.96.220/base/fcgi-bin/fcg_musicexpress2.fcg?version=12&miniversion=92&key=19914AA57A96A9135541562F16DAD6B885AC8B8B5420AC567A0561D04540172E&guid={guid}"); string vkey = He.Text(ioo, "key=\"", "\" speedrpttype", 0); musicurl = $"http://182.247.250.19/streamoc.music.tc.qq.com/M500{musicid}.mp3?vkey={vkey}&guid={guid}"; player.Open(new Uri(musicurl)); player.Play(); t.Start(); //WebClient dc = new WebClient() //{ // Proxy = He.proxy //}; //dc.DownloadFileCompleted += Fis; //dc.DownloadFileAsync(new Uri(musicurl), AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3"); /////等待播放 //loading.Visibility = Visibility.Visible; // } // else // { // player.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.mp3")); // player.Play(); //t.Start(); // } if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{textBlock1.Text}.lrc")) { string lrc = ((listBox.SelectedItem as MusicItemControl).Music as string[])[0]; string lrcid = lrc.Substring(lrc.Length - 2, 2); // MessageBox.Show(He.Text(sr.ReadToEnd(), @"<lyric><![CDATA[", "]]></lyric>", 0)); FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.lrc", FileMode.Create); StreamWriter sw = new StreamWriter(fs); string ijo = He.Text(await Uuuhh.GetWebUAsync($"http://music.qq.com/miniportal/static/lyric/{lrcid}/{lrc}.xml"), @"<lyric><![CDATA[", "]]></lyric>", 0).Replace("'", "'"); if (ijo != "") { await sw.WriteAsync(ijo); await sw.FlushAsync(); sw.Close(); fs.Close(); if (LyricShow.IsOpenDeskLyric == false) { deskLyricWin = new DeskLyricWin(); deskLyricWin.Show(); LyricShow.openDeskLyric(deskLyricWin.textBlockDeskLyricFore, deskLyricWin.textBlockDeskLyricBack, deskLyricWin.canvasDeskLyricFore); LyricShow.HB = 204; LyricShow.HG = 122; LyricShow.HR = 0; LyricShow.CB = 193; LyricShow.CG = 180; LyricShow.CR = 180; } LyricShow.IsPauseLyricShow = false; getLT.getLyricAndLyricTimeByLyricPath(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{i}.lrc"); LyricShow.initializeLyricUI(getLT.LyricAndTimeDictionary);//解析歌词->得到歌词时间和歌词 } else { deskLyricWin.Close(); LyricShow.backInitial(); LyricShow.initializeLyricUI(null); LyricShow.IsPauseLyricShow = true; } } else { if (LyricShow.IsOpenDeskLyric == false) { deskLyricWin = new DeskLyricWin(); deskLyricWin.Show(); LyricShow.openDeskLyric(deskLyricWin.textBlockDeskLyricFore, deskLyricWin.textBlockDeskLyricBack, deskLyricWin.canvasDeskLyricFore); LyricShow.HB = 204; LyricShow.HG = 122; LyricShow.HR = 0; LyricShow.CB = 193; LyricShow.CG = 180; LyricShow.CR = 180; } LyricShow.IsPauseLyricShow = false; getLT.getLyricAndLyricTimeByLyricPath(AppDomain.CurrentDomain.BaseDirectory + $@"MusicCache/{textBlock1.Text}.lrc"); LyricShow.initializeLyricUI(getLT.LyricAndTimeDictionary);//解析歌词->得到歌词时间和歌词 } } // } // catch { deskLyricWin.Close(); LyricShow.backInitial(); LyricShow.initializeLyricUI(null); LyricShow.IsPauseLyricShow = true; } }