Skip to content

Commit

Permalink
aaaaaaasync
Browse files Browse the repository at this point in the history
  • Loading branch information
weedeej committed Jan 19, 2022
1 parent 9197b5b commit 55142f9
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 94 deletions.
8 changes: 8 additions & 0 deletions ValorantCC/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF6C91FF"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="#FF295FFE" />
</Trigger>
</Style.Triggers>
</Style>

<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#191B1D" />
Expand Down
36 changes: 20 additions & 16 deletions ValorantCC/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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"
mc:Ignorable="d"
Title="vTools - ValorantCC" Height="411 " Width="500" SizeToContent="Manual" AllowsTransparency="True" WindowStartupLocation="CenterScreen" WindowState="Normal" ResizeMode="CanMinimize" WindowStyle="None" Icon="Resources/vtools-colored.ico"
Title="vTools - ValorantCC" Height="423 " Width="500" SizeToContent="Manual" AllowsTransparency="True" WindowStartupLocation="CenterScreen" WindowState="Normal" ResizeMode="CanMinimize" WindowStyle="None" Icon="Resources/vtools-colored.ico"
Background="Transparent"
RenderOptions.BitmapScalingMode="Fant">
<Window.Resources>
Expand Down Expand Up @@ -55,18 +55,15 @@
</Grid>
<Grid Margin="0,3,0,0" MouseDown="StackPanel_MouseDown" MaxWidth="500" MaxHeight="411">
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="65" Width="65*"/>
<ColumnDefinition Width="43*"/>

<ColumnDefinition MaxWidth="85" Width="85*"/>
<ColumnDefinition Width="68*"/>

<ColumnDefinition MaxWidth="82" Width="82*"/>
<ColumnDefinition Width="128*"/>
<ColumnDefinition Width="55*"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock FontWeight="Bold" Grid.Column="0" Margin="5,0,43,0" Foreground="White" FontFamily="Segoe UI Semibold" VerticalAlignment="Top" Grid.ColumnSpan="2"><Run Text="Logged In:"/></TextBlock>
<TextBlock Margin="2,-5,0,0" FontWeight="Bold" Foreground="#FFF90C0C" x:Name="txt_LoggedIn" FontSize="18" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Left"><Run Text=""/></TextBlock>
<ComboBox x:Name="profiles" Grid.Column="5" SelectionChanged="profiles_SelectionChanged" SelectedIndex="0" IsEditable="True" IsReadOnly="True" Text="Profiles" TextBoxBase.TextChanged="profiles_TextChanged" Background="#FF232429" Foreground="White" Margin="0,-1,2,1" FontFamily="Quicksand" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold"/>
<TextBlock FontWeight="Bold" Grid.Column="0" Margin="5,0,43,0" Foreground="White" FontFamily="Segoe UI Semibold" Grid.ColumnSpan="2">
<Run Text="Status:"/>
<Run Foreground="Red" Text="" Name="DotTxt"/>
<Run Foreground="Red" Text="Waiting for lockfile. . ." FontSize="10" Name="StatusTxt"/>
</TextBlock>
<ComboBox x:Name="profiles" Grid.Column="2" SelectionChanged="profiles_SelectionChanged" SelectedIndex="0" IsEditable="True" IsReadOnly="True" Text="Profiles" TextBoxBase.TextChanged="profiles_TextChanged" Background="#FF232429" Foreground="White" Margin="0,-1,2,1" FontFamily="Quicksand" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold"/>
</Grid>
<Grid MaxWidth="500" MaxHeight="411">
<Image x:Name="CrosshairBG" Source="{StaticResource crosshairBG0}" Margin="1,3,-1,3"/>
Expand All @@ -85,7 +82,7 @@
<Image Source="Resources/folder.png" Stretch="None"/>
</StackPanel>
</Button>

