static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Task SplashTask = Task.Run(() => { SplashForm SF = new SplashForm(10); SF.ShowDialog(); SF.Dispose(); }); string FullfilePath = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; string VersionDirectoryfilePath = Path.GetFullPath(Path.Combine(FullfilePath, @"..\..\" + Application.ProductVersion)); string BasePath = Path.GetFullPath(Path.Combine(FullfilePath, @"..\..\")); Properties.Settings.Default.Upgrade(); if (Directory.Exists(BasePath)) { DirectoryInfo DirInfo = new DirectoryInfo(BasePath); DirectoryInfo[] Dirs = DirInfo.GetDirectories(); for (int i = 0; i < Dirs.Length; i++) { if (!Dirs[i].FullName.Equals(VersionDirectoryfilePath)) { Directory.Delete(Dirs[i].FullName, true); } } } if (Directory.Exists(LanguagePath)) { CurrentLanguage = File.Exists(Path.Combine(LanguagePath, Properties.Settings.Default.Language + ".txt")) ? new Language(Properties.Settings.Default.Language, Path.Combine(LanguagePath, Properties.Settings.Default.Language + ".txt")) : new Language(); } else { CurrentLanguage = new Language(); } Form host = new Form(); host.Controls.Add(new GLControl()); host.Load += (x, y) => { StartUpForm = new LevelEditorForm(); Rectangle?bounds = null; while (StartUpForm != null) { var f = StartUpForm; StartUpForm = null; f.Load += (x2, y2) => { if (bounds != null) { f.SetBounds(bounds.Value.X, bounds.Value.Y, bounds.Value.Width, bounds.Value.Height); } }; f.Shown += (x2, y2) => f.TopLevel = true; f.ShowDialog(host); bounds = f.DesktopBounds; } host.Close(); }; Application.Run(host); }