Ejemplo n.º 1
0
        private static DeliveryResult IsDBValid(string destinationPath, string extractPath)
        {
            Dbconfiguration NewConfig = null;
            Dbconfiguration OldConfig = null;

            if (!CheckConfigurations(ref NewConfig, ref OldConfig, destinationPath, extractPath))
            {
                return(DeliveryResult.InvalidFiles);
            }

            if (!CheckCompatibility(NewConfig, extractPath))
            {
                return(DeliveryResult.InvalidCompatibility);
            }

            if (!CheckVersion(NewConfig, OldConfig, extractPath))
            {
                return(DeliveryResult.InvalidVersion);
            }

            if (!CheckFiles(extractPath))
            {
                return(DeliveryResult.InvalidFiles);
            }

            return(DeliveryResult.Ok);
        }
Ejemplo n.º 2
0
 private static Boolean CheckVersion(Dbconfiguration NewConfig, Dbconfiguration OldConfig, string extractPath)
 {
     if (NewConfig.Version <= OldConfig.Version)
     {
         var message = "Downgrading database version: current version = " + OldConfig.Version + ", new version = " + NewConfig.Version;
         Catcher(message, extractPath);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 private static Boolean CheckCompatibility(Dbconfiguration NewConfig, string extractPath)
 {
     if (NewConfig.Compatibility != FeatureManagerCompatibility.Compatibility)
     {
         var message = "Input Database is not compatible with current software: current software compatiblity = " + FeatureManagerCompatibility.Compatibility
                       + ", Database compatibility = " + NewConfig.Compatibility + ". Database cannot be loaded.";
         Catcher(message, extractPath);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 4
0
 private static Boolean CheckConfigurations(ref Dbconfiguration NewConfig, ref Dbconfiguration OldConfig, string destinationPath, string extractPath)
 {
     try
     {
         NewConfig = Provider.LoadFromFile <Dbconfiguration>(extractPath + "\\" + FeatureManagerCompatibility.ConfigurationFileName);
         OldConfig = Provider.LoadFromFile <Dbconfiguration>(destinationPath + "\\" + FeatureManagerCompatibility.ConfigurationFileName);
         if (NewConfig == null || OldConfig == null)
         {
             throw new Exception("Loaded null configurations");
         }
     }
     catch (Exception ex)
     {
         var message = "Input Database cannote be porperly loaded: " + ex.Message;
         Catcher(message, extractPath);
         return(false);
     }
     return(true);
 }