mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-17 14:37:49 +08:00
Cleanup
This commit is contained in:
parent
67f9f744bb
commit
7a400e762c
@ -53,12 +53,37 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
// Make sure console is supported on this platform
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ResetConsole(false);
|
ResetConsole(false);
|
||||||
// ensure the compiler is supported (if this fails then SRE is probably stubbed)
|
// ensure the compiler is supported (if this fails then SRE is probably stubbed)
|
||||||
Evaluator.Compile("0 == 0");
|
Evaluator.Compile("0 == 0");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DisableConsole(ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup console
|
||||||
|
Lexer = new LexerBuilder();
|
||||||
|
Completer = new CSAutoCompleter();
|
||||||
|
|
||||||
|
SetupHelpInteraction();
|
||||||
|
|
||||||
|
Panel.OnInputChanged += OnInputChanged;
|
||||||
|
Panel.InputScroller.OnScroll += OnInputScrolled;
|
||||||
|
Panel.OnCompileClicked += Evaluate;
|
||||||
|
Panel.OnResetClicked += ResetConsole;
|
||||||
|
Panel.OnHelpDropdownChanged += HelpSelected;
|
||||||
|
Panel.OnAutoIndentToggled += OnToggleAutoIndent;
|
||||||
|
Panel.OnCtrlRToggled += OnToggleCtrlRShortcut;
|
||||||
|
Panel.OnSuggestionsToggled += OnToggleSuggestions;
|
||||||
|
|
||||||
|
// Run startup script
|
||||||
|
try
|
||||||
|
{
|
||||||
if (!Directory.Exists(ScriptsFolder))
|
if (!Directory.Exists(ScriptsFolder))
|
||||||
Directory.CreateDirectory(ScriptsFolder);
|
Directory.CreateDirectory(ScriptsFolder);
|
||||||
|
|
||||||
@ -73,23 +98,8 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
DisableConsole(ex);
|
ExplorerCore.LogWarning($"Exception executing startup script: {ex}");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Lexer = new LexerBuilder();
|
|
||||||
Completer = new CSAutoCompleter();
|
|
||||||
|
|
||||||
SetupHelpInteraction();
|
|
||||||
|
|
||||||
Panel.OnInputChanged += OnInputChanged;
|
|
||||||
Panel.InputScroller.OnScroll += OnInputScrolled;
|
|
||||||
Panel.OnCompileClicked += Evaluate;
|
|
||||||
Panel.OnResetClicked += ResetConsole;
|
|
||||||
Panel.OnHelpDropdownChanged += HelpSelected;
|
|
||||||
Panel.OnAutoIndentToggled += OnToggleAutoIndent;
|
|
||||||
Panel.OnCtrlRToggled += OnToggleCtrlRShortcut;
|
|
||||||
Panel.OnSuggestionsToggled += OnToggleSuggestions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user