diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs
index 35afd89..18dbd97 100644
--- a/ValorantCC/MainWindow.xaml.cs
+++ b/ValorantCC/MainWindow.xaml.cs
@@ -102,7 +102,6 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
SelectedIndex = profiles.SelectedIndex;
SelectedProfile = DataProcessor.ProfileFromIndex(SelectedIndex);
- ValCCAPI.profile = SelectedProfile;
primary_color.SelectedColor = Color.FromRgb(SelectedProfile.Primary.Color.R, SelectedProfile.Primary.Color.G, SelectedProfile.Primary.Color.B);
if (!DataProcessor.ProfileListed)
@@ -120,6 +119,7 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
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;
Crosshair_load();
}
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml b/ValorantCC/SubWindow/ProfilesWindow.xaml
index 2b37202..14f6e85 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml
@@ -45,7 +45,7 @@
-
+
@@ -56,7 +56,6 @@
-
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index 8a53fde..3a6c4e8 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -28,6 +29,7 @@ public struct PublicProfile
public partial class ProfilesWindow : Window
{
public CrosshairProfile selected;
+ private BrushConverter bc;
private static API ValCCApi;
private static MainWindow main;
private static List PublicProfiles = new List();
@@ -36,6 +38,7 @@ public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
InitializeComponent();
main = (MainWindow) Application.Current.MainWindow;
ValCCApi = ValCCAPI;
+ bc = new BrushConverter();
InitialFetch();
RenderProfiles();
}
@@ -61,7 +64,7 @@ private static void InitialFetch(String sharecode = null)
CrosshairProfile profile;
try
{
- profile = JsonConvert.DeserializeObject(currentShareable.settings);
+ profile = JsonConvert.DeserializeObject(Regex.Unescape(currentShareable.settings));
}
catch
{
@@ -74,9 +77,23 @@ private static void InitialFetch(String sharecode = null)
///
/// Render the PublicProfiles var into frontend.
///
- private static void RenderProfiles()
+ private void RenderProfiles()
{
-
+ UIElementCollection shareablesElement = ShareablesContainer.Children;
+ Border template = new Border()
+ {
+ Background = (Brush)bc.ConvertFromString("#FF393B44"),
+ MinHeight = 95,
+ MaxHeight = 95,
+ MinWidth = 330,
+ MaxWidth = 330,
+ Margin = new Thickness() { Bottom = 5, Top = 5, Left = 0, Right = 0 }
+ };
+ for (int i = 0; i < PublicProfiles.Count; i++)
+ {
+ PublicProfile profile = PublicProfiles[i];
+ shareablesElement.Add(template);
+ }
}
private void btnSearchCode_Click(object sender, RoutedEventArgs e)
{
diff --git a/ValorantCC/src/API.cs b/ValorantCC/src/API.cs
index 76604d5..352853c 100644
--- a/ValorantCC/src/API.cs
+++ b/ValorantCC/src/API.cs
@@ -5,6 +5,8 @@
using System.Threading.Tasks;
using RestSharp;
using Newtonsoft.Json;
+using System.Text.RegularExpressions;
+using System.Diagnostics;
namespace ValorantCC
{
@@ -17,15 +19,15 @@ public struct VoidCallResponse
public struct FetchResponse
{
public bool success { get; set; }
- public List data {get; set; }
+ public List data { get; set; }
}
public struct ShareableProfile
{
- public String shareCode { get; }
- public String settings { get; }
- public bool shareable { get; }
- public String displayName { get; }
+ public String shareCode { get; set; }
+ public String settings { get; set; }
+ public bool shareable { get; set; }
+ public String displayName { get; set; }
}
public partial class PostPayload
@@ -67,10 +69,10 @@ public FetchResponse Fetch(String sharecode = null)
payload.action = Action;
}
RestRequest request = new RestRequest() { Method = Method.POST};
- request.AddParameter("application/json", payload, ParameterType.RequestBody);
+ request.AddJsonBody(payload);
RestResponse response = (RestResponse)client.Execute(request);
if (response.StatusCode != System.Net.HttpStatusCode.OK) return new FetchResponse() { success = false };
- return JsonConvert.DeserializeObject(response.Content);
+ return JsonConvert.DeserializeObject(Regex.Unescape(response.Content));
}
public VoidCallResponse Set()
@@ -83,11 +85,11 @@ public VoidCallResponse Set()
action = Action
};
RestRequest request = new RestRequest() { Method = Method.POST };
- request.AddParameter("application/json", payload, ParameterType.RequestBody);
+ request.AddJsonBody(payload);
request.AddHeader("Authorization", $"Bearer {AuthTokens.AccessToken}"); // Pass to server so nobody can set somebody's saved profile.
RestResponse response = (RestResponse)client.Execute(request);
if (response.StatusCode != System.Net.HttpStatusCode.OK) return new VoidCallResponse() { success = false };
- return JsonConvert.DeserializeObject(response.Content);
+ return JsonConvert.DeserializeObject(Regex.Unescape(response.Content));
}
}