Skip to content

Commit

Permalink
feat : use invariant culture in user settings converts
Browse files Browse the repository at this point in the history
  • Loading branch information
clementpups committed Apr 9, 2023
1 parent 837dc01 commit 0632410
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions BAKKA-Editor/UserSettings.cs
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BAKKA_Editor
{
internal class UserSettings
{
public ViewSettings ViewSettings { get; set; } = new();
public SaveSettings SaveSettings { get; set; } = new();
public HotkeySettings HotkeySettings { get; set; } = new();
}

internal class ViewSettings
{
public bool ShowCursor { get; set; } = true;
public bool ShowCursorDuringPlayback { get; set; } = false;
public bool HighlightViewedNote { get; set; } = true;
public bool SelectLastInsertedNote { get; set; } = true;
public bool ShowGimmicks { get; set; } = true;
public float HispeedSetting { get; set; } = 1.5f;
public int Volume { get; set; } = 100;
}
internal class UserSettings
{
public ViewSettings ViewSettings { get; set; } = new();
public SaveSettings SaveSettings { get; set; } = new();
public HotkeySettings HotkeySettings { get; set; } = new();
}

internal class SaveSettings
{
/// <summary>
/// How frequently autosave occurs (in minutes)
/// </summary>
public int AutoSaveInterval { get; set; } = 1;
}
internal class ViewSettings
{
public bool ShowCursor { get; set; } = true;
public bool ShowCursorDuringPlayback { get; set; } = false;
public bool HighlightViewedNote { get; set; } = true;
public bool SelectLastInsertedNote { get; set; } = true;
public bool ShowGimmicks { get; set; } = true;
public float HispeedSetting { get; set; } = 1.5f;
public int Volume { get; set; } = 100;
}

internal class HotkeySettings
{
public int TouchHotkey { get; set; } = Convert.ToInt32(Keys.D1);
public int SlideLeftHotkey { get; set; } = Convert.ToInt32(Keys.D2);
public int SlideRightHotkey { get; set; } = Convert.ToInt32(Keys.D3);
public int SnapUpHotkey { get; set; } = Convert.ToInt32(Keys.D4);
public int SnapDownHotkey { get; set; } = Convert.ToInt32(Keys.D5);
public int ChainHotkey { get; set; } = Convert.ToInt32(Keys.D6);
public int HoldHotkey { get; set; } = Convert.ToInt32(Keys.D7);
public int PlayHotkey { get; set; } = Convert.ToInt32(Keys.Space);
}
internal class SaveSettings
{
/// <summary>
/// How frequently autosave occurs (in minutes)
/// </summary>
public int AutoSaveInterval { get; set; } = 1;
}

internal class HotkeySettings
{
private static readonly CultureInfo _defaultParsingCulture = CultureInfo.InvariantCulture;
public int TouchHotkey { get; set; } = Convert.ToInt32(Keys.D1, _defaultParsingCulture);
public int SlideLeftHotkey { get; set; } = Convert.ToInt32(Keys.D2, _defaultParsingCulture);
public int SlideRightHotkey { get; set; } = Convert.ToInt32(Keys.D3, _defaultParsingCulture);
public int SnapUpHotkey { get; set; } = Convert.ToInt32(Keys.D4, _defaultParsingCulture);
public int SnapDownHotkey { get; set; } = Convert.ToInt32(Keys.D5, _defaultParsingCulture);
public int ChainHotkey { get; set; } = Convert.ToInt32(Keys.D6, _defaultParsingCulture);
public int HoldHotkey { get; set; } = Convert.ToInt32(Keys.D7, _defaultParsingCulture);
public int PlayHotkey { get; set; } = Convert.ToInt32(Keys.Space, _defaultParsingCulture);
}
}

0 comments on commit 0632410

Please sign in to comment.