Now default to CLI mode when not running on windows, avoids the unintuitive method of the user having to know to change 'cli=true' in viewmode.cfg.

This commit is contained in:
UnknownShadow200 2016-07-28 16:09:14 +10:00
parent 568c855ca1
commit 2f29aeaccd

View File

@ -1,19 +1,19 @@
/* /*
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy) Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
Dual-licensed under the Educational Community License, Version 2.0 and Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS" software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -68,7 +68,7 @@ namespace MCGalaxy.Gui {
useConsole = false; useHighQualityGui = false; useConsole = false; useHighQualityGui = false;
try { try {
ReadViewmode(); ReadViewmode();
if (useConsole) { if (useConsole) {
Server s = new Server(); Server s = new Server();
s.OnLog += WriteToConsole; s.OnLog += WriteToConsole;
@ -100,13 +100,16 @@ namespace MCGalaxy.Gui {
} }
static void ReadViewmode() { static void ReadViewmode() {
PlatformID platform = Environment.OSVersion.Platform;
useConsole = !(platform == PlatformID.Win32NT || platform == PlatformID.Win32Windows);
if (!File.Exists("Viewmode.cfg")) { if (!File.Exists("Viewmode.cfg")) {
using (StreamWriter w = new StreamWriter("Viewmode.cfg")) { using (StreamWriter w = new StreamWriter("Viewmode.cfg")) {
w.WriteLine("#This file controls how the console window is shown to the server host"); w.WriteLine("#This file controls how the console window is shown to the server host");
w.WriteLine("#cli: True or False (Determines whether a CLI interface is used) (Set True if on Mono)"); w.WriteLine("#cli: True or False (Determines whether a CLI interface is used) (Set True if on Mono)");
w.WriteLine("#high-quality: True or false (Determines whether the GUI interface uses higher quality objects)"); w.WriteLine("#high-quality: True or false (Determines whether the GUI interface uses higher quality objects)");
w.WriteLine(); w.WriteLine();
w.WriteLine("cli = false"); w.WriteLine("cli = " + useConsole);
w.WriteLine("high-quality = true"); w.WriteLine("high-quality = true");
} }
} }