diff --git a/ValorantCC/MainWindow.xaml b/ValorantCC/MainWindow.xaml
index 789c5b0..384d219 100644
--- a/ValorantCC/MainWindow.xaml
+++ b/ValorantCC/MainWindow.xaml
@@ -231,11 +231,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs
index 135dd5a..8444139 100644
--- a/ValorantCC/MainWindow.xaml.cs
+++ b/ValorantCC/MainWindow.xaml.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using Utilities;
@@ -68,7 +69,7 @@ private async void btnSave_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- MessageTxt.Text = "You are not logged in!";
+ Utils.MessageText("You are not logged in!", Brushes.Red);
return;
}
if (DataProcessor.ProfileListed)
@@ -84,12 +85,11 @@ private async void btnSave_Click(object sender, RoutedEventArgs e)
await DataProcessor.Construct();
profiles.Items.Refresh();
profiles.SelectedIndex = DataProcessor.CurrentProfile;
- MessageTxt.Foreground = Brushes.Lime;
- MessageTxt.Text = "Saved! Restart Valorant.";
+ Utils.MessageText("Saved! Restart Valorant.", Brushes.Lime);
return;
}
- MessageTxt.Foreground = Brushes.Red;
- MessageTxt.Text = "Failed. Consult developer.";
+ Utils.MessageText("Failed. Consult developer.", Brushes.Red);
+
return;
}
@@ -126,7 +126,7 @@ private async void btnReload_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- MessageTxt.Text = "You are not logged in!";
+ Utils.MessageText("You are not logged in!", Brushes.Red);
return;
}
Utils.Log("Reload Clicked > Reconstructing Processor.");
@@ -276,8 +276,7 @@ private void btnOpenLogs_Click(object sender, RoutedEventArgs e)
Process p = new Process();
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.";
+ Utils.MessageText("Log folder opened! Please include OLD files to your report if exists.", Brushes.Lime);
}
private void next_Click(object sender, RoutedEventArgs e)
@@ -306,7 +305,7 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- MessageTxt.Text = "You are not logged in!";
+ Utils.MessageText("You are not logged in !", Brushes.Red);
return;
}
try
@@ -326,23 +325,31 @@ private void chkbxShareable_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- MessageTxt.Text = "You are not logged in!";
+ Utils.MessageText("You are not logged in !", Brushes.Red);
((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;
return;
}
}
- private void btnShare_Click(object sender, RoutedEventArgs e)
+ private async void btnShare_Click(object sender, RoutedEventArgs e)
{
if (!LoggedIn)
{
- MessageTxt.Text = "You are not logged in!";
+ Utils.MessageText("You are not logged in !", Brushes.Red);
return;
}
- MessageTxt.Text = "Your profile has been saved! Make sure you have the 'shareable' checkbox checked!";
+ exitButton.Visibility = Visibility.Collapsed;
+ Utils.MessageText("Your profile is being saved...", Brushes.Yellow);
+
ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked;
ValCCAPI.profile = SelectedProfile;
- _ = ValCCAPI.Set();
+ SetCallResponse response = await ValCCAPI.Set();
+ String sharecode = response.data.shareCode;
+ 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;
}
}
}
diff --git a/ValorantCC/SubWindow/MessageWindow.xaml b/ValorantCC/SubWindow/MessageWindow.xaml
index 7fb1a76..a8305bf 100644
--- a/ValorantCC/SubWindow/MessageWindow.xaml
+++ b/ValorantCC/SubWindow/MessageWindow.xaml
@@ -5,11 +5,16 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ValorantCC.SubWindow"
mc:Ignorable="d"
- Title="MessageWindow" Width="350" Background="#FF232429" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" WindowStyle="None" WindowStartupLocation="CenterOwner" SizeToContent="Height" ResizeMode="NoResize" ShowInTaskbar="False">
-
-
-
-
+ Title="MessageWindow" Width="350" Background="#FF232429" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" WindowStyle="None" WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight" ResizeMode="NoResize" ShowInTaskbar="False">
+
+
+
+
+
+
+
+
+
diff --git a/ValorantCC/SubWindow/MessageWindow.xaml.cs b/ValorantCC/SubWindow/MessageWindow.xaml.cs
index 35e36ec..504999f 100644
--- a/ValorantCC/SubWindow/MessageWindow.xaml.cs
+++ b/ValorantCC/SubWindow/MessageWindow.xaml.cs
@@ -8,16 +8,17 @@ namespace ValorantCC.SubWindow
///
public partial class MessageWindow : Window
{
- public static void Show(string Message)
+ public static void Show(string Message, string Title = null)
{
- MessageWindow MessageWin = new(Message);
+ MessageWindow MessageWin = new(Message, Title);
MessageWin.Owner = Application.Current.Windows.OfType().FirstOrDefault(x => x.IsActive);
MessageWin.ShowDialog();
}
- public MessageWindow(string Message)
+ public MessageWindow(string Message, string Title = null)
{
InitializeComponent();
+ TitleBar.Content = Title;
Messagetxtbox.Text = Message;
Messagetxtbox.Focusable = false;
OKbtn.Focus();
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml b/ValorantCC/SubWindow/ProfilesWindow.xaml
index 045cce2..dc34d16 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml
@@ -8,7 +8,7 @@
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">
-
+
@@ -32,7 +32,7 @@
-
+
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index 850c6d5..b22d8cc 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -37,7 +37,7 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
ValCCApi = ValCCAPI;
}
- private async void Border_Loaded(object sender, RoutedEventArgs e)
+ private async void ShareablesContainer_Loaded(object sender, RoutedEventArgs e)
{
LoadingPlaceHolder.Visibility = Visibility.Visible;
await InitialFetch();
@@ -51,10 +51,11 @@ private async void Border_Loaded(object sender, RoutedEventArgs e)
/// Nullable. Searched Code
private async Task InitialFetch(String sharecode = null)
{
+ btnSearchCode.IsEnabled = false;
PublicProfiles.Clear();
ShareablesContainer.Children.Clear();
List Shareables;
- if (!string.IsNullOrEmpty(sharecode) || !string.IsNullOrWhiteSpace(sharecode))
+ if (!string.IsNullOrWhiteSpace(sharecode))
{
ValCCApi.Action = 3;
Shareables = (await ValCCApi.Fetch(sharecode)).data;
@@ -63,7 +64,6 @@ private async Task InitialFetch(String sharecode = null)
{
ValCCApi.Action = 2;
Shareables = (await ValCCApi.Fetch()).data;
-
}
if (Shareables.Count == 0) return true;
@@ -81,6 +81,7 @@ private async Task InitialFetch(String sharecode = null)
}
PublicProfiles.Add(new PublicProfile() { owner = currentShareable.displayName, settings = profile, sharecode = currentShareable.shareCode, ID = i });
}
+ btnSearchCode.IsEnabled = true;
return true;
}
diff --git a/ValorantCC/src/API.cs b/ValorantCC/src/API.cs
index 1996082..435a54e 100644
--- a/ValorantCC/src/API.cs
+++ b/ValorantCC/src/API.cs
@@ -6,10 +6,19 @@
namespace ValorantCC
{
- public struct VoidCallResponse
+ public struct SetCallResponse
{
public bool success { get; set; }
- public Object data { get; set; }
+ public SetResponse data { get; set; }
+ }
+
+ public struct SetResponse
+ {
+ public string settings { get; set; }
+ public string displayName { get; set; }
+ public string gameTag { get; set; }
+ public string shareCode { get; set; }
+ public bool shareable { get; set; }
}
public struct FetchResponse
@@ -72,7 +81,7 @@ public async Task Fetch(String sharecode = null)
return JsonConvert.DeserializeObject(response.Content);
}
- public async Task Set()
+ public async Task Set()
{
PostPayload payload = new PostPayload()
{
@@ -86,8 +95,8 @@ 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 VoidCallResponse() { success = false };
- return JsonConvert.DeserializeObject(response.Content);
+ if (!response.IsSuccessful) return new SetCallResponse() { success = false };
+ return JsonConvert.DeserializeObject(response.Content);
}
}
diff --git a/ValorantCC/src/BackgroundAuth.cs b/ValorantCC/src/BackgroundAuth.cs
index 94ec7b0..c670e40 100644
--- a/ValorantCC/src/BackgroundAuth.cs
+++ b/ValorantCC/src/BackgroundAuth.cs
@@ -56,8 +56,7 @@ public async void LoopCheck()
main.DotTxt.Foreground = Brushes.Lime;
main.StatusTxt.Foreground = Brushes.Lime;
- main.MessageTxt.Foreground = Brushes.Lime;
- main.MessageTxt.Text = Utils.LoginResponse(processor);
+ Utils.MessageText(Utils.LoginResponse(processor), Brushes.Lime);
main.StatusTxt.Text = "Logged In!";
main.ch_display.Visibility = Visibility.Visible;
diff --git a/ValorantCC/src/Binder.cs b/ValorantCC/src/Binder.cs
index ee9a457..ca9ec4c 100644
--- a/ValorantCC/src/Binder.cs
+++ b/ValorantCC/src/Binder.cs
@@ -102,14 +102,14 @@ public partial class ProfileList
public partial class Data
{
- public Actionmapping[] actionMappings { get; set; }
- public object[] axisMappings { get; set; }
- public Boolsetting[] boolSettings { get; set; }
- public Floatsetting[] floatSettings { get; set; }
- public Intsetting[] intSettings { get; set; }
+ public List actionMappings { get; set; }
+ public List