Skip to content

Commit

Permalink
Merge pull request #14 from jayotterbein/invariant-culture
Browse files Browse the repository at this point in the history
Invariant culture
  • Loading branch information
jayotterbein committed May 17, 2016
2 parents 0b91f3b + 9069076 commit 2047635
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
Binary file removed FFXIVZoomHack.7z
Binary file not shown.
12 changes: 3 additions & 9 deletions FFXIVZoomHack/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FFXIVZoomHack
{
static class Program
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
}
58 changes: 33 additions & 25 deletions FFXIVZoomHack/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,38 @@ public static Settings Load(string location = null)
.Value
.Split(',')
.Where(x => !string.IsNullOrEmpty(x))
.Select(x => int.Parse(x, NumberStyles.HexNumber))
.Select(x => int.Parse(x, NumberStyles.HexNumber, CultureInfo.InvariantCulture))
.ToArray();
settings.DX9_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber);
settings.DX9_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber);
settings.DX9_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber);
settings.DX9_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber);
settings.DX9_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX9_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX9_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX9_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
break;
case "DX11":
settings.DX11_StructureAddress = element.Element("StructureAddress")
.Value
.Split(',')
.Where(x => !string.IsNullOrEmpty(x))
.Select(x => int.Parse(x, NumberStyles.HexNumber))
.Select(x => int.Parse(x, NumberStyles.HexNumber, CultureInfo.InvariantCulture))
.ToArray();
settings.DX11_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber);
settings.DX11_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber);
settings.DX11_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber);
settings.DX11_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber);
settings.DX11_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX11_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX11_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
settings.DX11_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
break;
case "DesiredZoom":
settings.DesiredZoom = float.Parse(element.Value);
settings.DesiredZoom = float.Parse(element.Value, CultureInfo.InvariantCulture);
if (settings.DesiredZoom < 1f || settings.DesiredZoom > 1000f)
{
settings.DesiredZoom = 20f;
}
break;
case "DesiredFov":
settings.DesiredFov = float.Parse(element.Value);
settings.DesiredFov = float.Parse(element.Value, CultureInfo.InvariantCulture);
if (settings.DesiredFov < 0.01f || settings.DesiredFov > 3f)
{
settings.DesiredFov = 0.78f;
}
break;
case "LastUpdate":
settings.LastUpdate = element.Value;
Expand Down Expand Up @@ -131,28 +139,28 @@ public void Save()
private IEnumerable<XElement> GetSaveElements()
{
yield return new XElement("DX9",
new XElement("StructureAddress", string.Join(",", DX9_StructureAddress.Select(x => x.ToString("X")))),
new XElement("ZoomCurrent", DX9_ZoomCurrent.ToString("X")),
new XElement("ZoomMax", DX9_ZoomMax.ToString("X")),
new XElement("FovCurrent", DX9_FovCurrent.ToString("X")),
new XElement("FovMax", DX9_FovMax.ToString("X"))
new XElement("StructureAddress", string.Join(",", DX9_StructureAddress.Select(x => x.ToString("X", CultureInfo.InvariantCulture)))),
new XElement("ZoomCurrent", DX9_ZoomCurrent.ToString("X", CultureInfo.InvariantCulture)),
new XElement("ZoomMax", DX9_ZoomMax.ToString("X", CultureInfo.InvariantCulture)),
new XElement("FovCurrent", DX9_FovCurrent.ToString("X", CultureInfo.InvariantCulture)),
new XElement("FovMax", DX9_FovMax.ToString("X", CultureInfo.InvariantCulture))
);
yield return new XElement("DX11",
new XElement("StructureAddress", string.Join(",", DX11_StructureAddress.Select(x => x.ToString("X")))),
new XElement("ZoomCurrent", DX11_ZoomCurrent.ToString("X")),
new XElement("ZoomMax", DX11_ZoomMax.ToString("X")),
new XElement("FovCurrent", DX11_FovCurrent.ToString("X")),
new XElement("FovMax", DX11_FovMax.ToString("X"))
new XElement("StructureAddress", string.Join(",", DX11_StructureAddress.Select(x => x.ToString("X", CultureInfo.InvariantCulture)))),
new XElement("ZoomCurrent", DX11_ZoomCurrent.ToString("X", CultureInfo.InvariantCulture)),
new XElement("ZoomMax", DX11_ZoomMax.ToString("X", CultureInfo.InvariantCulture)),
new XElement("FovCurrent", DX11_FovCurrent.ToString("X", CultureInfo.InvariantCulture)),
new XElement("FovMax", DX11_FovMax.ToString("X", CultureInfo.InvariantCulture))
);
yield return new XElement("LastUpdate", LastUpdate);

if ((Control.ModifierKeys & (Keys.Control | Keys.Alt | Keys.Shift)) != 0)
{
yield break;
}
yield return new XElement("AutoApply", AutoApply);
yield return new XElement("DesiredZoom", DesiredZoom);
yield return new XElement("DesiredFov", DesiredFov);
yield return new XElement("AutoApply", AutoApply.ToString(CultureInfo.InvariantCulture));
yield return new XElement("DesiredZoom", DesiredZoom.ToString(CultureInfo.InvariantCulture));
yield return new XElement("DesiredFov", DesiredFov.ToString(CultureInfo.InvariantCulture));
yield return new XElement("OffsetUpdateLocation", OffsetUpdateLocation);
}
}
Expand Down

0 comments on commit 2047635

Please sign in to comment.