</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -199,9 +196,9 @@
<ColumnDefinition Width="88*"/>
<ColumnDefinition Width="160*"/>
</Grid.ColumnDefinitions>
<Button Style="{DynamicResource RoundButton}" Content="Relogin" Height="25" Click="btnReload_Click" Cursor="Hand" VerticalAlignment="Center" Background="#FF295FFE" FontFamily="Quicksand" FontWeight="DemiBold" FontSize="11" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Grid.Column="1" Margin="24,0,28,0" Grid.ColumnSpan="2" Width="120"/>
<Button Style="{DynamicResource RoundButton}" Content="Save" Height="25" Click="btnSave_Click" Cursor="Hand" VerticalAlignment="Center" Background="#FF295FFE" FontFamily="Quicksand" FontSize="11" FontWeight="DemiBold" Grid.Column="3" Margin="28.2,0,0,0" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Width="124"/>
<Button x:Name="btnLogin" Style="{DynamicResource RoundButton}" Content="Login" HorizontalContentAlignment="Left" Click="btnLogin_Click" Cursor="Hand" Height="25" VerticalContentAlignment="Top" HorizontalAlignment="Left" VerticalAlignment="Center" Width="124" Background="#FF295FFE" FontFamily="Quicksand" FontSize="11" FontWeight="DemiBold" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Margin="0,0,0,0"/>
<Button Style="{DynamicResource RoundButton}" Content="Reload" Height="25" Click="btnReload_Click" Cursor="Hand" VerticalAlignment="Center" FontFamily="Quicksand" FontWeight="DemiBold" FontSize="11" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Grid.Column="1" Margin="24,0,28,0" Grid.ColumnSpan="2" Width="120"/>
<Button Style="{DynamicResource RoundButton}" Content="Save" Height="25" Click="btnSave_Click" Cursor="Hand" VerticalAlignment="Center" FontFamily="Quicksand" FontSize="11" FontWeight="DemiBold" Grid.Column="3" Margin="28.2,0,0,0" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Width="124"/>
<Button x:Name="btnShare" Style="{DynamicResource RoundButton}" Content="Share" HorizontalContentAlignment="Left" Click="btnShare_Click" Cursor="Hand" Height="25" VerticalContentAlignment="Top" HorizontalAlignment="Left" VerticalAlignment="Center" Width="124" FontFamily="Quicksand" FontSize="11" FontWeight="DemiBold" TextBlock.FontFamily="Segoe UI Semibold" TextBlock.FontWeight="Bold" Margin="0,0,0,0"/>

</Grid>
<Grid Width="495" MaxWidth="495" MaxHeight="411">
Expand All @@ -215,6 +212,7 @@
<RowDefinition Height="12*"/>
<RowDefinition Height="12*"/>
<RowDefinition Height="17*"/>
<RowDefinition Height="12*"/>
</Grid.RowDefinitions>
<TextBlock Margin="2,2,2,2" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Foreground="White" FontFamily="Segoe UI Semibold"><Run Text="Primary Color"/></TextBlock>
<xctk:ColorPicker x:Name="primary_color" Grid.Row="0" Grid.Column="1" SelectedColorChanged="primary_color_SelectedColorChanged" ShowStandardColors="False" AdvancedTabHeader="Manual" Margin="10,1,4,1" Cursor="Hand" BorderBrush="White" DropDownBackground="#FF252526" DropDownBorderBrush="#FF252526" HeaderBackground="#FF252526" TabBackground="#FF252526" Foreground="White" HeaderForeground="White" TabForeground="#FFFBF9F9" UsingAlphaChannel="False" Background="{x:Null}" DisplayColorAndName="True"/>
Expand All @@ -230,6 +228,12 @@

<TextBlock Margin="2,2,2,2" FontWeight="Bold" Grid.Row="4" Grid.Column="0" Foreground="White" FontFamily="Segoe UI Semibold"><Run Text="Sniper Dot Color"/></TextBlock>
<xctk:ColorPicker x:Name="sniper_dot_color" Grid.Row="4" Grid.Column="1" SelectedColorChanged="sniper_dot_color_SelectedColorChanged" UsingAlphaChannel="False" AdvancedTabHeader="Manual" Margin="10,0,4,0" Cursor="Hand" OpacityMask="#FFB82525" Height="23.96" VerticalAlignment="Center" Background="{x:Null}" DisplayColorAndName="True" BorderBrush="#FFDADADA" Foreground="White" HeaderBackground="#FF252526" HeaderForeground="White" TabBackground="#FF252526" TabForeground="#FFFBF9F9" DropDownBorderBrush="#FF252526" DropDownBackground="#FF252526" ShowStandardColors="False"/>

