This repository has been archived by the owner on Apr 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7932619
commit 5d779c2
Showing
11 changed files
with
524 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Microsoft.Win32; | ||
|
||
namespace RE2REmakeSRT | ||
{ | ||
public struct Options | ||
{ | ||
public ProgramFlags Flags; | ||
public double ScalingFactor; | ||
|
||
public void GetOptions() | ||
{ | ||
// Initialize registry key. | ||
RegistryKey optionsKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\RE2REmakeSRT", false); | ||
|
||
// Load registry values. | ||
if (RegistryHelper.GetBoolValue(optionsKey, "Debug", false)) | ||
Flags |= ProgramFlags.Debug; | ||
else | ||
Flags &= ~ProgramFlags.Debug; | ||
|
||
if (RegistryHelper.GetBoolValue(optionsKey, "SkipChecksumCheck", false)) | ||
Flags |= ProgramFlags.SkipChecksumCheck; | ||
else | ||
Flags &= ~ProgramFlags.SkipChecksumCheck; | ||
|
||
if (RegistryHelper.GetBoolValue(optionsKey, "NoTitleBar", false)) | ||
Flags |= ProgramFlags.NoTitleBar; | ||
else | ||
Flags &= ~ProgramFlags.NoTitleBar; | ||
|
||
if (RegistryHelper.GetBoolValue(optionsKey, "AlwaysOnTop", false)) | ||
Flags |= ProgramFlags.AlwaysOnTop; | ||
else | ||
Flags &= ~ProgramFlags.AlwaysOnTop; | ||
|
||
if (RegistryHelper.GetBoolValue(optionsKey, "Transparent", false)) | ||
Flags |= ProgramFlags.Transparent; | ||
else | ||
Flags &= ~ProgramFlags.Transparent; | ||
|
||
double.TryParse(RegistryHelper.GetValue(optionsKey, "ScalingFactor", "0.75"), out ScalingFactor); | ||
} | ||
|
||
public void SetOptions() | ||
{ | ||
// Initialize registry key. | ||
RegistryKey optionsKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\RE2REmakeSRT", true); | ||
|
||
if ((Flags & ProgramFlags.Debug) == ProgramFlags.Debug) | ||
optionsKey.SetValue("Debug", 1, RegistryValueKind.DWord); | ||
else | ||
optionsKey.SetValue("Debug", 0, RegistryValueKind.DWord); | ||
|
||
if ((Flags & ProgramFlags.SkipChecksumCheck) == ProgramFlags.SkipChecksumCheck) | ||
optionsKey.SetValue("SkipChecksumCheck", 1, RegistryValueKind.DWord); | ||
else | ||
optionsKey.SetValue("SkipChecksumCheck", 0, RegistryValueKind.DWord); | ||
|
||
if ((Flags & ProgramFlags.NoTitleBar) == ProgramFlags.NoTitleBar) | ||
optionsKey.SetValue("NoTitleBar", 1, RegistryValueKind.DWord); | ||
else | ||
optionsKey.SetValue("NoTitleBar", 0, RegistryValueKind.DWord); | ||
|
||
if ((Flags & ProgramFlags.AlwaysOnTop) == ProgramFlags.AlwaysOnTop) | ||
optionsKey.SetValue("AlwaysOnTop", 1, RegistryValueKind.DWord); | ||
else | ||
optionsKey.SetValue("AlwaysOnTop", 0, RegistryValueKind.DWord); | ||
|
||
if ((Flags & ProgramFlags.Transparent) == ProgramFlags.Transparent) | ||
optionsKey.SetValue("Transparent", 1, RegistryValueKind.DWord); | ||
else | ||
optionsKey.SetValue("Transparent", 0, RegistryValueKind.DWord); | ||
|
||
optionsKey.SetValue("ScalingFactor", ScalingFactor.ToString(), RegistryValueKind.String); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace RE2REmakeSRT | ||
{ | ||
public partial class OptionsUI : Form | ||
{ | ||
public OptionsUI() | ||
{ | ||
InitializeComponent(); | ||
|
||
// Set titlebar. | ||
this.Text += string.Format(" v{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); | ||
|
||
debugCheckBox.Checked = (Program.programSpecialOptions.Flags & ProgramFlags.Debug) == ProgramFlags.Debug; | ||
skipChecksumCheckBox.Checked = (Program.programSpecialOptions.Flags & ProgramFlags.SkipChecksumCheck) == ProgramFlags.SkipChecksumCheck; | ||
noTitlebarCheckBox.Checked = (Program.programSpecialOptions.Flags & ProgramFlags.NoTitleBar) == ProgramFlags.NoTitleBar; | ||
alwaysOnTopCheckBox.Checked = (Program.programSpecialOptions.Flags & ProgramFlags.AlwaysOnTop) == ProgramFlags.AlwaysOnTop; | ||
transparentBackgroundCheckBox.Checked = (Program.programSpecialOptions.Flags & ProgramFlags.Transparent) == ProgramFlags.Transparent; | ||
scalingFactorNumericUpDown.Value = (decimal)Program.programSpecialOptions.ScalingFactor; | ||
} | ||
|
||
private void cancelButton_Click(object sender, EventArgs e) | ||
{ | ||
// Close form. | ||
this.Close(); | ||
} | ||
|
||
private void saveButton_Click(object sender, EventArgs e) | ||
{ | ||
// Set flag changes prior to saving. | ||
if (debugCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.Debug) != ProgramFlags.Debug) | ||
Program.programSpecialOptions.Flags |= ProgramFlags.Debug; | ||
else if (!debugCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.Debug) == ProgramFlags.Debug) | ||
Program.programSpecialOptions.Flags &= ~ProgramFlags.Debug; | ||
|
||
if (skipChecksumCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.SkipChecksumCheck) != ProgramFlags.SkipChecksumCheck) | ||
Program.programSpecialOptions.Flags |= ProgramFlags.SkipChecksumCheck; | ||
else if (!skipChecksumCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.SkipChecksumCheck) == ProgramFlags.SkipChecksumCheck) | ||
Program.programSpecialOptions.Flags &= ~ProgramFlags.SkipChecksumCheck; | ||
|
||
if (noTitlebarCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.NoTitleBar) != ProgramFlags.NoTitleBar) | ||
Program.programSpecialOptions.Flags |= ProgramFlags.NoTitleBar; | ||
else if (!noTitlebarCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.NoTitleBar) == ProgramFlags.NoTitleBar) | ||
Program.programSpecialOptions.Flags &= ~ProgramFlags.NoTitleBar; | ||
|
||
if (alwaysOnTopCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.AlwaysOnTop) != ProgramFlags.AlwaysOnTop) | ||
Program.programSpecialOptions.Flags |= ProgramFlags.AlwaysOnTop; | ||
else if (!alwaysOnTopCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.AlwaysOnTop) == ProgramFlags.AlwaysOnTop) | ||
Program.programSpecialOptions.Flags &= ~ProgramFlags.AlwaysOnTop; | ||
|
||
if (transparentBackgroundCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.Transparent) != ProgramFlags.Transparent) | ||
Program.programSpecialOptions.Flags |= ProgramFlags.Transparent; | ||
else if (!transparentBackgroundCheckBox.Checked && (Program.programSpecialOptions.Flags & ProgramFlags.Transparent) == ProgramFlags.Transparent) | ||
Program.programSpecialOptions.Flags &= ~ProgramFlags.Transparent; | ||
|
||
Program.programSpecialOptions.ScalingFactor = (double)scalingFactorNumericUpDown.Value; | ||
|
||
// Write registry values. | ||
Program.programSpecialOptions.SetOptions(); | ||
|
||
// Close form. | ||
this.Close(); | ||
} | ||
} | ||
} |
Oops, something went wrong.