Es wird überprüft auf den Datenbank version

This commit is contained in:
Husky
2018-08-12 11:15:31 +02:00
parent e14f251a69
commit 28141470da
5 changed files with 54 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ using System.Diagnostics;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Core;
using KlassenBIB;
using SanShared.Exceptions;
namespace Database
{
@@ -40,7 +41,16 @@ namespace Database
if (File.Exists(filepath))
{
File.Copy(filepath, string.Format("{0}_{1}_{2}.bak", filepath,DateTime.Now.ToShortDateString(),DateTime.Now.Ticks));
loadedProjekt = XamlServices.Load(filepath) as KlassenBIB.Projekt;
try
{
loadedProjekt = XamlServices.Load(filepath) as KlassenBIB.Projekt;
}
catch(XamlObjectWriterException ex)
{
string msg = ex.Message;
if (msg.ToLower().Contains("kann nicht festgelegt werden"))
throw new DataBaseVersionMismatchException();
}
}
else
loadedProjekt = new KlassenBIB.Projekt();