Skip to content

Commit

Permalink
Add fullscreen checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Vi014 committed Mar 28, 2024
1 parent 3aedc0c commit b0e5e3c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
20 changes: 17 additions & 3 deletions Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void Form1_Load(object sender, EventArgs e)

private void checkDirAndPatched()
{
bool readSuccess = false, patched = false;
bool readSuccess = false, patched = false, fullscreen = false;

while (!readSuccess)
{
Expand All @@ -43,6 +43,11 @@ private void checkDirAndPatched()
foreach (var line in File.ReadAllLines("data2.dat"))
if (line == "Catalog URL=https://www.ricochetuniverse.com/gateway/catalog.php" || line == "Catalog URL=http://www.ricochetuniverse.com/gateway/catalog.php")
patched = true;

foreach (var line in File.ReadAllLines("Ricochet Infinity.CFG"))
if (line == "Full Screen=1")
fullscreen = true;

readSuccess = true;
}
catch
Expand All @@ -65,6 +70,8 @@ private void checkDirAndPatched()
btnReviver.Enabled = false;
label4.Visible = true;
}

cbFullscreen.Checked = fullscreen;
}

private void generateEnabled()
Expand Down Expand Up @@ -347,6 +354,7 @@ private void btnDown_Click(object sender, EventArgs e)
}
#endregion

#region delete and install
private void btnDelete_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
Expand Down Expand Up @@ -407,13 +415,33 @@ private void btnInstall_Click(object sender, EventArgs e)
}
}
}
#endregion

private void cbClose_CheckedChanged(object sender, EventArgs e)
{
Program.ProgramSettings.CloseOnLaunch = cbClose.Checked;
File.WriteAllText(Program.ConfigPath, JsonConvert.SerializeObject(Program.ProgramSettings, Formatting.Indented));
}

private void cbFullscreen_CheckedChanged(object sender, EventArgs e)
{
try
{
string[] lines = File.ReadAllLines("Ricochet Infinity.CFG");

for (int i = 0; i < lines.Length; i++)
if (lines[i].Length >= 11)
if (lines[i].Substring(0, 11) == "Full Screen")
lines[i] = "Full Screen=" + (cbFullscreen.Checked ? "1" : "0");

File.WriteAllLines("Ricochet Infinity.CFG", lines);
}
catch (Exception ex)
{
MessageBox.Show($"An error has occurred while updating the game files. \r\nIf you have the game installed in the Program Files folder, try running the mod manager as administrator. \r\n \r\nDetails: \r\n{ex}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void btnCd_Click(object sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog())
Expand Down

0 comments on commit b0e5e3c

Please sign in to comment.