-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
80 lines (71 loc) · 3.09 KB
/
MainWindow.xaml.cs
File metadata and controls
80 lines (71 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Windows;
using System.Windows.Input;
using System.IO;
using ProSwapperFOV.Properties;
using System.Windows.Forms;
using System.Diagnostics;
namespace ProSwapperFOV
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//Get's user's GameUserSettings.ini
if (!File.Exists(Settings.Default.GameDir))
{
Settings.Default.GameDir = GameFileEditor.fndir;
Settings.Default.Save();
}
fndir.Text = Settings.Default.GameDir;
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
this.DragMove();
}
private void FOVSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
valuelbl.Content = "Value: " + (int)FOVSlider.Value;
}
private void setfov_Click(object sender, RoutedEventArgs e)
{
int fovval = (int)FOVSlider.Value;
GameFileEditor.SetRes(fovval.ToString(), Screen.PrimaryScreen.Bounds.Width.ToString(), 2);
System.Windows.Forms.MessageBox.Show("Set FOV to " + fovval, "Pro Swapper FOV", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void setresbutton_Click(object sender, RoutedEventArgs e)
{
GameFileEditor.SetRes(yres.Text, xres.Text, 0);
System.Windows.Forms.MessageBox.Show("Set Resolution to " + xres.Text + " x " + yres.Text, "Pro Swapper Resolution Changer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void reset_Click(object sender, RoutedEventArgs e)
{
string XRes = Screen.PrimaryScreen.Bounds.Width.ToString();
string YRes = Screen.PrimaryScreen.Bounds.Height.ToString();
GameFileEditor.SetRes(YRes, XRes, 0);
System.Windows.Forms.MessageBox.Show("Reset the resolution to normal", "Pro Swapper Resolution Changer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void launchfn_Click(object sender, RoutedEventArgs e)
{
Process.Start("com.epicgames.launcher://apps/Fortnite?action=launch&silent=false");
System.Windows.Application.Current.Shutdown();
}
private void xres_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsValid(((System.Windows.Controls.TextBox)sender).Text + e.Text, 1, 7680);
}
public static bool IsValid(string str, int min, int max)
{
int i;
return int.TryParse(str, out i) && i >= min && i <= max;
}
private void yres_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsValid(((System.Windows.Controls.TextBox)sender).Text + e.Text, 1, 4320);
}
}
}