private void Upgrade(ref string schemaVersion, string newSchemaVersion) { if (schemaVersion == newSchemaVersion) { return; } Version v = new Version(schemaVersion); new Version(newSchemaVersion); if (v < new Version("2.0.0.0")) { string text = "当前程序不再支持V2.0版本以下的旧版本项目!"; AutoCloseMessageBoxService.Show(text); throw new Exception(text); } this.Upgrade(ref schemaVersion, ProjectJsonConfig.initial_schema_version); }
/// <summary> /// 升级 /// </summary> /// <param name="schemaVersion">schema版本信息</param> /// <param name="newSchemaVersion">新的schema版本信息</param> private void Upgrade(ref string schemaVersion, string newSchemaVersion) { if (schemaVersion == newSchemaVersion) { return; } Version currentVersion = new Version(schemaVersion); Version latestVersion = new Version(newSchemaVersion); if (currentVersion < new Version("2.0.0.0")) { //提示用户不再支持老版本项目,后期考虑再自动升级项目并备份老项目 //TODO WJF 旧项目如何升级 var err = "当前程序不再支持V2.0版本以下的旧版本项目!"; AutoCloseMessageBoxService.Show(err); throw new Exception(err); } Upgrade(ref schemaVersion, initial_schema_version); }