aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Program.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-06-24 16:44:42 -0400
committerMichaelTheShifter <[email protected]>2016-06-24 16:44:51 -0400
commitecee91bc559e1c0d716a3032e371218812df61e7 (patch)
tree49acdb538b13bc3da89185413bc4096d4e6d81f7 /source/WindowsFormsApplication1/Program.cs
parent8ea0903788b02b352cc25c9b6f46d439bdb1356a (diff)
downloadshiftos-c-_theultimatehacker-ecee91bc559e1c0d716a3032e371218812df61e7.tar.gz
shiftos-c-_theultimatehacker-ecee91bc559e1c0d716a3032e371218812df61e7.tar.bz2
shiftos-c-_theultimatehacker-ecee91bc559e1c0d716a3032e371218812df61e7.zip
Loads of changes...
Custom shifter options using Lua, and other stuff.
Diffstat (limited to 'source/WindowsFormsApplication1/Program.cs')
-rw-r--r--source/WindowsFormsApplication1/Program.cs20
1 files changed, 16 insertions, 4 deletions
diff --git a/source/WindowsFormsApplication1/Program.cs b/source/WindowsFormsApplication1/Program.cs
index 2b9bd47..555ed9c 100644
--- a/source/WindowsFormsApplication1/Program.cs
+++ b/source/WindowsFormsApplication1/Program.cs
@@ -8,6 +8,7 @@ using System.Net;
using System.IO.Compression;
using System.ComponentModel;
using System.Threading;
+using Newtonsoft.Json;
namespace ShiftOS
{
@@ -19,6 +20,7 @@ namespace ShiftOS
[STAThread]
static void Main(string[] args)
{
+
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Extract all dependencies before starting the engine.
@@ -44,7 +46,7 @@ namespace ShiftOS
}
}
}
- catch(Exception ex)
+ catch
{
Console.WriteLine("[ServerThread/WARNING] Couldn't retrieve startup pool. Not connecting to any servers.");
}
@@ -52,6 +54,17 @@ namespace ShiftOS
poolThread.Start();
//Start the Windows Forms backend
Paths.RegisterPaths(); //Sets ShiftOS path variables based on the current OS.
+ if (File.Exists(Paths.SystemDir + "settings.json"))
+ {
+ API.LoadedSettings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(Paths.SystemDir + "settings.json"));
+ }
+ else
+ {
+ API.LoadedSettings = new Settings();
+ API.LoadedSettings.MusicVolume = 50;
+ File.WriteAllText(Paths.SystemDir + "settings.json", JsonConvert.SerializeObject(API.LoadedSettings));
+ }
+ Audio.LoadAudioData();
SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it.
//If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
//If not, load that save.
@@ -111,7 +124,7 @@ namespace ShiftOS
}
}
}
- catch(Exception ex)
+ catch
{
}
@@ -140,7 +153,6 @@ namespace ShiftOS
{
Directory.Delete(temppath, true);
}
- bool firstfile = false;
ZipFile.ExtractToDirectory(zippath, temppath);
foreach (string f in Directory.GetFiles(temppath))
{
@@ -164,7 +176,7 @@ namespace ShiftOS
w.Dispose();
GC.Collect();
}
- catch (Exception ex)
+ catch
{
MessageBox.Show("Sorry to break the immersion, but we're currently downloading ShiftOS dependencies that'll make the game run MUCH better, such as the Lua engine and Gecko web renderer. Give us a moment. ShiftOS will continue to run while this happens but some things won't work right until we're finished.");
wc.DownloadFileAsync(new Uri("http://playshiftos.ml/shiftos/dependencies/ShiftOS_Dependencies.zip"), zippath);