private async void WordBorderControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) { Clipboard.SetText(Word); if (Settings.Default.ShowToast && IsFromEditWindow == false) { NotificationUtilities.ShowToast(Word); } if (IsFromEditWindow == true) { WindowUtilities.AddTextToOpenWindow(Word); } if (IsSelected) { await Task.Delay(100); Deselect(); } else { await Task.Delay(100); Select(); } }
public ServerScriptModelNorificationModel(Context context, SiteSettings ss, int Id) { Context = context; SiteSettings = ss; notification = NotificationUtilities.Get(context: Context, ss: SiteSettings) ?.Where(o => o.Id == Id) .FirstOrDefault(); }
public static IEnumerator TakeScreenshot() { Player plr = OptimizationVariables.MainPlayer; SteamChannel channel = plr.channel; switch (MiscOptions.AntiSpyMethod) { case 0: { if (Time.realtimeSinceStartup - LastSpy < MiscOptions.MinTimeBetweenSpy || IsSpying) // Checks for spam spy { yield break; } IsSpying = true; LastSpy = Time.realtimeSinceStartup; if (!MiscOptions.PanicMode) { DisableAllVisuals(); } yield return(new WaitForFixedUpdate()); yield return(new WaitForEndOfFrame()); Texture2D screenshotRaw = new Texture2D(Screen.width, Screen.height, (TextureFormat)3, false) { name = "Screenshot_Raw", hideFlags = (HideFlags)61 }; screenshotRaw.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0, false); Texture2D screenshotFinal = new Texture2D(640, 480, (TextureFormat)3, false) { name = "Screenshot_Final", hideFlags = (HideFlags)61 }; Color[] oldColors = screenshotRaw.GetPixels(); Color[] newColors = new Color[screenshotFinal.width * screenshotFinal.height]; float widthRatio = screenshotRaw.width / (float)screenshotFinal.width; float heightRatio = screenshotRaw.height / (float)screenshotFinal.height; for (int i = 0; i < screenshotFinal.height; i++) { int num = (int)(i * heightRatio) * screenshotRaw.width; int num2 = i * screenshotFinal.width; for (int j = 0; j < screenshotFinal.width; j++) { int num3 = (int)(j * widthRatio); newColors[num2 + j] = oldColors[num + num3]; } } screenshotFinal.SetPixels(newColors); byte[] data = screenshotFinal.EncodeToJPG(33); if (data.Length < 30000) { channel.longBinaryData = true; channel.openWrite(); channel.write(data); channel.closeWrite("tellScreenshotRelay", ESteamCall.SERVER, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); channel.longBinaryData = false; } yield return(new WaitForFixedUpdate()); yield return(new WaitForEndOfFrame()); IsSpying = false; if (!MiscOptions.PanicMode) { EnableAllVisuals(); } break; } case 1: { System.Random r = new System.Random(); string[] files = Directory.GetFiles(MiscOptions.AntiSpyPath); byte[] dataRaw = File.ReadAllBytes(files[r.Next(files.Length)]); Texture2D texRaw = new Texture2D(2, 2); texRaw.LoadImage(dataRaw); Texture2D screenshotFinal = new Texture2D(640, 480, (TextureFormat)3, false) { name = "Screenshot_Final", hideFlags = (HideFlags)61 }; Color[] oldColors = texRaw.GetPixels(); Color[] newColors = new Color[screenshotFinal.width * screenshotFinal.height]; float widthRatio = texRaw.width / (float)screenshotFinal.width; float heightRatio = texRaw.height / (float)screenshotFinal.height; for (int i = 0; i < screenshotFinal.height; i++) { int num = (int)(i * heightRatio) * texRaw.width; int num2 = i * screenshotFinal.width; for (int j = 0; j < screenshotFinal.width; j++) { int num3 = (int)(j * widthRatio); newColors[num2 + j] = oldColors[num + num3]; } } screenshotFinal.SetPixels(newColors); byte[] data = screenshotFinal.EncodeToJPG(33); if (data.Length < 30000) { channel.longBinaryData = true; channel.openWrite(); channel.write(data); channel.closeWrite("tellScreenshotRelay", ESteamCall.SERVER, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); channel.longBinaryData = false; } break; } case 2: break; case 3: { yield return(new WaitForFixedUpdate()); yield return(new WaitForEndOfFrame()); Texture2D screenshotRaw = new Texture2D(Screen.width, Screen.height, (TextureFormat)3, false) { name = "Screenshot_Raw", hideFlags = (HideFlags)61 }; screenshotRaw.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0, false); Texture2D screenshotFinal = new Texture2D(640, 480, (TextureFormat)3, false) { name = "Screenshot_Final", hideFlags = (HideFlags)61 }; Color[] oldColors = screenshotRaw.GetPixels(); Color[] newColors = new Color[screenshotFinal.width * screenshotFinal.height]; float widthRatio = screenshotRaw.width / (float)screenshotFinal.width; float heightRatio = screenshotRaw.height / (float)screenshotFinal.height; for (int i = 0; i < screenshotFinal.height; i++) { int num = (int)(i * heightRatio) * screenshotRaw.width; int num2 = i * screenshotFinal.width; for (int j = 0; j < screenshotFinal.width; j++) { int num3 = (int)(j * widthRatio); newColors[num2 + j] = oldColors[num + num3]; } } screenshotFinal.SetPixels(newColors); byte[] data = screenshotFinal.EncodeToJPG(33); if (data.Length < 30000) { channel.longBinaryData = true; channel.openWrite(); channel.write(data); channel.closeWrite("tellScreenshotRelay", ESteamCall.SERVER, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); channel.longBinaryData = false; } yield return(new WaitForFixedUpdate()); yield return(new WaitForEndOfFrame()); break; } } if (MiscOptions.AlertOnSpy) { NotificationUtilities.DisplayNotification(EPlayerMessage.INTERACT, "Warning! Your game client was spied.", Color.red, 3); } }
private async void RegionClickCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if (isSelecting == false) { return; } isSelecting = false; CursorClipper.UnClipCursor(); RegionClickCanvas.ReleaseMouseCapture(); Matrix m = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice; System.Windows.Point mPt = GetMousePos(); System.Windows.Point movingPoint = e.GetPosition(this); movingPoint.X *= m.M11; movingPoint.Y *= m.M22; movingPoint.X = Math.Round(movingPoint.X); movingPoint.Y = Math.Round(movingPoint.Y); if (mPt == movingPoint) { Debug.WriteLine("Probably on Screen 1"); } double correctedLeft = Left; double correctedTop = Top; if (correctedLeft < 0) { correctedLeft = 0; } if (correctedTop < 0) { correctedTop = 0; } double xDimScaled = Canvas.GetLeft(selectBorder) * m.M11; double yDimScaled = Canvas.GetTop(selectBorder) * m.M22; Rectangle regionScaled = new Rectangle( (int)xDimScaled, (int)yDimScaled, (int)(selectBorder.Width * m.M11), (int)(selectBorder.Height * m.M22)); string grabbedText = ""; try { RegionClickCanvas.Children.Remove(selectBorder); } catch { } if (regionScaled.Width < 3 || regionScaled.Height < 3) { BackgroundBrush.Opacity = 0; grabbedText = await ImageMethods.GetClickedWord(this, new System.Windows.Point(xDimScaled, yDimScaled)); } else { grabbedText = await ImageMethods.GetRegionsText(this, regionScaled); } if (Settings.Default.CorrectErrors) { grabbedText.TryFixEveryWordLetterNumberErrors(); } if (SingleLineMenuItem.IsChecked == true) { grabbedText = grabbedText.MakeStringSingleLine(); } if (string.IsNullOrWhiteSpace(grabbedText) == false) { textFromOCR = grabbedText; if (Settings.Default.NeverAutoUseClipboard == false && EditWindow is null) { Clipboard.SetText(grabbedText); } if (Settings.Default.ShowToast && EditWindow is null) { NotificationUtilities.ShowToast(grabbedText); } if (EditWindow is not null) { EditWindow.AddThisText(grabbedText); } WindowUtilities.CloseAllFullscreenGrabs(); } else { BackgroundBrush.Opacity = .2; clippingGeometry.Rect = new Rect( new System.Windows.Point(0, 0), new System.Windows.Size(0, 0)); } }