61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: Raton.Windows.ExceptionWindow
|
||
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||
|
|
|
||
|
|
using Microsoft.Win32;
|
||
|
|
using System;
|
||
|
|
using System.CodeDom.Compiler;
|
||
|
|
using System.ComponentModel;
|
||
|
|
using System.Diagnostics;
|
||
|
|
using System.Runtime.InteropServices;
|
||
|
|
using System.Windows;
|
||
|
|
using System.Windows.Controls;
|
||
|
|
using System.Windows.Interop;
|
||
|
|
using System.Windows.Markup;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
namespace Raton.Windows;
|
||
|
|
|
||
|
|
public partial class ExceptionWindow : Window
|
||
|
|
{
|
||
|
|
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
||
|
|
|
||
|
|
[DllImport("dwmapi.dll", CharSet = CharSet.Auto)]
|
||
|
|
private static extern int DwmSetWindowAttribute(
|
||
|
|
IntPtr hwnd,
|
||
|
|
int attr,
|
||
|
|
ref int attrValue,
|
||
|
|
int attrSize);
|
||
|
|
|
||
|
|
public ExceptionWindow()
|
||
|
|
{
|
||
|
|
this.InitializeComponent();
|
||
|
|
this.Loaded += new RoutedEventHandler(this.Exc_loaded);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void Exc_loaded(object sender, RoutedEventArgs e) => this.ApplyDarkMode();
|
||
|
|
|
||
|
|
private void ApplyDarkMode()
|
||
|
|
{
|
||
|
|
bool flag = this.IsWindowsDarkMode();
|
||
|
|
IntPtr handle = new WindowInteropHelper((Window) this).Handle;
|
||
|
|
int attrValue = flag ? 1 : 0;
|
||
|
|
ExceptionWindow.DwmSetWindowAttribute(handle, 20, ref attrValue, Marshal.SizeOf(typeof (int)));
|
||
|
|
}
|
||
|
|
|
||
|
|
private bool IsWindowsDarkMode()
|
||
|
|
{
|
||
|
|
using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"))
|
||
|
|
{
|
||
|
|
if (registryKey != null)
|
||
|
|
{
|
||
|
|
if (registryKey.GetValue("AppsUseLightTheme") is int num)
|
||
|
|
return num == 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|