<Rectangle Width="auto" Height="15" Grid.Column="0" Grid.Row="5" Fill="#FF44464F" Grid.ColumnSpan="2" Margin="-2,2,-2,2"/>
<TextBlock FontWeight="Bold" Grid.Column="0" Grid.Row="5" Margin="2,0,2,2" Foreground="White" FontFamily="Segoe UI Semibold" Grid.ColumnSpan="2">
<Run Text="Message:"/>
<Run Foreground="Yellow" Text="Waiting for action. . ." FontSize="10" Name="MessageTxt"/>
</TextBlock>
</Grid>
</StackPanel>
</UserControl>
Expand Down
63 changes: 27 additions & 36 deletions ValorantCC/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,17 @@ namespace ValorantCC
public partial class MainWindow : Window
{
readonly string LoggingDir = Environment.GetEnvironmentVariable("LocalAppData") + @"\VTools\Logs\";
Processor DataProcessor = new Processor();
public Processor DataProcessor = new Processor();
BrushConverter bc = new BrushConverter();
public AuthResponse AuthResponse;
public CrosshairProfile SelectedProfile;
List<Color> SelectedColors;
private API ValCCAPI;
int SelectedIndex;
bool LoggedIn;
public API ValCCAPI;
public int SelectedIndex;
public bool LoggedIn;

public MainWindow()
{
/**
* Note to myself, You were sleepy when you made this commit. Just test the app and see what you messed with.
* You probably messed with something here in main relating to the checkbox. goodluck debugging!
*/
// Create logging dir
if (!Directory.Exists(LoggingDir)) Directory.CreateDirectory(LoggingDir);
// Replace old logs
Expand All @@ -44,6 +40,8 @@ public MainWindow()
InitializeComponent();
Utils.Log($"App Started | v{ProgramFileVersion}. Replaced old logfile.");
Txt_CurrVer.Content = $"v{ProgramFileVersion}";
BackgroundAuth auth = new BackgroundAuth(DataProcessor);
auth.LoopCheck();
}

private async void Grid_Loaded(object sender, RoutedEventArgs e)
Expand All @@ -61,7 +59,7 @@ private void btnSave_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
MessageBox.Show("You are not logged in!");
MessageTxt.Text = "You are not logged in!";
return;
}
if (DataProcessor.ProfileListed)
Expand All @@ -77,30 +75,14 @@ private void btnSave_Click(object sender, RoutedEventArgs e)
DataProcessor.Construct();
profiles.Items.Refresh();
profiles.SelectedIndex = DataProcessor.CurrentProfile;
MessageBox.Show("Saved! If Valorant is open, Please restart it without touching the settings.");
MessageTxt.Foreground = Brushes.Lime;
MessageTxt.Text = "Saved! Restart Valorant.";
return;
}
MessageBox.Show("Failed. Consult the developer.");
MessageTxt.Foreground = Brushes.Red;
MessageTxt.Text = "Failed. Consult developer.";
return;
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
AuthResponse AuthResponse = DataProcessor.Login();
LoggedIn = AuthResponse.Success;
if (!LoggedIn)
{
MessageBox.Show(AuthResponse.Response);
return;
}

profiles.ItemsSource = DataProcessor.ProfileNames;
txt_LoggedIn.Foreground = Brushes.Lime;
profiles.SelectedIndex = DataProcessor.CurrentProfile;
profiles.IsReadOnly = false;
MessageBox.Show(Utils.LoginResponse(DataProcessor));
btnLogin.IsEnabled = false;
ValCCAPI = new API(AuthResponse.AuthTokens, SelectedProfile, 2, (chkbxShareable.IsChecked ?? false));
}

private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Expand All @@ -124,9 +106,6 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
ads_color.SelectedColor = Color.FromRgb(SelectedProfile.aDS.Color.R, SelectedProfile.aDS.Color.G, SelectedProfile.aDS.Color.B);
ads_outline_color.SelectedColor = Color.FromRgb(SelectedProfile.aDS.OutlineColor.R, SelectedProfile.aDS.OutlineColor.G, SelectedProfile.aDS.OutlineColor.B);
sniper_dot_color.SelectedColor = Color.FromRgb(SelectedProfile.Sniper.CenterDotColor.R, SelectedProfile.Sniper.CenterDotColor.G, SelectedProfile.Sniper.CenterDotColor.B);

