Skip to content

Commit

Permalink
fix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
weedeej committed Feb 21, 2022
1 parent dcfe6c7 commit 29e89d7
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 62 deletions.
35 changes: 15 additions & 20 deletions ValorantCC/SubWindow/ProfilesWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="ValorantCC.ProfilesWindow"
<mah:MetroWindow x:Class="ValorantCC.ProfilesWindow"
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"
Expand All @@ -7,28 +7,23 @@
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d"
Title="ProfilesWindow" RenderOptions.BitmapScalingMode="Fant" Background="Transparent" AllowsTransparency="True" Height="481" Width="339" ResizeMode="NoResize" SizeToContent="WidthAndHeight" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" WindowStyle="None">
Title=""
RenderOptions.BitmapScalingMode="Fant"
AllowsTransparency="True"
Height="481" Width="339"
ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
ShowInTaskbar="False"
WindowTitleBrush="#232429"
GlowBrush="White"
WindowStartupLocation="CenterOwner" WindowStyle="None" WindowState="Normal" Icon="../Resources/vtools-colored.ico">

<Border BorderThickness="0" CornerRadius="7" Background="#232429" Height="450" Margin="0,15,0,15">
<Border BorderThickness="0" Background="#232429" Height="450" Margin="0,5,0,15">
<Grid>
<Border BorderThickness="0" BorderBrush="Transparent" Background ="#16171B" Margin="0,-2,-1,425" CornerRadius="7,5,0,0" MouseDown="Border_MouseDown">
<Grid Height="Auto" Width="Auto" Margin="0,0,1,-2" OpacityMask="#FFA42727">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18*"/>
<ColumnDefinition Width="90*"/>
<ColumnDefinition Width="189*"/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="23*"/>
</Grid.ColumnDefinitions>
<Image Source="/Resources/vtools-colored.ico" Grid.Column="0" Margin="2,6,2,7"/>
<Button x:Name="exitButton" Content="" Margin="2,5,4,5" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" Style="{DynamicResource RightButtonStyle}" Cursor="Hand" Grid.Column="4" Click="ExitClick" MouseEnter="TabButtonEnter" MouseLeave="TabButtonLeave"/>
<Button x:Name="minusButton" Content="" Margin="1,4,4,4" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="White" Style="{DynamicResource RightButtonStyle}" Cursor="Hand" Grid.Column="3" Click="MinimizeClick" MouseEnter="TabButtonEnter" MouseLeave="TabButtonLeave"/>
</Grid>
</Border>
<StackPanel Name="Container" HorizontalAlignment="Center" Margin="0,5">
<StackPanel Orientation="Horizontal" Width="350">
<TextBox Style="{DynamicResource MahApps.Styles.TextBox}" Name="SearchCode" MinWidth="128" MaxWidth="128" Background="#FF393B44" Margin="65,25,5,0" Foreground="White" Height="22"/>
<Button Style="{DynamicResource MahApps.Styles.Button}" Name="btnSearchCode" Content="Search Code" MinWidth="85" Background="#FF393B44" Margin="0,25,5,0" Foreground="White" Cursor="Hand" Click="btnSearchCode_Click" BorderBrush="#FF393B44"/>
<TextBox Style="{DynamicResource MahApps.Styles.TextBox}" Name="SearchCode" MinWidth="128" MaxWidth="128" Background="#FF393B44" Margin="65,4,5,0" Foreground="White" Height="22"/>
<Button Style="{DynamicResource MahApps.Styles.Button}" Name="btnSearchCode" Content="Search Code" MinWidth="85" Background="#FF393B44" Margin="0,5,5,0" Foreground="White" Cursor="Hand" Click="btnSearchCode_Click" BorderBrush="#FF393B44"/>
</StackPanel>
<TextBlock Foreground="White" HorizontalAlignment="Center" Visibility="Collapsed" Name="fetchErrorTxt">An error has occured while fetching profiles.</TextBlock>
<Image gif:ImageBehavior.AnimatedSource="../Resources/vtspinner optimized.gif" Width="50" Height="52" Margin="0,155,0,0" x:Name="LoadingPlaceHolder" Visibility="Visible" IsVisibleChanged="LoadingPlaceHolder_IsVisibleChanged"/>
Expand All @@ -40,4 +35,4 @@
</StackPanel>
</Grid>
</Border>
</Window>
</mah:MetroWindow>
5 changes: 3 additions & 2 deletions ValorantCC/SubWindow/ProfilesWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using MahApps.Metro.Controls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
Expand All @@ -22,7 +23,7 @@ public struct PublicProfile
public int ID { get; set; }
}

