private void Window_init(object sender, EventArgs e) { #if STEAM SteamworksIntegration.InitSteam(this); try { //check if we're just launching it from the exe file. GenerateGameConfig(); } catch (Exception) { try { //we're probably launching via steam, which messes up the path! This means we have to reconfigure EVERY FILE PATH. ew! GlobalVars.RefreshPathsForSteam(); GenerateGameConfig(); } catch (Exception ex) { Hide(); GlobalVars.CreateMessageBox("An error has occurred when generating the game configuration: " + ex.Message); Application.Current.Shutdown(); } } #else try { //check if we're just launching it from the exe file. GenerateGameConfig(); } catch (Exception ex) { Hide(); GlobalVars.CreateMessageBox("An error has occurred when generating the game configuration: " + ex.Message); Application.Current.Shutdown(); } #endif //no more vproject /*try * { * //Set VPROJECT to the mod dir * Environment.SetEnvironmentVariable("VPROJECT", * GlobalVars.moddir, * EnvironmentVariableTarget.User); * GlobalVars.CreateMessageBox("VPROJECT has been set to " + Environment.GetEnvironmentVariable("VPROJECT") + ". If you experience issues launching any of the SDK tools, try restarting your computer." ); * } * catch (Exception ex) * { * Hide(); * GlobalVars.CreateMessageBox("An error has occurred when setting VPROJECT: " + ex.Message); * Application.Current.Shutdown(); * }*/ }
private void window_closing(object sender, CancelEventArgs e) { #if STEAM SteamworksIntegration.ShutdownSteam(this); #endif }
static void Main() { using (var game = new SteamworksIntegration()) game.Run(); }