Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Commit

Permalink
Remove RocketMod's console input handling
Browse files Browse the repository at this point in the history
It conflicts with Unturned's recently added own input handling.
  • Loading branch information
Trojaner committed Aug 17, 2019
1 parent ab9f3c9 commit 29a007e
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions Rocket.Unturned/UnturnedConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,6 @@ namespace Rocket.Unturned
{
public class UnturnedConsole : MonoBehaviour
{
FileStream fileStream = null;
StreamWriter streamWriter = null;
UnturnedConsoleWriter writer = null;
private void Awake()
{
try
{
fileStream = new FileStream(String.Format(Environment.ConsoleFile, Dedicator.serverID), FileMode.Create,FileAccess.Write,FileShare.ReadWrite);

streamWriter = new StreamWriter(fileStream, System.Text.Encoding.UTF8)
{
AutoFlush = true
};
writer = new UnturnedConsoleWriter(streamWriter);

readingThread = new Thread(new ThreadStart(DoRead));
readingThread.Start();
}
catch (Exception ex)
{
Core.Logging.Logger.Log("Error: " + ex.ToString());
}
}

private void Destroy()
{
if (fileStream != null)
{
fileStream.Close();
fileStream.Dispose();
}
if (streamWriter != null)
{
streamWriter.Close();
streamWriter.Dispose();
}
if (writer != null)
{
writer.Close();
writer.Dispose();
}
}

private static Thread readingThread;

private static void DoRead()
{
string x;
do
{
try
{
x = System.Console.ReadLine();

if (x != null && CommandWindow.input != null && CommandWindow.input.onInputText != null && x.Trim().Length != 0) CommandWindow.input.onInputText(x);

}
catch (Exception ex)
{
Core.Logging.Logger.LogException(ex);
}
}
while (true);
}

}
}

0 comments on commit 29a007e

Please sign in to comment.