private static void finalizeUpdateInstallation(LauncherConfig config, UpdateDescription update, DirectoryInfo updateDirectory)
 {
     config.ApplicationVersion = update.Version;
     config.SkipVersion        = null;
     config.Save();
     updateDirectory.Delete(true);
 }
        static void Main()
        {
            var config = LauncherConfig.Load();

            if (config == null)
            {
                return;
            }

            bool canLaunch = true;

            if (config.CheckUpdateStrategy != CheckUpdateStrategy.Never)
            {
                var updateServer = connectToUpdateServer(config.UpdateServerUrl);
                UpdateDescription update;
                try
                {
                    update = updateServer.CheckUpdate(config.ApplicationName, config.ApplicationVersion);
                }
                catch (EndpointNotFoundException)
                {
                    update = null;
                }

                if (update != null && update.Version != config.SkipVersion)
                {
                    var updateDialog = new UpdateWindow
                    {
                        UpdateService = updateServer,
                        Update        = update,
                        Config        = config,
                    };

                    canLaunch = updateDialog.ShowDialog() == true;
                }
            }

            if (canLaunch)
            {
                launch(config.ApplicationStartupPath);
            }
        }