diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs
index 8444139..6eee048 100644
--- a/ValorantCC/MainWindow.xaml.cs
+++ b/ValorantCC/MainWindow.xaml.cs
@@ -36,7 +36,7 @@ public MainWindow()
InitializeComponent();
Utils.Log($"App Started | v{ProgramFileVersion}. Replaced old logfile.");
- Txt_CurrVer.Content = $"v{ProgramFileVersion}";
+ Txt_CurrVer.Content = $"ValorantCC3.0b - v{ProgramFileVersion}";
BackgroundAuth auth = new BackgroundAuth(DataProcessor);
auth.LoopCheck();
}
@@ -88,7 +88,7 @@ private async void btnSave_Click(object sender, RoutedEventArgs e)
Utils.MessageText("Saved! Restart Valorant.", Brushes.Lime);
return;
}
- Utils.MessageText("Failed. Consult developer.", Brushes.Red);
+ Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
return;
}
@@ -130,7 +130,9 @@ private async void btnReload_Click(object sender, RoutedEventArgs e)
return;
}
Utils.Log("Reload Clicked > Reconstructing Processor.");
- await DataProcessor.Construct();
+ if (!(await DataProcessor.Construct()))
+ Utils.MessageText("Your session expired! Please restart ValorantCC/Valorant", Brushes.Red);
+
profiles.ItemsSource = DataProcessor.ProfileNames;
profiles.Items.Refresh();
profiles.SelectedIndex = DataProcessor.CurrentProfile;
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index b22d8cc..321038d 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -32,7 +32,7 @@ public partial class ProfilesWindow : Window
public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
{
InitializeComponent();
- main = (MainWindow)this.Owner;
+ main = (MainWindow)Application.Current.MainWindow;
selected = current;
ValCCApi = ValCCAPI;
}
diff --git a/ValorantCC/ValorantCC.csproj b/ValorantCC/ValorantCC.csproj
index 03df43f..b36df01 100644
--- a/ValorantCC/ValorantCC.csproj
+++ b/ValorantCC/ValorantCC.csproj
@@ -14,7 +14,7 @@
false
- 3.0.0
+ 2.9.0
false
diff --git a/ValorantCC/src/Modifier.cs b/ValorantCC/src/Modifier.cs
new file mode 100644
index 0000000..81a6083
--- /dev/null
+++ b/ValorantCC/src/Modifier.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using Utilities;
+
+namespace ValorantCC.src
+{
+ public static class Modifier
+ {
+ public static Data ChangeActiveProfile(List Colors, int SelectedIndex, Data UserSettings, ProfileList FetchedProfiles)
+ {
+ Utils.Log("Updating active color");
+ try
+ {
+ Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
+ activeProfileColor.value = Utils.ColorToString(Colors[0]);
+ }
+ catch (ArgumentNullException ex)
+ {
+ UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utils.ColorToString(Colors[0]) });
+ }
+ if (FetchedProfiles.Profiles[SelectedIndex].bUseAdvancedOptions)
+ {
+ 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]) });
+ return UserSettings;
+ }
+ }
+}
diff --git a/ValorantCC/src/Processor.cs b/ValorantCC/src/Processor.cs
index 2542728..d96c787 100644
--- a/ValorantCC/src/Processor.cs
+++ b/ValorantCC/src/Processor.cs
@@ -2,11 +2,12 @@
using RestSharp;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Media;
using Utilities;
-
+using ValorantCC.src;
namespace ValorantCC
{
public class Processor
@@ -36,6 +37,8 @@ public async Task Construct()
Utils.Log("Constructing Properties -->");
UserSettings = await FetchUserSettings();
+ if (UserSettings.settingsProfiles == null) return false;
+
ProfileListed = CheckIfList(UserSettings);
Utils.Log($"Multiple Profiles: {ProfileListed}");
Stringsetting SavedProfiles;
@@ -80,9 +83,18 @@ private async Task FetchUserSettings()
Utils.Log("Obtaining User Settings");
RestRequest request = new RestRequest("/playerPref/v3/getPreference/Ares.PlayerSettings", Method.Get);
request.AddHeaders(Utils.ConstructHeaders(AuthResponse));
- string responseContext = (await client.ExecuteAsync(request)).Content;
- Dictionary response = JsonConvert.DeserializeObject>(responseContext);
- Data settings = Utils.Decompress(Convert.ToString(response["data"]));
+ 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"]));
+ }catch (KeyNotFoundException)
+ {
+ return settings;
+ }
+
return settings;
}
@@ -147,39 +159,13 @@ public CrosshairProfile ProfileFromIndex(int Index)
return FetchedProfiles.Profiles[Index];
}
- private void ChangeActiveProfile(List Colors, int SelectedIndex)
- {
- Utils.Log("Updating active color");
- try
- {
- Stringsetting activeProfileColor = UserSettings.stringSettings.First(setting => setting.settingEnum == "EAresStringSettingName::CrosshairColor");
- activeProfileColor.value = Utils.ColorToString(Colors[0]);
- }
- catch (ArgumentNullException ex)
- {
- UserSettings.stringSettings.Add(new Stringsetting { settingEnum = "EAresStringSettingName::CrosshairColor", value = Utils.ColorToString(Colors[0]) });
- }
- if (FetchedProfiles.Profiles[SelectedIndex].bUseAdvancedOptions)
- {
- 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]) });
- }
private void SaveListedSettings(List Colors, int SelectedIndex)
{
if (SelectedIndex == FetchedProfiles.CurrentProfile)
{
try
{
- ChangeActiveProfile(Colors, SelectedIndex);
+ UserSettings = Modifier.ChangeActiveProfile(Colors, SelectedIndex, UserSettings, FetchedProfiles);
}
catch (Exception e)
{