// Decompiled with JetBrains decompiler // Type: Raton.Windows.ClientFolders // 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 Raton.Classes; using RatonBack; using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media.Animation; using System.Windows.Threading; using WpfApp1; #nullable disable namespace Raton.Windows; public partial class ClientFolders : Window { private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20; private readonly List _allItems = new List(); private readonly ObservableCollection _filtered = new ObservableCollection(); private readonly Stack _navStack = new Stack(); private string _currentRoot; private DispatcherTimer _toastTimer; [DllImport("dwmapi.dll", CharSet = CharSet.Auto)] private static extern int DwmSetWindowAttribute( IntPtr hwnd, int attr, ref int attrValue, int attrSize); public ClientFolders() => this.InitializeComponent(); private void Window_Loaded(object sender, RoutedEventArgs e) { IntPtr handle = new WindowInteropHelper((Window) this).Handle; int attrValue = 1; ClientFolders.DwmSetWindowAttribute(handle, 20, ref attrValue, Marshal.SizeOf(typeof (int))); this._currentRoot = MainWindow.ClientsFolder; this.LoadFolder(this._currentRoot, false); } private async void LoadFolder(string path, bool pushToStack) { if (pushToStack && this._currentRoot != null) this._navStack.Push(this._currentRoot); this._currentRoot = path; this._allItems.Clear(); this._filtered.Clear(); this.FoldersGrid.ItemsSource = (IEnumerable) null; this.TbFolderPath.Text = string.IsNullOrWhiteSpace(path) ? "Clients" : path; this.BtnBack.Visibility = this._navStack.Count > 0 ? Visibility.Visible : Visibility.Collapsed; if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path)) { this.TbStatus.Text = "Folder not found"; } else { try { int num = await BackendClient.ValidateSessionFlags(DeviceManager.GetHWID(), DeviceManager.GetOrCreateId()) ? 1 : 0; } catch (Exception ex) { int num = (int) MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Hand); Environment.Exit(0); return; } try { foreach (string path1 in (IEnumerable) ((IEnumerable) Directory.GetDirectories(path)).OrderBy((Func) (d => Path.GetFileName(d)), (IComparer) StringComparer.OrdinalIgnoreCase)) { DirectoryInfo directoryInfo = new DirectoryInfo(path1); int num1 = 0; int num2 = 0; try { num1 = Directory.GetDirectories(path1).Length; num2 = Directory.GetFiles(path1).Length; } catch { } int num3 = num1 + num2; this._allItems.Add(new ClientFolderItem() { FolderName = directoryInfo.Name, FullPath = path1, Depth = 0, DepthLabel = "FOLDER", ItemCount = num3.ToString() + (num3 == 1 ? " item" : " items"), LastModified = directoryInfo.LastWriteTime.ToString("dd/MM/yyyy HH:mm"), IconGlyph = "\uE8B7", IndentWidth = 0.0, IsFile = false }); } foreach (string fileName in (IEnumerable) ((IEnumerable) Directory.GetFiles(path)).OrderBy((Func) (f => Path.GetFileName(f)), (IComparer) StringComparer.OrdinalIgnoreCase)) { FileInfo fileInfo = new FileInfo(fileName); this._allItems.Add(new ClientFolderItem() { FolderName = fileInfo.Name, FullPath = fileName, Depth = 0, DepthLabel = fileInfo.Extension.TrimStart('.').ToUpperInvariant().DefaultIfEmpty("FILE"), ItemCount = ClientFolders.FormatSize(fileInfo.Length), LastModified = fileInfo.LastWriteTime.ToString("dd/MM/yyyy HH:mm"), IconGlyph = ClientFolders.GetFileGlyph(fileInfo.Extension), IndentWidth = 0.0, IsFile = true }); } this.ApplyFilter(this.TbSearch.Text); if (this._allItems.Count != 0) return; this.ShowEmptyToast(); } catch (Exception ex) { this.TbStatus.Text = "Error: " + ex.Message; } } } private void ShowEmptyToast() { this._toastTimer?.Stop(); this.ToastEmpty.BeginAnimation(UIElement.OpacityProperty, (AnimationTimeline) new DoubleAnimation(0.0, 1.0, (Duration) TimeSpan.FromMilliseconds(200.0))); this._toastTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(2500.0) }; this._toastTimer.Tick += (EventHandler) ((s, e) => { this._toastTimer.Stop(); this.ToastEmpty.BeginAnimation(UIElement.OpacityProperty, (AnimationTimeline) new DoubleAnimation(1.0, 0.0, (Duration) TimeSpan.FromMilliseconds(400.0))); }); this._toastTimer.Start(); } private static string FormatSize(long bytes) { if (bytes < 1024L /*0x0400*/) return bytes.ToString() + " B"; return bytes < 1048576L /*0x100000*/ ? (bytes / 1024L /*0x0400*/).ToString() + " KB" : (bytes / 1048576L /*0x100000*/).ToString() + " MB"; } private static string GetFileGlyph(string ext) { switch ((ext ?? "").ToLowerInvariant()) { case ".7z": case ".rar": case ".zip": return "\uE8B1"; case ".avi": case ".mkv": case ".mov": case ".mp4": return "\uE8B2"; case ".bmp": case ".gif": case ".jpeg": case ".jpg": case ".png": case ".webp": return "\uEB9F"; case ".cs": case ".css": case ".html": case ".js": case ".py": case ".ts": return "\uE943"; case ".doc": case ".docx": return "\uE8A5"; case ".flac": case ".mp3": case ".wav": return "\uE8D6"; case ".pdf": return "\uEA90"; case ".ppt": case ".pptx": return "\uE9D5"; case ".txt": return "\uE8A5"; case ".xls": case ".xlsx": return "\uE9F9"; default: return "\uE8A5"; } } private void TbSearch_TextChanged(object sender, TextChangedEventArgs e) { this.TbSearchPlaceholder.Visibility = string.IsNullOrEmpty(this.TbSearch.Text) ? Visibility.Visible : Visibility.Collapsed; this.ApplyFilter(this.TbSearch.Text); } private void ApplyFilter(string query) { this._filtered.Clear(); foreach (ClientFolderItem clientFolderItem in string.IsNullOrWhiteSpace(query) ? (IEnumerable) this._allItems : this._allItems.Where((Func) (f => f.FolderName != null && f.FolderName.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0))) this._filtered.Add(clientFolderItem); this.FoldersGrid.ItemsSource = (IEnumerable) this._filtered; int count = this._filtered.Count; this.TbStatus.Text = count == 1 ? "1 item" : count.ToString() + " items"; } private void FoldersGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (!(this.FoldersGrid.SelectedItem is ClientFolderItem selectedItem)) return; if (selectedItem.IsFile) { try { Process.Start(new ProcessStartInfo() { FileName = selectedItem.FullPath, UseShellExecute = true }); } catch { } } else { this.TbSearch.Text = string.Empty; this.LoadFolder(selectedItem.FullPath, true); } } private void BtnBack_Click(object sender, RoutedEventArgs e) { if (this._navStack.Count == 0) return; string path = this._navStack.Pop(); this._currentRoot = (string) null; this.TbSearch.Text = string.Empty; this.LoadFolder(path, false); } }