public partial class ProfilesWindow : Window
public partial class ProfilesWindow : MetroWindow
{
public CrosshairProfile selected;
private static API ValCCApi;
Expand Down
2 changes: 1 addition & 1 deletion ValorantCC/SubWindow/src/CreateRender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static async Task<UIElement> GenerateRender(this ProfilesWindow profilesW
MaxHeight = 95,
MinWidth = 300,
MaxWidth = 300,
Margin = new Thickness(5, 5, 0, 0)
Margin = new Thickness(5, 10, 0, 0)
};
// First Grid and defintions

Expand Down
7 changes: 4 additions & 3 deletions ValorantCC/src/BackgroundAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ public async void LoopCheck()

public async static Task<bool> LoginFlagExists()
{
String LogDir = Environment.GetEnvironmentVariable("LocalAppData") + "\\Riot Games\\Riot Client\\Logs\\Riot Client Logs";
String[] logs = Directory.GetFiles(LogDir, "*.log");
DirectoryInfo LogDir = new DirectoryInfo(Environment.GetEnvironmentVariable("LocalAppData") + "\\Riot Games\\Riot Client\\Logs\\Riot Client Logs");
var log = LogDir.GetFiles().OrderByDescending(f => f.LastWriteTime).First();

string content;
using (FileStream fileStream = File.Open(logs.Last(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (FileStream fileStream = File.Open(log.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (StreamReader sr = new StreamReader(fileStream))
{
Expand Down
10 changes: 8 additions & 2 deletions ValorantCC/src/Binder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace ValorantCC
{
public partial class Actionmapping
Expand Down Expand Up @@ -72,12 +73,17 @@ public partial class SniperSettings
public float CenterDotOpacity { get; set; }
public bool bDisplayCenterDot { get; set; }
}
public partial class CrosshairColor
public partial class CrosshairColor : ICloneable
{
public byte R { get; set; }
public byte G { get; set; }
public byte B { get; set; }
public byte A { get; set; }

public object Clone()
{
throw new NotImplementedException();
}
}

public partial class LineSettings
Expand Down
27 changes: 15 additions & 12 deletions ValorantCC/src/Modifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@ public static Data ChangeActiveProfile(List<Color> Colors, int SelectedIndex, Da
Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
activeProfileColor.value = Utilities.Utils.ColorToString(Colors[0]);
}
catch (ArgumentNullException)
catch
{
Utilities.Utils.Log("User has no entry for CrosshairColor, Creating one...");
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utilities.Utils.ColorToString(Colors[0]) });
}
if (FetchedProfiles.Profiles[SelectedIndex].bUseAdvancedOptions)
finally
{
Utilities.Utils.Log("Removing Old colors.");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairOutlineColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
if (FetchedProfiles.Profiles[SelectedIndex].bUseAdvancedOptions)
{
Utilities.Utils.Log("Removing Old colors.");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairSniperCenterDotColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairOutlineColor");
UserSettings.stringSettings.RemoveAll(setting => setting.settingEnum == "EAresStringSettingName::CrosshairADSOutlineColor");
}
Utilities.Utils.Log("Appending new colors.");
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor", value = Utilities.Utils.ColorToString(Colors[4]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColor", value = Utilities.Utils.ColorToString(Colors[2]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairOutlineColor", value = Utilities.Utils.ColorToString(Colors[1]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = Utilities.Utils.ColorToString(Colors[3]) });
}
Utilities.Utils.Log("Appending new colors.");
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor", value = Utilities.Utils.ColorToString(Colors[4]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColor", value = Utilities.Utils.ColorToString(Colors[2]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairOutlineColor", value = Utilities.Utils.ColorToString(Colors[1]) });
UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = Utilities.Utils.ColorToString(Colors[3]) });
return UserSettings;
}
}
Expand Down
44 changes: 22 additions & 22 deletions ValorantCC/src/Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,31 +214,31 @@ public async Task<bool> SaveNewColor(List<Color> Colors, int SelectedIndex, stri
Utilities.Utils.Log("Save button clicked. Saving...");

if (ProfileListed)
SaveListedSettings(Colors, SelectedIndex);

foreach (var item in FetchedProfiles.Profiles)
{
foreach (var color in DefaultColors)
Utilities.Utils.Log("Profile type: List");
for (int i = 0; i < FetchedProfiles.Profiles.Count; i++)
{
var prfColor = item.Primary.Color;
if (prfColor.R == color.R && prfColor.G == color.G && prfColor.B == color.B)
if (prfColor.R != 0)
prfColor.R--;
else
prfColor.G--;
var item = FetchedProfiles.Profiles[i];
for (int x = 0; x < DefaultColors.Count; x++)
{
var color = DefaultColors[x];
var prfColor = item.Primary.Color;
if (prfColor.R == color.R && prfColor.G == color.G && prfColor.B == color.B)
if (prfColor.R != 0)
prfColor.R--;
else
prfColor.G--;

prfColor = item.aDS.Color;
if (prfColor.R == color.R && prfColor.G == color.G && prfColor.B == color.B)
if (prfColor.R != 0)
prfColor.R--;
else
prfColor.G--;
prfColor = item.aDS.Color;
if (prfColor.R == color.R && prfColor.G == color.G && prfColor.B == color.B)
if (prfColor.R != 0)
prfColor.R--;
else
prfColor.G--;
}
}
}

if (ProfileListed)
{
Utilities.Utils.Log("Profile type: List");
SaveListedSettings(Colors, SelectedIndex);
FetchedProfiles.Profiles[SelectedIndex].ProfileName = ProfileName;
Stringsetting SavedProfiles = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::SavedCrosshairProfileData");
SavedProfiles.value = JsonConvert.SerializeObject(FetchedProfiles);
Expand All @@ -247,9 +247,9 @@ public async Task<bool> SaveNewColor(List<Color> Colors, int SelectedIndex, stri
{
Utilities.Utils.Log("Profile type: Enum");
Stringsetting profileName = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::CrosshairProfileName");
Stringsetting SavedProfile = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
SavedProfile.value = Utilities.Utils.ColorToString(Colors[0]);
UserSettings = Modifier.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
profileName.value = ProfileName;

}
if (await putUserSettings(UserSettings))
{
Expand Down

0 comments on commit 29e89d7

Please # to comment.