Skip to content

Commit

Permalink
Removed Studio console code
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrewThisNoise committed Nov 8, 2022
1 parent 4fa06ec commit 32fc477
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 77 deletions.
63 changes: 0 additions & 63 deletions src/SharedCode/EnvironmentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,69 +208,6 @@ public static bool DeveloperModeEnabled
}
}

public static bool DeveloperModeStudioEnabled
{
get
{
var configPath = Path.Combine(GameRootDirectory, @"Studio\BepInEx\config\BepInEx.cfg");
if (!File.Exists(configPath)) return false;
try
{
var contents = File.ReadAllLines(configPath).ToList();

var devmodeCatIndex = contents.FindIndex(s => s.ToLower().Contains("[Logging.Console]".ToLower()));
if (devmodeCatIndex >= 0)
{
var toCheck = contents.Skip(devmodeCatIndex);
var nextCatIndex = contents.FindIndex(devmodeCatIndex + 1, s => s.StartsWith("["));
if (nextCatIndex > 0) toCheck = toCheck.Take(nextCatIndex - devmodeCatIndex);
return toCheck.Any(s => s.StartsWith("Enabled = true", StringComparison.OrdinalIgnoreCase));
}
}
catch (Exception e)
{
MessageBox.Show("Something went wrong: " + e);
}

return false;
}
set
{
try
{
var configPath = Path.Combine(GameRootDirectory, @"Studio\BepInEx\config\BepInEx.cfg");
var contents = File.Exists(configPath) ? File.ReadAllLines(configPath).ToList() : new List<string>();

var devmodeCatIndex = contents.FindIndex(s => s.ToLower().Contains("[Logging.Console]".ToLower()));
if (devmodeCatIndex >= 0)
{
var nextCatIndex = contents.FindIndex(devmodeCatIndex + 1, s => s.StartsWith("["));
int enabledIndex;
if (nextCatIndex > 0)
enabledIndex = contents.FindIndex(devmodeCatIndex, nextCatIndex - devmodeCatIndex, s => s.StartsWith("Enabled"));
else
enabledIndex = contents.FindIndex(devmodeCatIndex, s => s.StartsWith("Enabled"));

if (enabledIndex > 0)
contents[enabledIndex] = "Enabled = " + (value ? "true" : "false");
else
contents.Insert(devmodeCatIndex + 1, "Enabled = " + (value ? "true" : "false"));
}
else
{
contents.Add("[Logging.Console]");
contents.Add("Enabled = " + (value ? "true" : "false"));
}

File.WriteAllLines(configPath, contents.ToArray());
}
catch (Exception e)
{
MessageBox.Show("Something went wrong: " + e);
}
}
}

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr GetModuleHandle(string lpModuleName);

Expand Down
14 changes: 0 additions & 14 deletions src/SharedCode/ToggleAdder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ public static void CreatePluginToggles(StackPanel togglePanel)
toggleConsole.ToolTip = "Enable console to see game status console.";
togglePanel.Children.Add(toggleConsole);
}
if (EnvironmentHelper.IsBepIn)
{
var toggleConsole = new CheckBox
{
Name = "toggleConsole",
Content = "Activate Console (Studio)",
Foreground = Brushes.White,
IsChecked = EnvironmentHelper.DeveloperModeStudioEnabled
};
toggleConsole.Checked += (sender, args) => EnvironmentHelper.DeveloperModeStudioEnabled = true;
toggleConsole.Unchecked += (sender, args) => EnvironmentHelper.DeveloperModeStudioEnabled = false;
toggleConsole.ToolTip = "Enable console to see game status console.";
togglePanel.Children.Add(toggleConsole);
}

// Add experimental mode toggle ---------------------------------
var toggleExperimental = new CheckBox
Expand Down

0 comments on commit 32fc477

Please sign in to comment.