public static bool UpdateLauncher(string installPath = null, Version version = null) { version = version ?? VersionInfo.Version; var config = ConfigSerializer.GetConfig(); Version lastVersion; if (Version.TryParse(config.LastVersion, out lastVersion)) { if (lastVersion == version) { return(false); } } var path = installPath; if (!Directory.Exists(path)) { path = config.InstallPath; if (!Directory.Exists(path)) { return(false); } } else { config.InstallPath = path; } var launcherFullPath = Path.Combine(path, LauncherFileName); if (!File.Exists(launcherFullPath)) { return(false); } if (!Directory.Exists(ConfigSerializer.SettingsPath)) { Directory.CreateDirectory(ConfigSerializer.SettingsPath); } File.Copy(launcherFullPath, Path.Combine(ConfigSerializer.SettingsPath, LauncherFileName), true); config.LastVersion = version.ToString(); ConfigSerializer.SaveConfig(config); return(true); }