Skip to content

Commit

Permalink
actually save ui info to file
Browse files Browse the repository at this point in the history
  • Loading branch information
rex706 committed Dec 3, 2016
1 parent 0d6a172 commit 34425e3
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions ARMA FOV Changer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public partial class MainWindow : Window
private static string profilePath;
private static string[] arrLine;

private int fovTopLine;
private int fovLeftLine;
private static int fovTopLine;
private static int fovLeftLine;
private static int uiLine;

private static int desiredFov;
private static string fovstring;
Expand Down Expand Up @@ -176,12 +177,13 @@ private void LoadProfile()
fovstring = "fovTop";

// Find line that controls fov
for(int i = 0; i < arrLine.Length; i++)
for (int i = 0; i < arrLine.Length; i++)
{
if (arrLine[i].Contains(fovstring))
{
fovTopLine = i;
fovLeftLine = i + 1;
uiLine = i + 59;

break;
}
Expand Down Expand Up @@ -270,6 +272,14 @@ private void saveButton_Click(object sender, RoutedEventArgs e)
if (button != 3)
arrLine[fovLeftLine] = "fovLeft=" + DesiredFovLeftTextBox.Text + ";";

if (button == 0)
{
arrLine[uiLine] = "uiTopLeftX=" + uiTopLeftXLabel_Copy.Content + ";";
arrLine[uiLine + 1] = "uiTopLeftY=" + uiTopLeftYLabel_Copy.Content + ";";
arrLine[uiLine + 2] = "uiBottomRightX=" + uiBottomRightXLabel_Copy.Content + ";";
arrLine[uiLine + 3] = "uiBottomRightY=" + uiBottomRightYLabel_Copy.Content + ";";
}

try
{
// Write back to file
Expand Down Expand Up @@ -316,10 +326,11 @@ private void refreshMath()
int aspect2 = Int32.Parse(heightTextBox.Text) / nGCD;
string aspectRatio = aspect1 + ":" + aspect2;

double uiTopLeftX = 0;
double uiTopLeftY = 0;
double uiBottomRightX = 1;
double uiBottomRightY = 1;
// ui variables for Cold War Assault
double uiTopLeftX = 0.0;
double uiTopLeftY = 0.0;
double uiBottomRightX = 1.0;
double uiBottomRightY = 1.0;

// If chosen game was Cold War Assault, set up ui scaling based on resolution per http://ofp-faguss.com/files/ofp_aspect_ratio.pdf
if (button == 0 /*|| button == 4*/)
Expand Down Expand Up @@ -416,6 +427,7 @@ private void refreshMath()

private void ProfileMenuItem_Click(object sender, RoutedEventArgs e)
{
CurrentFovLeftLabel.Content = "";
fovLeftLabel.IsEnabled = true;
fovLeftLabel_Copy.IsEnabled = true;
DesiredFovLeftTextBox.IsEnabled = true;
Expand Down

0 comments on commit 34425e3

Please sign in to comment.