CodeWalker/Program.cs

100 lines
3.0 KiB
C#
Raw Normal View History

2017-09-21 18:33:05 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CodeWalker
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
bool menumode = false;
bool explorermode = false;
2018-03-03 21:03:08 +08:00
bool projectmode = false;
2019-01-11 11:24:50 +08:00
bool vehiclesmode = false;
bool pedsmode = false;
2017-09-21 18:33:05 +08:00
if ((args != null) && (args.Length > 0))
{
foreach (string arg in args)
{
string argl = arg.ToLowerInvariant();
if (argl == "menu")
2017-09-21 18:33:05 +08:00
{
menumode = true;
}
if (argl == "explorer")
2017-09-21 18:33:05 +08:00
{
explorermode = true;
}
2018-03-03 21:03:08 +08:00
if (argl == "project")
{
projectmode = true;
}
2019-01-11 11:24:50 +08:00
if (argl == "vehicles")
{
vehiclesmode = true;
}
if (argl == "peds")
{
pedsmode = true;
}
2017-09-21 18:33:05 +08:00
}
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Always check the GTA folder first thing
if (!GTAFolder.UpdateGTAFolder(Properties.Settings.Default.RememberGTAFolder))
{
MessageBox.Show("Could not load CodeWalker because no valid GTA 5 folder was selected. CodeWalker will now exit.", "GTA 5 Folder Not Found", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
}
2017-09-21 18:33:05 +08:00
#if !DEBUG
try
{
#endif
2018-03-03 21:03:08 +08:00
if (menumode)
2017-09-21 18:33:05 +08:00
{
Application.Run(new MenuForm());
2017-09-21 18:33:05 +08:00
}
else if (explorermode)
{
Application.Run(new ExploreForm());
}
2018-03-03 21:03:08 +08:00
else if (projectmode)
{
Application.Run(new Project.ProjectForm());
2018-03-03 21:03:08 +08:00
}
2019-01-11 11:24:50 +08:00
else if (vehiclesmode)
{
Application.Run(new Vehicles.VehicleForm());
}
else if (pedsmode)
{
Application.Run(new Peds.PedsForm());
}
2017-09-21 18:33:05 +08:00
else
{
Application.Run(new WorldForm());
}
#if !DEBUG
}
catch (Exception ex)
{
MessageBox.Show("An unexpected error was encountered!\n" + ex.ToString());
//this can happen if folder wasn't chosen, or in some other catastrophic error. meh.
}
#endif
}
}
}