diff --git a/ValorantCC/App.xaml b/ValorantCC/App.xaml
index 18a7851..3bde1c2 100644
--- a/ValorantCC/App.xaml
+++ b/ValorantCC/App.xaml
@@ -4,386 +4,15 @@
xmlns:local="clr-namespace:ValorantCC"
StartupUri="MainWindow.xaml">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/ValorantCC/App.xaml.cs b/ValorantCC/App.xaml.cs
index 547525f..d62e6b6 100644
--- a/ValorantCC/App.xaml.cs
+++ b/ValorantCC/App.xaml.cs
@@ -33,12 +33,12 @@ private void AppEventHandler(object sender, StartupEventArgs e)
private void LogFirstChanceException(object sender, FirstChanceExceptionEventArgs e)
{
- Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
+ Utilities.Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
}
private void LogDispatcherUnhandled(object sender, DispatcherUnhandledExceptionEventArgs e)
{
- Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
+ Utilities.Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
e.Handled = false;
}
@@ -47,13 +47,13 @@ private void LogUnhandled(object sender, UnhandledExceptionEventArgs e)
var ex = e.ExceptionObject as Exception;
if (e.IsTerminating)
{
- Utils.Log($"{ex.Message}: {ex.StackTrace}");
+ Utilities.Utils.Log($"{ex.Message}: {ex.StackTrace}");
}
}
private void LogUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
- Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
+ Utilities.Utils.Log($"{e.Exception.Message}: {e.Exception.StackTrace}");
e.SetObserved();
}
}
diff --git a/ValorantCC/MainWindow.xaml b/ValorantCC/MainWindow.xaml
index 384d219..f912fdd 100644
--- a/ValorantCC/MainWindow.xaml
+++ b/ValorantCC/MainWindow.xaml
@@ -1,14 +1,17 @@
-
@@ -17,83 +20,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
@@ -121,11 +86,13 @@
+
-
-
-
-
+
+
+
+
+
@@ -153,91 +120,138 @@
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs
index 6eee048..c6adef7 100644
--- a/ValorantCC/MainWindow.xaml.cs
+++ b/ValorantCC/MainWindow.xaml.cs
@@ -1,4 +1,5 @@
using EZ_Updater;
+using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -15,7 +16,7 @@
namespace ValorantCC
{
- public partial class MainWindow : Window
+ public partial class MainWindow : MetroWindow
{
public Processor DataProcessor = new Processor();
BrushConverter bc = new BrushConverter();
@@ -29,47 +30,22 @@ public partial class MainWindow : Window
public MainWindow()
{
// Create logging dir
- if (!Directory.Exists(Path.GetDirectoryName(Utils.LoggingFile))) Directory.CreateDirectory(Path.GetDirectoryName(Utils.LoggingFile));
+ if (!Directory.Exists(Path.GetDirectoryName(Utilities.Utils.LoggingFile))) Directory.CreateDirectory(Path.GetDirectoryName(Utilities.Utils.LoggingFile));
// Replace old logs
- if (File.Exists(Utils.LoggingFile)) File.Move(Utils.LoggingFile, Utils.LoggingFile + ".old", true);
+ if (File.Exists(Utilities.Utils.LoggingFile)) File.Move(Utilities.Utils.LoggingFile, Utilities.Utils.LoggingFile + ".old", true);
Version ProgramFileVersion = new Version(FileVersionInfo.GetVersionInfo(Process.GetCurrentProcess().MainModule.FileName).ProductVersion);
InitializeComponent();
- Utils.Log($"App Started | v{ProgramFileVersion}. Replaced old logfile.");
- Txt_CurrVer.Content = $"ValorantCC3.0b - v{ProgramFileVersion}";
+ Utilities.Utils.Log($"App Started | v{ProgramFileVersion}. Replaced old logfile.");
+ this.Title = $"ValorantCC3.0b - v{ProgramFileVersion}";
BackgroundAuth auth = new BackgroundAuth(DataProcessor);
auth.LoopCheck();
}
-
- private async void Grid_Loaded(object sender, RoutedEventArgs e)
- {
- Updater.CustomLogger = Utils.Log;
- Updater.OriginalFileName = "ValorantCC";
- Updater.LogInterfix = " | ";
- if (await Updater.CheckUpdateAsync("weedeej", "ValorantCC"))
- {
- try
- {
- File.Create("./valccPermsTest.null").Close();
- File.Delete("./valccPermsTest.null");
- }
- catch (UnauthorizedAccessException)
- {
- Utils.Log("User is not authorized to create a file on current valcc dir. Consider moving.");
- MessageWindow.Show("There's an update available but you have no access to write on this folder.\nPlease consider moving the app to a folder created by you or running the app as administrator.");
- this.Close();
- }
- var update = new UpdateWindow();
- update.Owner = this;
- update.ShowDialog();
- }
- }
-
private async void btnSave_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- Utils.MessageText("You are not logged in!", Brushes.Red);
+ Utilities.Utils.MessageText("You are not logged in!", Brushes.Red);
return;
}
if (DataProcessor.ProfileListed)
@@ -85,10 +61,10 @@ private async void btnSave_Click(object sender, RoutedEventArgs e)
await DataProcessor.Construct();
profiles.Items.Refresh();
profiles.SelectedIndex = DataProcessor.CurrentProfile;
- Utils.MessageText("Saved! Restart Valorant.", Brushes.Lime);
+ Utilities.Utils.MessageText("Saved! Restart Valorant.", Brushes.Lime);
return;
}
- Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
+ Utilities.Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
return;
}
@@ -126,12 +102,12 @@ private async void btnReload_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- Utils.MessageText("You are not logged in!", Brushes.Red);
+ Utilities.Utils.MessageText("You are not logged in!", Brushes.Red);
return;
}
- Utils.Log("Reload Clicked > Reconstructing Processor.");
+ Utilities.Utils.Log("Reload Clicked > Reconstructing Processor.");
if (!(await DataProcessor.Construct()))
- Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
+ Utilities.Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
profiles.ItemsSource = DataProcessor.ProfileNames;
profiles.Items.Refresh();
@@ -276,9 +252,9 @@ private void ClipboardButtonLeave(object sender, MouseEventArgs e)
private void btnOpenLogs_Click(object sender, RoutedEventArgs e)
{
Process p = new Process();
- p.StartInfo = new ProcessStartInfo() { FileName = Path.GetDirectoryName(Utils.LoggingFile), UseShellExecute = true };
+ p.StartInfo = new ProcessStartInfo() { FileName = Path.GetDirectoryName(Utilities.Utils.LoggingFile), UseShellExecute = true };
p.Start();
- Utils.MessageText("Log folder opened! Please include OLD files to your report if exists.", Brushes.Lime);
+ Utilities.Utils.MessageText("Log folder opened! Please include OLD files to your report if exists.", Brushes.Lime);
}
private void next_Click(object sender, RoutedEventArgs e)
@@ -307,7 +283,7 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- Utils.MessageText("You are not logged in !", Brushes.Red);
+ Utilities.Utils.MessageText("You are not logged in !", Brushes.Red);
return;
}
try
@@ -327,7 +303,7 @@ private void chkbxShareable_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- Utils.MessageText("You are not logged in !", Brushes.Red);
+ Utilities.Utils.MessageText("You are not logged in !", Brushes.Red);
((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;
return;
}
@@ -337,11 +313,10 @@ private async void btnShare_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- Utils.MessageText("You are not logged in !", Brushes.Red);
+ Utilities.Utils.MessageText("You are not logged in !", Brushes.Red);
return;
}
- exitButton.Visibility = Visibility.Collapsed;
- Utils.MessageText("Your profile is being saved...", Brushes.Yellow);
+ Utilities.Utils.MessageText("Your profile is being saved...", Brushes.Yellow);
ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked;
ValCCAPI.profile = SelectedProfile;
@@ -350,8 +325,31 @@ private async void btnShare_Click(object sender, RoutedEventArgs e)
Clipboard.SetText(sharecode);
MessageWindow.Show($"Your sharecode is: \"{sharecode}\" and is copied.\nIf you want this profile accessible across the community,\nPlease be sure that you have the 'shareable' checkbox checked.", "Profile shared!");
- Utils.MessageText("Your profile has been saved. It can now be browsed if \"shareable\" checkbox is checked before saving.", Brushes.Lime);
- exitButton.Visibility = Visibility.Visible;
+ Utilities.Utils.MessageText("Your profile has been saved. It can now be browsed if \"shareable\" checkbox is checked before saving.", Brushes.Lime);
+ }
+
+ private async void spinner_Loaded(object sender, RoutedEventArgs e)
+ {
+ Updater.CustomLogger = Utilities.Utils.Log;
+ Updater.OriginalFileName = "ValorantCC";
+ Updater.LogInterfix = " | ";
+ if (await Updater.CheckUpdateAsync("weedeej", "ValorantCC"))
+ {
+ try
+ {
+ File.Create("./valccPermsTest.null").Close();
+ File.Delete("./valccPermsTest.null");
+ }
+ catch (UnauthorizedAccessException)
+ {
+ Utilities.Utils.Log("User is not authorized to create a file on current valcc dir. Consider moving.");
+ MessageWindow.Show("There's an update available but you have no access to write on this folder.\nPlease consider moving the app to a folder created by you or running the app as administrator.");
+ this.Close();
+ }
+ var update = new UpdateWindow();
+ update.Owner = this;
+ update.ShowDialog();
+ }
}
}
}
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml b/ValorantCC/SubWindow/ProfilesWindow.xaml
index dc34d16..deed021 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml
@@ -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: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">
@@ -26,9 +27,10 @@
-
-
+
+
+ An error has occured while fetching profiles.
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index 321038d..8d293a1 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
@@ -8,7 +9,7 @@
using System.Windows.Input;
using System.Windows.Media;
using ValorantCC.SubWindow;
-
+using Utilities;
namespace ValorantCC
{
///
@@ -35,14 +36,27 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
main = (MainWindow)Application.Current.MainWindow;
selected = current;
ValCCApi = ValCCAPI;
+ Utilities.Utils.Log("Community Profiles Loading...");
}
private async void ShareablesContainer_Loaded(object sender, RoutedEventArgs e)
{
LoadingPlaceHolder.Visibility = Visibility.Visible;
- await InitialFetch();
+ fetchErrorTxt.Visibility = Visibility.Collapsed;
+ try
+ {
+ bool fetchSucc = await InitialFetch();
+ if (!fetchSucc) fetchErrorTxt.Visibility = Visibility.Visible;
+ else
+ {
+ await RenderProfiles();
+ }
+ }
+ catch (Exception ex)
+ {
+ Utilities.Utils.Log(ex.StackTrace.ToString());
+ }
LoadingPlaceHolder.Visibility = Visibility.Collapsed;
- await RenderProfiles();
}
///
@@ -51,34 +65,36 @@ private async void ShareablesContainer_Loaded(object sender, RoutedEventArgs e)
/// Nullable. Searched Code
private async Task InitialFetch(String sharecode = null)
{
+ Utilities.Utils.Log("Disabling Search button.");
btnSearchCode.IsEnabled = false;
+ Utilities.Utils.Log("Clearing arrays.");
PublicProfiles.Clear();
ShareablesContainer.Children.Clear();
List Shareables;
if (!string.IsNullOrWhiteSpace(sharecode))
{
+ Utilities.Utils.Log($"Fetching profile with code: {sharecode}");
ValCCApi.Action = 3;
- Shareables = (await ValCCApi.Fetch(sharecode)).data;
+ FetchResponse fetchResponse = await ValCCApi.Fetch(sharecode);
+ if (!fetchResponse.success) return false;
+ Shareables = fetchResponse.data;
}
else
{
+ Utilities.Utils.Log($"Fetching profiles from server");
ValCCApi.Action = 2;
- Shareables = (await ValCCApi.Fetch()).data;
+ FetchResponse fetchResponse = await ValCCApi.Fetch(sharecode);
+ if (!fetchResponse.success) return false;
+ Shareables = fetchResponse.data;
}
if (Shareables.Count == 0) return true;
+
for (int i = 0; i < Shareables.Count; i++)
{
ShareableProfile currentShareable = Shareables[i];
CrosshairProfile profile;
- try
- {
- profile = JsonConvert.DeserializeObject(Regex.Unescape(currentShareable.settings));
- }
- catch
- {
- continue;
- }
+ profile = JsonConvert.DeserializeObject(Regex.Unescape(currentShareable.settings));
PublicProfiles.Add(new PublicProfile() { owner = currentShareable.displayName, settings = profile, sharecode = currentShareable.shareCode, ID = i });
}
btnSearchCode.IsEnabled = true;
@@ -103,9 +119,19 @@ private async Task RenderProfiles()
private async void btnSearchCode_Click(object sender, RoutedEventArgs e)
{
LoadingPlaceHolder.Visibility = Visibility.Visible;
- await InitialFetch(SearchCode.Text);
+ fetchErrorTxt.Visibility = Visibility.Collapsed;
+ try
+ {
+ bool fetchSucc = await InitialFetch(SearchCode.Text);
+ if (!fetchSucc) fetchErrorTxt.Visibility = Visibility.Visible;
+ else
+ await RenderProfiles();
+ }
+ catch (Exception ex)
+ {
+ Utilities.Utils.Log(ex.StackTrace.ToString());
+ }
LoadingPlaceHolder.Visibility = Visibility.Collapsed;
- await RenderProfiles();
}
public void shareBtnClicked(object sender, RoutedEventArgs e)
@@ -113,6 +139,7 @@ public void shareBtnClicked(object sender, RoutedEventArgs e)
String shareCode = ((Button)sender).Name.Split('_')[1];
Clipboard.SetText(shareCode);
MessageWindow.Show("\"" + shareCode + "\" has been copied to clipboard!");
+ Utilities.Utils.Log($"{shareCode} copied to clipboard.");
}
public void detailsBtnClicked(object sender, RoutedEventArgs e)
@@ -120,10 +147,12 @@ public void detailsBtnClicked(object sender, RoutedEventArgs e)
PublicProfile pressedPubProfile = PublicProfiles[Int32.Parse(((Button)sender).Name.Split('_')[1])];
CrosshairProfile pressedProfile = pressedPubProfile.settings;
MessageWindow.Show($"{pressedPubProfile.owner}'s Profile: {pressedProfile.ProfileName}\nPrimary:\n\tInner Lines: {pressedProfile.Primary.InnerLines.Opacity}, {pressedProfile.Primary.InnerLines.LineLength}, {pressedProfile.Primary.InnerLines.LineThickness}, {pressedProfile.Primary.InnerLines.LineOffset}\n\tOuter Lines: {pressedProfile.Primary.OuterLines.Opacity}, {pressedProfile.Primary.OuterLines.LineLength}, {pressedProfile.Primary.OuterLines.LineThickness}, {pressedProfile.Primary.OuterLines.LineOffset}\n\nADS:\n\tInner Lines: {pressedProfile.aDS.InnerLines.Opacity}, {pressedProfile.aDS.InnerLines.LineLength}, {pressedProfile.aDS.InnerLines.LineThickness}, {pressedProfile.aDS.InnerLines.LineOffset}\n\tOuter Lines: {pressedProfile.aDS.OuterLines.Opacity}, {pressedProfile.aDS.OuterLines.LineLength}, {pressedProfile.aDS.OuterLines.LineThickness}, {pressedProfile.aDS.OuterLines.LineOffset}");
+ Utilities.Utils.Log($"Details button clicked.");
}
public void applyBtnClicked(object sender, RoutedEventArgs e)
{
+ Utilities.Utils.Log("Apply button clicked.");
PublicProfile pressedPubProfile = PublicProfiles[Int32.Parse(((Button)sender).Name.Split('_')[1])];
CrosshairProfile pressedProfile = pressedPubProfile.settings;
selected.aDS = pressedProfile.aDS;
diff --git a/ValorantCC/SubWindow/src/CreateRender.cs b/ValorantCC/SubWindow/src/CreateRender.cs
index 6f5f309..343423f 100644
--- a/ValorantCC/SubWindow/src/CreateRender.cs
+++ b/ValorantCC/SubWindow/src/CreateRender.cs
@@ -83,16 +83,19 @@ public static async Task GenerateRender(this ProfilesWindow profilesW
Grid.SetColumn(ownerName, 2);
Grid.SetRow(ownerName, 0);
- style = (Style)profilesWindow.FindResource("RoundButton");
+ style = (Style)profilesWindow.FindResource("MahApps.Styles.Button.MetroWindow.Base");
Button shareButton = ButtonType.Share.Generate(profile.sharecode);
shareButton.Click += profilesWindow.shareBtnClicked;
+ shareButton.Foreground = Brushes.White;
Button detailsButton = ButtonType.Details.Generate(profile.ID.ToString());
detailsButton.Click += profilesWindow.detailsBtnClicked;
+ detailsButton.Foreground = Brushes.White;
Button applyButton = ButtonType.Apply.Generate(profile.ID.ToString());
applyButton.Click += profilesWindow.applyBtnClicked;
+ applyButton.Foreground = Brushes.White;
Grid.SetColumn(shareButton, 0);
Grid.SetRow(shareButton, 1);
diff --git a/ValorantCC/ValorantCC.csproj b/ValorantCC/ValorantCC.csproj
index b36df01..e04c93e 100644
--- a/ValorantCC/ValorantCC.csproj
+++ b/ValorantCC/ValorantCC.csproj
@@ -77,6 +77,7 @@
+
diff --git a/ValorantCC/src/API.cs b/ValorantCC/src/API.cs
index 435a54e..4572613 100644
--- a/ValorantCC/src/API.cs
+++ b/ValorantCC/src/API.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Utilities;
namespace ValorantCC
{
@@ -76,7 +77,12 @@ public async Task Fetch(String sharecode = null)
RestRequest request = new RestRequest() { Method = Method.Post };
request.AddJsonBody(payload);
RestResponse response = await client.ExecuteAsync(request);
- if (!response.IsSuccessful) return new FetchResponse() { success = false };
+ if (!response.IsSuccessful)
+ {
+ Utilities.Utils.Log(response.Content.ToString());
+ return new FetchResponse() { success = false };
+ }
+
return JsonConvert.DeserializeObject(response.Content);
}
@@ -95,7 +101,11 @@ public async Task Set()
request.AddJsonBody(payload);
request.AddOrUpdateHeader("Authorization", $"Bearer {AuthTokens.AccessToken}"); // Pass to server so nobody can set somebody's saved profile.
RestResponse response = await client.ExecuteAsync(request);
- if (!response.IsSuccessful) return new SetCallResponse() { success = false };
+ if (!response.IsSuccessful)
+ {
+ Utilities.Utils.Log(response.Content.ToString());
+ return new SetCallResponse() { success = false };
+ }
return JsonConvert.DeserializeObject(response.Content);
}
diff --git a/ValorantCC/src/Auth.cs b/ValorantCC/src/Auth.cs
index 6e45b45..704a899 100644
--- a/ValorantCC/src/Auth.cs
+++ b/ValorantCC/src/Auth.cs
@@ -77,7 +77,7 @@ public static LockfileData ObtainLockfileData(string LockfilePath)
string LockfileRaw;
try
{
- Utils.Log("Trying to open Lockfile");
+ Utilities.Utils.Log("Trying to open Lockfile");
using (FileStream File = new FileStream(LockfilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (StreamReader Reader = new StreamReader(File, Encoding.UTF8))
@@ -90,7 +90,7 @@ public static LockfileData ObtainLockfileData(string LockfilePath)
}
catch (FileNotFoundException)
{
- Utils.Log("Lockfile not found");
+ Utilities.Utils.Log("Lockfile not found");
return new LockfileData();
}
@@ -109,7 +109,7 @@ public static LockfileData ObtainLockfileData(string LockfilePath)
private async Task ObtainAuthTokens()
{
- Utils.Log("Creating Auth Request");
+ Utilities.Utils.Log("Creating Auth Request");
RestRequest request = new RestRequest($"https://127.0.0.1:{LocalCredentials.Port}/entitlements/v1/token", Method.Get);
request.AddHeader("Authorization", $"Basic {LocalCredentials.Basic}");
@@ -123,7 +123,7 @@ private async Task ObtainAuthTokens()
private async static Task GetVersion()
{
- Utils.Log("Obtaining Client Version info");
+ Utilities.Utils.Log("Obtaining Client Version info");
RestRequest request = new RestRequest("https://valorant-api.com/v1/version", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
diff --git a/ValorantCC/src/BackgroundAuth.cs b/ValorantCC/src/BackgroundAuth.cs
index c670e40..7b3ea8a 100644
--- a/ValorantCC/src/BackgroundAuth.cs
+++ b/ValorantCC/src/BackgroundAuth.cs
@@ -56,12 +56,14 @@ public async void LoopCheck()
main.DotTxt.Foreground = Brushes.Lime;
main.StatusTxt.Foreground = Brushes.Lime;
- Utils.MessageText(Utils.LoginResponse(processor), Brushes.Lime);
+ Utilities.Utils.MessageText(Utilities.Utils.LoginResponse(processor), Brushes.Lime);
main.StatusTxt.Text = "Logged In!";
main.ch_display.Visibility = Visibility.Visible;
main.buttons_group.Visibility = Visibility.Visible;
main.controls_group.Visibility = Visibility.Visible;
+ main.chkbxShareable.Visibility = Visibility.Visible;
+
main.spinner.Visibility = Visibility.Collapsed;
main.spinner.Spin = false;
main.Top = main.Top - (main.Height - OriginalHeight);
diff --git a/ValorantCC/src/Modifier.cs b/ValorantCC/src/Modifier.cs
index 81a6083..0490be6 100644
--- a/ValorantCC/src/Modifier.cs
+++ b/ValorantCC/src/Modifier.cs
@@ -12,29 +12,30 @@ public static class Modifier
{
public static Data ChangeActiveProfile(List Colors, int SelectedIndex, Data UserSettings, ProfileList FetchedProfiles)
{
- Utils.Log("Updating active color");
+ Utilities.Utils.Log("Updating active color");
try
{
Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
- activeProfileColor.value = Utils.ColorToString(Colors[0]);
+ activeProfileColor.value = Utilities.Utils.ColorToString(Colors[0]);
}
- catch (ArgumentNullException ex)
+ catch (ArgumentNullException)
{
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utils.ColorToString(Colors[0]) });
+ 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)
{
- Utils.Log("Removing Old colors.");
+ 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");
}
- Utils.Log("Appending new colors.");
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairSniperCenterDotColor", value = Utils.ColorToString(Colors[4]) });
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSColor", value = Utils.ColorToString(Colors[2]) });
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairOutlineColor", value = Utils.ColorToString(Colors[1]) });
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairADSOutlineColor", value = 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;
}
}
diff --git a/ValorantCC/src/Processor.cs b/ValorantCC/src/Processor.cs
index d96c787..2a1b681 100644
--- a/ValorantCC/src/Processor.cs
+++ b/ValorantCC/src/Processor.cs
@@ -23,24 +23,24 @@ public class Processor
public async Task Login()
{
- Utils.Log("Login started");
+ Utilities.Utils.Log("Login started");
AuthObj AuthObj = new AuthObj();
AuthResponse = await AuthObj.StartAuth();
if (!AuthResponse.Success) return AuthResponse;
- Utils.Log("Auth Success");
+ Utilities.Utils.Log("Auth Success");
await Construct();
return AuthResponse;
}
public async Task Construct()
{
- Utils.Log("Constructing Properties -->");
+ Utilities.Utils.Log("Constructing Properties -->");
UserSettings = await FetchUserSettings();
if (UserSettings.settingsProfiles == null) return false;
ProfileListed = CheckIfList(UserSettings);
- Utils.Log($"Multiple Profiles: {ProfileListed}");
+ Utilities.Utils.Log($"Multiple Profiles: {ProfileListed}");
Stringsetting SavedProfiles;
if (ProfileListed)
{
@@ -53,7 +53,7 @@ public async Task Construct()
SavedProfiles = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
}catch (ArgumentNullException)
{
- Utils.Log("User is new account/Using White Color");
+ Utilities.Utils.Log("User is new account/Using White Color");
UserSettings.stringSettings.Add(new Stringsetting
{
settingEnum = "EAresStringSettingName::CrosshairColor",
@@ -68,28 +68,28 @@ public async Task Construct()
CurrentProfile = FetchedProfiles.CurrentProfile;
isLoggedIn = true;
- Utils.Log("<-- Constructing Properties");
+ Utilities.Utils.Log("<-- Constructing Properties");
return true;
}
private bool CheckIfList(Data settings)
{
- Utils.Log("Checking if User has multiple profiles");
+ Utilities.Utils.Log("Checking if User has multiple profiles");
return settings.stringSettings.Any(setting => setting.settingEnum == "EAresStringSettingName::SavedCrosshairProfileData");
}
private async Task FetchUserSettings()
{
- Utils.Log("Obtaining User Settings");
+ Utilities.Utils.Log("Obtaining User Settings");
RestRequest request = new RestRequest("/playerPref/v3/getPreference/Ares.PlayerSettings", Method.Get);
- request.AddHeaders(Utils.ConstructHeaders(AuthResponse));
+ request.AddHeaders(Utilities.Utils.ConstructHeaders(AuthResponse));
string responseContent = (await client.ExecuteAsync(request)).Content;
RestResponse resp = await client.ExecuteAsync(request);
Dictionary response = JsonConvert.DeserializeObject>(responseContent);
Data settings = new Data();
try
{
- settings = Utils.Decompress(Convert.ToString(response["data"]));
+ settings = Utilities.Utils.Decompress(Convert.ToString(response["data"]));
}catch (KeyNotFoundException)
{
return settings;
@@ -100,33 +100,33 @@ private async Task FetchUserSettings()
private async Task putUserSettings(Data newData)
{
- Utils.Log("Saving New Data: (BACKUP) " + JsonConvert.SerializeObject(newData));
+ Utilities.Utils.Log("Saving New Data: (BACKUP) " + JsonConvert.SerializeObject(newData));
RestRequest request = new RestRequest("/playerPref/v3/savePreference", Method.Put);
- request.AddHeaders(Utils.ConstructHeaders(AuthResponse));
- request.AddJsonBody(new { type = "Ares.PlayerSettings", data = Utils.Compress(newData) });
+ request.AddHeaders(Utilities.Utils.ConstructHeaders(AuthResponse));
+ request.AddJsonBody(new { type = "Ares.PlayerSettings", data = Utilities.Utils.Compress(newData) });
RestResponse response = await client.ExecuteAsync(request);
if (!response.IsSuccessful)
{
- Utils.Log("savePreference Unsuccessfull: "+response.Content.ToString());
+ Utilities.Utils.Log("savePreference Unsuccessfull: "+response.Content.ToString());
return false;
}
Dictionary responseDict = JsonConvert.DeserializeObject>(response.Content);
if (responseDict.ContainsKey("data")) return true;
- Utils.Log("savePreference Unsuccessfull: "+response.Content.ToString());
+ Utilities.Utils.Log("savePreference Unsuccessfull: "+response.Content.ToString());
return false;
}
private ProfileList FetchProfiles(string SettingValue)
{
string DefaultUserSettings = JsonConvert.SerializeObject(UserSettings);
- Utils.Log("Fetching/Creating Profile/s");
- Utils.Log($"Setting Value: {DefaultUserSettings}");
+ Utilities.Utils.Log("Fetching/Creating Profile/s");
+ Utilities.Utils.Log($"Setting Value: {DefaultUserSettings}");
if (ProfileListed) return JsonConvert.DeserializeObject(SettingValue);
- CrosshairColor ParsedColor = Utils.parseCrosshairColor(SettingValue);
+ CrosshairColor ParsedColor = Utilities.Utils.parseCrosshairColor(SettingValue);
string profileName = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::CrosshairProfileName").value;
return new ProfileList
@@ -145,7 +145,7 @@ private ProfileList FetchProfiles(string SettingValue)
private List FetchProfileNames(ProfileList ProfileList)
{
- Utils.Log("Fetching Profile names");
+ Utilities.Utils.Log("Fetching Profile names");
if (ProfileListed) return (from profile in ProfileList.Profiles
select profile.ProfileName).ToList();
@@ -155,7 +155,7 @@ private List FetchProfileNames(ProfileList ProfileList)
public CrosshairProfile ProfileFromIndex(int Index)
{
- Utils.Log($"Obtained Profile from index: {FetchedProfiles.Profiles[Index].ProfileName}");
+ Utilities.Utils.Log($"Obtained Profile from index: {FetchedProfiles.Profiles[Index].ProfileName}");
return FetchedProfiles.Profiles[Index];
}
@@ -169,11 +169,11 @@ private void SaveListedSettings(List Colors, int SelectedIndex)
}
catch (Exception e)
{
- Utils.Log($"Error occured: {e}");
+ Utilities.Utils.Log($"Error occured: {e}");
}
}
- Utils.Log("Modifying Selected Profile.");
+ Utilities.Utils.Log("Modifying Selected Profile.");
CrosshairProfile currentProfile = FetchedProfiles.Profiles[SelectedIndex];
currentProfile.bUseAdvancedOptions = true;
@@ -198,10 +198,10 @@ private void SaveListedSettings(List Colors, int SelectedIndex)
}
public async Task SaveNewColor(List Colors, int SelectedIndex, string ProfileName)
{
- Utils.Log("Save button clicked. Saving...");
+ Utilities.Utils.Log("Save button clicked. Saving...");
if (ProfileListed)
{
- Utils.Log("Profile type: List");
+ Utilities.Utils.Log("Profile type: List");
SaveListedSettings(Colors, SelectedIndex);
FetchedProfiles.Profiles[SelectedIndex].ProfileName = ProfileName;
Stringsetting SavedProfiles = UserSettings.stringSettings.FirstOrDefault(setting => setting.settingEnum == "EAresStringSettingName::SavedCrosshairProfileData");
@@ -209,15 +209,15 @@ public async Task SaveNewColor(List Colors, int SelectedIndex, stri
}
else
{
- Utils.Log("Profile type: Enum");
+ 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 = Utils.ColorToString(Colors[0]);
+ SavedProfile.value = Utilities.Utils.ColorToString(Colors[0]);
profileName.value = ProfileName;
}
if (await putUserSettings(UserSettings))
{
- Utils.Log("Reconstructing Data");
+ Utilities.Utils.Log("Reconstructing Data");
await Construct();
return true;
}