static void Main(string[] args)
        {
            try
            {
                String execDir = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar));
                Directory.SetCurrentDirectory(execDir);
                // Changes the CurrentCulture of the current thread to the invariant culture.
                Thread.CurrentThread.CurrentCulture = new CultureInfo("", false);
                int processor = 1;
                foreach (ProcessThread thread in Process.GetCurrentProcess().Threads)
                {
                    thread.ProcessorAffinity = (IntPtr)processor;
                }

                if (!Directory.Exists(ConfigFolder))
                    Directory.CreateDirectory(ConfigFolder);
                if (!Directory.Exists(LogFolder))
                    Directory.CreateDirectory(LogFolder);
                LogUtil.InitializeLogging(Path.Combine(ConfigFolder, "LogConfig.xml"), "DefaultLogConfig.xml", FallbackLogfile);

                WorldEditor worldEditor = new WorldEditor();
                List<string> log = RepositoryClass.Instance.CheckForValidRepository();
                if (log.Count != 0)
                    return;

                if (worldEditor.Quit)
                {
                    return;
                }

                if (args.Length > 0) {
                    ProcessArgs(args, worldEditor);
                }

                worldEditor.Show();

                worldEditor.Start(args);
            }
            catch (Exception ex)
            {
                // try logging the error here first, before Root is disposed of
                LogUtil.ExceptionLog.Error(ex.ToString());
                throw;
            }
        }