diff --git a/ValorantCC/MainWindow.xaml b/ValorantCC/MainWindow.xaml
index 7ee7601..8400e16 100644
--- a/ValorantCC/MainWindow.xaml
+++ b/ValorantCC/MainWindow.xaml
@@ -10,12 +10,11 @@
Background="Transparent"
RenderOptions.BitmapScalingMode="Fant">
-
-
-
-
-
-
+
+
+
+
+
diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs
index 89e7d9c..c9dbe7a 100644
--- a/ValorantCC/MainWindow.xaml.cs
+++ b/ValorantCC/MainWindow.xaml.cs
@@ -3,16 +3,13 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
-using System.Linq;
-using System.Windows.Shapes;
using Utilities;
using ValorantCC.src;
-using System.Threading;
-using System.Threading.Tasks;
namespace ValorantCC
{
@@ -102,7 +99,7 @@ private void profiles_SelectionChanged(object sender, SelectionChangedEventArgs
}
prim_outline_color.SelectedColor = Color.FromRgb(SelectedProfile.Primary.OutlineColor.R, SelectedProfile.Primary.OutlineColor.G, SelectedProfile.Primary.OutlineColor.B);
if (SelectedProfile.aDS == null) SelectedProfile.aDS = SelectedProfile.Primary;
- if(SelectedProfile.bUsePrimaryCrosshairForADS) SelectedProfile.aDS.Color = SelectedProfile.Primary.Color;
+ if (SelectedProfile.bUsePrimaryCrosshairForADS) SelectedProfile.aDS.Color = SelectedProfile.Primary.Color;
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);
@@ -285,10 +282,10 @@ private ImageSource Get_CrosshairBG(bool next = true)
{
int number = int.Parse(System.IO.Path.GetFileNameWithoutExtension(CrosshairBG.Source.ToString()).Replace("CrosshairBG", "")) + (next ? 1 : -1);
- if (next && number > Resources.Count - 1)
+ if (next && number > Resources.MergedDictionaries[0].Count - 1)
number = 0;
else if (number < 0)
- number = Resources.Count - 1;
+ number = Resources.MergedDictionaries[0].Count - 1;
return (ImageSource)FindResource("crosshairBG" + number);
}
@@ -304,7 +301,8 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e)
{
Window publicProfiles = Application.Current.Windows.Cast().Single(window => window.GetType().ToString() == "ValorantCC.ProfilesWindow");
publicProfiles.Activate();
- }catch(Exception ex)
+ }
+ catch (Exception ex)
{
ProfilesWindow publicProfiles = new ProfilesWindow(SelectedProfile, ValCCAPI);
publicProfiles.Owner = this;
diff --git a/ValorantCC/Resources/BGdictionary.xaml b/ValorantCC/Resources/BGdictionary.xaml
new file mode 100644
index 0000000..82f69ee
--- /dev/null
+++ b/ValorantCC/Resources/BGdictionary.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
index 0e1a584..707540d 100644
--- a/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
+++ b/ValorantCC/SubWindow/ProfilesWindow.xaml.cs
@@ -1,28 +1,19 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
using System.Text.RegularExpressions;
-using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using Newtonsoft.Json;
-using ValorantCC.src;
namespace ValorantCC
{
///
/// Interaction logic for ProfilesWindow.xaml
///
-
+
public struct PublicProfile
{
public String owner { get; set; }
@@ -41,7 +32,7 @@ public partial class ProfilesWindow : Window
public ProfilesWindow(CrosshairProfile current, API ValCCAPI)
{
InitializeComponent();
- main = (MainWindow) Application.Current.MainWindow;
+ main = (MainWindow)Application.Current.MainWindow;
selected = current;
ValCCApi = ValCCAPI;
bc = new BrushConverter();
@@ -103,11 +94,11 @@ private async Task RenderProfiles()
{
UIElementCollection shareablesElement = ShareablesContainer.Children;
if (PublicProfiles.Count == 0) return true;
-
+
for (int i = 0; i < PublicProfiles.Count; i++)
{
PublicProfile profile = PublicProfiles[i];
- shareablesElement.Add(await CreateRender.GenerateRender(profile, this));
+ shareablesElement.Add(await this.GenerateRender(profile));
}
await Task.Delay(1);
return true;
@@ -157,7 +148,7 @@ public void applyBtnClicked(object sender, RoutedEventArgs e)
private void ExitClick(object sender, RoutedEventArgs e)
{
- Close();
+ Close();
}
private void MinimizeClick(object sender, RoutedEventArgs e)
{
diff --git a/ValorantCC/SubWindow/src/CreateRender.cs b/ValorantCC/SubWindow/src/CreateRender.cs
index b65a1bc..6f5f309 100644
--- a/ValorantCC/SubWindow/src/CreateRender.cs
+++ b/ValorantCC/SubWindow/src/CreateRender.cs
@@ -1,47 +1,45 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ValorantCC.src;
namespace ValorantCC
{
- public class CreateRender
+ public static class CreateRender
{
- public static async Task GenerateRender(PublicProfile profile, ProfilesWindow profilesWindow)
+ enum ButtonType
+ {
+ Share,
+ Details,
+ Apply
+ }
+
+ static Style style;
+ static Random rand = new Random();
+ static BrushConverter bc = new BrushConverter();
+ static List imageSources = new List();
+ static ImageBrush RandomBG => imageSources[rand.Next(0, imageSources.Count - 1)];
+
+ static CreateRender()
+ {
+ ResourceDictionary res = (ResourceDictionary)Application.LoadComponent(new Uri("Resources/BGdictionary.xaml", UriKind.Relative));
+ for (int i = 0; i < res.Count; i++)
+ imageSources.Add(new ImageBrush((ImageSource)res["crosshairBG" + i]));
+ }
+
+ public static async Task GenerateRender(this ProfilesWindow profilesWindow, PublicProfile profile)
{
// This will be changed and will be replaced with more efficient method of rendering multiple settings.
- // These first 2 vars can be put somewhere else but I didn't because lazy.
- List imageSources = new List()
- {
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG0.png")),
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG1.png")),
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG2.png")),
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG3.png")),
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG4.png")),
- new BitmapImage(new Uri("pack://application:,,,/ValorantCC;component/Resources/CrosshairBG5.png"))
- };
- Random rand = new Random();
// Main border
- ImageBrush image = new ImageBrush();
- image.ImageSource = imageSources[rand.Next(0, 5)];
- BrushConverter bc = new BrushConverter();
Border template = new Border()
{
- Background = image,
+ Background = RandomBG,
CornerRadius = new CornerRadius(7, 7, 25, 25),
MinHeight = 95,
MaxHeight = 95,
@@ -84,53 +82,16 @@ public static async Task GenerateRender(PublicProfile profile, Profil
};
Grid.SetColumn(ownerName, 2);
Grid.SetRow(ownerName, 0);
-
- int buttonFont = 11;
- int buttonHeight = 22;
- string buttonColor = "#4648BF";
+ style = (Style)profilesWindow.FindResource("RoundButton");
- Button shareButton = new Button()
- {
- Style = (Style)profilesWindow.FindResource("RoundButton"),
- Background = (Brush)bc.ConvertFromString(buttonColor),
- Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 },
- Height = buttonHeight,
- FontSize = buttonFont,
- FontWeight = FontWeights.Bold,
- Content = "Share",
- Cursor = Cursors.Hand,
- Name = "A_"+profile.sharecode+"_shareBtn",
- };
+ Button shareButton = ButtonType.Share.Generate(profile.sharecode);
shareButton.Click += profilesWindow.shareBtnClicked;
- Button detailsButton = new Button()
- {
- Style = (Style)profilesWindow.FindResource("RoundButton"),
- Background = (Brush)bc.ConvertFromString(buttonColor),
- Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 },
- FontSize = buttonFont,
- Height = buttonHeight,
- FontWeight = FontWeights.Bold,
- Content = "Details",
- Cursor = Cursors.Hand,
- Name = "A_" + profile.ID.ToString() + "_detailsBtn"
-
- };
+ Button detailsButton = ButtonType.Details.Generate(profile.ID.ToString());
detailsButton.Click += profilesWindow.detailsBtnClicked;
- Button applyButton = new Button()
- {
- Style = (Style)profilesWindow.FindResource("RoundButton"),
- Background = (Brush)bc.ConvertFromString(buttonColor),
- Margin = new Thickness() { Bottom = 0, Top = 0, Left = 5, Right = 5 },
- FontSize = buttonFont,
- Height = buttonHeight,
- FontWeight = FontWeights.Bold,
- Content = "Apply",
- Cursor = Cursors.Hand,
- Name = "A_" + profile.ID.ToString() + "_applyBtn"
- };
+ Button applyButton = ButtonType.Apply.Generate(profile.ID.ToString());
applyButton.Click += profilesWindow.applyBtnClicked;
Grid.SetColumn(shareButton, 0);
@@ -155,5 +116,37 @@ public static async Task GenerateRender(PublicProfile profile, Profil
await Task.Delay(1);
return template;
}
+
+ private static Button Generate(this ButtonType btntype, string namedata)
+ {
+ Button button = new Button()
+ {
+ Style = style,
+ Background = (Brush)bc.ConvertFromString("#4648BF"),
+ Margin = new Thickness() { Bottom = 0, Top = 2, Left = 5, Right = 5 },
+ FontSize = 11,
+ Height = 22,
+ FontWeight = FontWeights.Bold,
+ Cursor = Cursors.Hand,
+ };
+
+ switch (btntype)
+ {
+ case ButtonType.Share:
+ button.Content = "Share";
+ button.Name = $"A_{namedata}_shareBtn";
+ break;
+ case ButtonType.Details:
+ button.Content = "Details";
+ button.Name = $"A_{namedata}_detailsBtn";
+ break;
+ case ButtonType.Apply:
+ button.Content = "Apply";
+ button.Name = $"A_{namedata}_applyBtn";
+ break;
+ }
+
+ return button;
+ }
}
}
diff --git a/ValorantCC/src/API.cs b/ValorantCC/src/API.cs
index 5c1800d..dd7cb81 100644
--- a/ValorantCC/src/API.cs
+++ b/ValorantCC/src/API.cs
@@ -1,13 +1,8 @@
-using System;
+using Newtonsoft.Json;
+using RestSharp;
+using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
-using RestSharp;
-using Newtonsoft.Json;
-using System.Text.RegularExpressions;
-using System.Diagnostics;
-using RestSharp.Authenticators;
namespace ValorantCC
{
@@ -47,7 +42,7 @@ public class API
public CrosshairProfile profile;
public int Action;
public bool Shareable;
- public API(AuthTokens Tokens, CrosshairProfile TargetProfile ,int ActionInt, bool isShareable)
+ public API(AuthTokens Tokens, CrosshairProfile TargetProfile, int ActionInt, bool isShareable)
{
AuthTokens = Tokens;
profile = TargetProfile;
@@ -69,7 +64,7 @@ public async Task Fetch(String sharecode = null)
payload.sharecode = sharecode;
payload.action = Action;
}
- RestRequest request = new RestRequest() { Method = Method.POST};
+ RestRequest request = new RestRequest() { Method = Method.POST };
request.AddJsonBody(payload);
RestResponse response = (RestResponse)await client.ExecuteAsync(request);
diff --git a/ValorantCC/src/Auth.cs b/ValorantCC/src/Auth.cs
index cef2fe6..4b63a0f 100644
--- a/ValorantCC/src/Auth.cs
+++ b/ValorantCC/src/Auth.cs
@@ -3,7 +3,6 @@
using System.IO;
using System.Net;
using System.Text;
-using System.Linq;
using System.Threading.Tasks;
using Utilities;
namespace ValorantCC
@@ -143,7 +142,7 @@ private async static Task GetVersion()
asyncResult => request.EndGetResponse(asyncResult),
(object)null);
VersionResponse RespData = await taskResp.ContinueWith(r =>
- {
+ {
WebResponse response = (WebResponse)r.Result;
StreamReader sr = new StreamReader(response.GetResponseStream());
return JsonConvert.DeserializeObject(sr.ReadToEnd());
diff --git a/ValorantCC/src/BackgroundAuth.cs b/ValorantCC/src/BackgroundAuth.cs
index c96f1f0..1a2b270 100644
--- a/ValorantCC/src/BackgroundAuth.cs
+++ b/ValorantCC/src/BackgroundAuth.cs
@@ -1,19 +1,16 @@
using System;
-using System.Collections.Generic;
+using System.IO;
using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
-using System.IO;
-using System.Diagnostics;
using Utilities;
namespace ValorantCC
{
class BackgroundAuth
{
- MainWindow main = (MainWindow) Application.Current.MainWindow;
+ MainWindow main = (MainWindow)Application.Current.MainWindow;
Processor processor;
public BackgroundAuth(Processor processor1)
{
diff --git a/ValorantCC/src/Crosshair_Parser.cs b/ValorantCC/src/Crosshair_Parser.cs
index f9b02a2..c62de79 100644
--- a/ValorantCC/src/Crosshair_Parser.cs
+++ b/ValorantCC/src/Crosshair_Parser.cs
@@ -1,5 +1,4 @@
-using System.Diagnostics;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
@@ -34,7 +33,7 @@ public static void Generate(int column, Grid grid, ProfileSettings settings)
}
recindex = 1;
- for (int i = 0; i < rectangles.Length; i+=2)
+ for (int i = 0; i < rectangles.Length; i += 2)
{
var pos = Position.East;
switch (recindex)
@@ -52,7 +51,7 @@ public static void Generate(int column, Grid grid, ProfileSettings settings)
pos = Position.South;
break;
}
- if(recindex == 4)
+ if (recindex == 4)
recindex = 0;
recindex++;
diff --git a/ValorantCC/src/Processor.cs b/ValorantCC/src/Processor.cs
index 4240888..42e96eb 100644
--- a/ValorantCC/src/Processor.cs
+++ b/ValorantCC/src/Processor.cs
@@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Windows.Media;
using System.Threading.Tasks;
+using System.Windows.Media;
using Utilities;
namespace ValorantCC