From 48c2003132d47ff5a5e9a7b9e0f5a7de6338304c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20G=C3=B3mez?= Date: Tue, 8 Feb 2022 12:16:10 -0600 Subject: [PATCH] MainWindow position fix, Log path changed, MessageWIndow implemented, Migrated to .NET 6 --- ValorantCC/MainWindow.xaml | 32 ++++++++++----------- ValorantCC/MainWindow.xaml.cs | 12 ++++---- ValorantCC/SubWindow/MessageWindow.xaml | 15 ++++++++++ ValorantCC/SubWindow/MessageWindow.xaml.cs | 29 +++++++++++++++++++ ValorantCC/SubWindow/ProfilesWindow.xaml.cs | 7 ++--- ValorantCC/ValorantCC.csproj | 4 +-- ValorantCC/src/Auth.cs | 3 +- ValorantCC/src/BackgroundAuth.cs | 3 ++ ValorantCC/src/Processor.cs | 4 +-- ValorantCC/src/Utils.cs | 5 ++-- 10 files changed, 79 insertions(+), 35 deletions(-) create mode 100644 ValorantCC/SubWindow/MessageWindow.xaml create mode 100644 ValorantCC/SubWindow/MessageWindow.xaml.cs diff --git a/ValorantCC/MainWindow.xaml b/ValorantCC/MainWindow.xaml index f9cbb06..789c5b0 100644 --- a/ValorantCC/MainWindow.xaml +++ b/ValorantCC/MainWindow.xaml @@ -1,15 +1,15 @@ + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:ValorantCC" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" + xmlns:Controls="clr-namespace:Xceed.Wpf.AvalonDock.Themes.Controls;assembly=Xceed.Wpf.AvalonDock.Themes.Aero" x:Class="ValorantCC.MainWindow" + xmlns:fa="http://schemas.fontawesome.io/icons/" + mc:Ignorable="d" + Title="vTools - ValorantCC" Height="0" Width="500" SizeToContent="Height" AllowsTransparency="True" WindowStartupLocation="CenterScreen" WindowState="Normal" ResizeMode="CanMinimize" WindowStyle="None" Icon="Resources/vtools-colored.ico" + Background="Transparent" + RenderOptions.BitmapScalingMode="Fant"> @@ -230,13 +230,13 @@ - - - + + + - + - + diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs index 1501610..32e80b4 100644 --- a/ValorantCC/MainWindow.xaml.cs +++ b/ValorantCC/MainWindow.xaml.cs @@ -15,7 +15,6 @@ namespace ValorantCC { public partial class MainWindow : Window { - readonly string LoggingDir = Environment.GetEnvironmentVariable("LocalAppData") + @"\VTools\Logs\"; public Processor DataProcessor = new Processor(); BrushConverter bc = new BrushConverter(); public AuthResponse AuthResponse; @@ -28,10 +27,9 @@ public partial class MainWindow : Window public MainWindow() { // Create logging dir - if (!Directory.Exists(LoggingDir)) Directory.CreateDirectory(LoggingDir); - // Replace old logs - string LogFile = LoggingDir + "/logs.txt"; - if (File.Exists(LogFile)) File.Move(LogFile, LogFile + ".old", true); + if (!Directory.Exists(Path.GetDirectoryName(Utils.LoggingFile))) Directory.CreateDirectory(Path.GetDirectoryName(Utils.LoggingFile)); + // Replace old logs + if (File.Exists(Utils.LoggingFile)) File.Move(Utils.LoggingFile, Utils.LoggingFile + ".old", true); Version ProgramFileVersion = new Version(FileVersionInfo.GetVersionInfo(Process.GetCurrentProcess().MainModule.FileName).ProductVersion); InitializeComponent(); @@ -262,7 +260,7 @@ private void ClipboardButtonLeave(object sender, MouseEventArgs e) private void btnOpenLogs_Click(object sender, RoutedEventArgs e) { Process p = new Process(); - p.StartInfo = new ProcessStartInfo() { FileName = LoggingDir, UseShellExecute = true }; + p.StartInfo = new ProcessStartInfo() { FileName = Path.GetDirectoryName(Utils.LoggingFile), UseShellExecute = true }; p.Start(); MessageTxt.Foreground = Brushes.Lime; MessageTxt.Text = "Log folder opened! Please include OLD files to your report if exists."; @@ -302,7 +300,7 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e) Window publicProfiles = Application.Current.Windows.Cast().Single(window => window.GetType().ToString() == "ValorantCC.ProfilesWindow"); publicProfiles.Activate(); } - catch (Exception ex) + catch (Exception) { ProfilesWindow publicProfiles = new ProfilesWindow(SelectedProfile, ValCCAPI); publicProfiles.Owner = this; diff --git a/ValorantCC/SubWindow/MessageWindow.xaml b/ValorantCC/SubWindow/MessageWindow.xaml new file mode 100644 index 0000000..7fb1a76 --- /dev/null +++ b/ValorantCC/SubWindow/MessageWindow.xaml @@ -0,0 +1,15 @@ + + + + +