if (ValCCAPI != null) ValCCAPI.profile = SelectedProfile;
if (ValCCAPI != null && (chkbxShareable.IsChecked ?? false)) ValCCAPI.Set();
Crosshair_load();
}
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
Expand All @@ -138,7 +117,7 @@ private void btnReload_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
MessageBox.Show("You are not logged in!");
MessageTxt.Text = "You are not logged in!";
return;
}
Utils.Log("Reload Clicked > Reconstructing Processor.");
Expand Down Expand Up @@ -288,7 +267,8 @@ private void btnOpenLogs_Click(object sender, RoutedEventArgs e)
Process p = new Process();
p.StartInfo = new ProcessStartInfo() { FileName = LoggingDir, UseShellExecute = true };
p.Start();
MessageBox.Show("Log folder opened. Please include the OLD file on your report as this helps us recreate the bug/error you will report.");
MessageTxt.Foreground = Brushes.Lime;
MessageTxt.Text = "Log folder opened! Please include OLD files to your report if exists.";
}

private void next_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -317,7 +297,7 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
MessageBox.Show("You are not logged in!");
MessageTxt.Text = "You are not logged in!";
return;
}
try
Expand All @@ -336,11 +316,22 @@ private void chkbxShareable_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
MessageBox.Show("You are not logged in!");
MessageTxt.Text = "You are not logged in!";
((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;
return;
}
}

private void btnShare_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
MessageTxt.Text = "You are not logged in!";
return;
}
MessageTxt.Text = "Your profile has been saved! Make sure you have the 'shareable' checkbox checked!";
ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked;
ValCCAPI.profile = SelectedProfile;
_ = ValCCAPI.Set();
}
}
Expand Down
Binary file added ValorantCC/Resources/vtspinner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion ValorantCC/SubWindow/ProfilesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ValorantCC"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d"
Title="ProfilesWindow" Height="Auto" Width="Auto" ResizeMode="NoResize" SizeToContent="WidthAndHeight" ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Border Background="#232429" Height="450" Width="351" Loaded="Border_Loaded">
Expand All @@ -14,7 +15,7 @@
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Height="420">
<StackPanel Name="ShareablesContainer" HorizontalAlignment="Center">
<TextBlock Name="LoadingTxt" FontSize="32" Foreground="White" >L o a d i n g . . . :D</TextBlock>
<Image gif:ImageBehavior.AnimatedSource="../Resources/vtspinner.gif" Width="50" Height="50" Name="LoadingPlaceHolder"/>
</StackPanel>
</ScrollViewer>
</StackPanel>
Expand Down
7 changes: 4 additions & 3 deletions ValorantCC/SubWindow/ProfilesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI)

private async void Border_Loaded(object sender, RoutedEventArgs e)
{
LoadingTxt.Visibility = Visibility.Visible;
LoadingPlaceHolder.Visibility = Visibility.Visible;
await InitialFetch();
LoadingTxt.Visibility = Visibility.Collapsed;
LoadingPlaceHolder.Visibility = Visibility.Collapsed;
await RenderProfiles();
}

Expand Down Expand Up @@ -266,7 +266,8 @@ private async Task<UIElement> CreateRender(PublicProfile profile)
Grid0.Children.Add(detailsButton);
Grid0.Children.Add(applyButton);

var cross = profile.settings.Primary;
ProfileSettings cross = profile.settings.Primary;

Crosshair_Parser.Generate(0, Grid0, cross);
if (!profile.settings.bUsePrimaryCrosshairForADS)
cross = profile.settings.aDS;
Expand Down
21 changes: 11 additions & 10 deletions ValorantCC/ValorantCC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<None Remove="Resources\CrosshairBG5.png" />
<None Remove="Resources\folder.png" />
<None Remove="Resources\vtools-colored.ico" />
<None Remove="Resources\vtspinner.gif" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -64,13 +65,20 @@
<Resource Include="Resources\CrosshairBG5.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\vtools-colored.ico" />
<Resource Include="Resources\vtspinner.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>

<ItemGroup>
<PackageReference Include="EZ_Updater" Version="0.5.0.1" />
<PackageReference Include="EZ_Updater" Version="0.5.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="RestSharp" Version="106.13.0" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="RestSharp" Version="106.15.0" />
<PackageReference Include="WpfAnimatedGif" Version="2.0.2" />
</ItemGroup>

<ItemGroup>
Expand All @@ -93,11 +101,4 @@
<_DeploymentManifestIconFile Remove="Resources\vtools-colored.ico" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\vtools-colored.ico" />
</ItemGroup>

</Project>
Loading

0 comments on commit 55142f9

Please # to comment.