/// <summary>Determines if it is necessary to install custom project file system locally</summary>
 /// <returns>True if custom project system is not installed locally or if it has to be upgraded; false if locally installed custom project system is up to date.</returns>
 /// <exception cref="IO.FileNotFoundException">File where zipped custom project system is supposed to be stored is not found</exception>
 /// <exception cref="IO.PathTooLongException">The path to file where zipped custom project file system is supposed to be stored exeeds system-define maximum path length.</exception>
 /// <exception cref="IO.IOException">An I/O error occurred while opening ZIP file with zipped custom project system</exception>
 /// <exception cref="UnauthorizedAccessException">
 ///     The caller does not have the required permission to access path where zipped custom project system is supposed to be stored. -or-
 ///     Reading of version file is not supported on the current platform. -or-
 ///     Version file is missing in local custom project system, but there is a directory instead with same path. -or-
 ///     The caller does not have the required permission to read version file from local custom project system
 /// </exception>
 /// <exception cref="IO.InvalidDataException">File where zipped custom project system is stored is corrupted (cannot be interpreted as ZIP file)</exception>
 /// <exception cref="SecurityException">The caller does not have the required permission to read version file in local custom project system</exception>
 /// <exception cref="NotSupportedException">The ZIP archive whre zipped custom project system is stored does not support reading.</exception>
 /// <exception cref="IO.InvalidDataException">
 ///     The ZIP archive where zipped custom project system is stored is corrupt, and its entries cannot be retrieved. -or-
 ///     The entry "version.txt" is either missing from the archive or is corrupt and cannot be read. -or-
 ///     The entry "version.txt" has been compressed by using a compression method that is not supported.
 /// </exception>
 /// <exception cref="FormatException">
 ///     Version text stored in "version.txt" entry of ZIP file containing zipped custom project system has fewer than two or more than four version components. -or-
 ///     At least one component in of version text is not an integer.
 /// </exception>
 /// <exception cref="OverflowException">
 ///     At least one component in version text stored in "version.txt" entry of ZIP file containing zipped custom project system represents a number that is greater than <see cref="Int32.MaxValue"/>.
 /// </exception>
 public  bool NeedsDeployment()
 {
     if (!IO.Directory.Exists(LocalCustomProjectSystemPath)) return true;
     using (var z = new ZippedCustomProjectSystem(ZippedCustomProjectSystemPath))
     {
         Version localVersion;
         try
         {
             localVersion = new LocalCustomProjectSystem(LocalCustomProjectSystemPath).GetVersion();
         }
         catch (Exception ex) when (ex is IO.IOException || ex is FormatException || ex is OverflowException)
         {
             return true;
         }
         return localVersion < z.GetVersion();
     }
 }
Ejemplo n.º 2
0
 /// <summary>Determines if it is necessary to install custom project file system locally</summary>
 /// <returns>True if custom project system is not installed locally or if it has to be upgraded; false if locally installed custom project system is up to date.</returns>
 /// <exception cref="IO.FileNotFoundException">File where zipped custom project system is supposed to be stored is not found</exception>
 /// <exception cref="IO.PathTooLongException">The path to file where zipped custom project file system is supposed to be stored exceeds system-define maximum path length.</exception>
 /// <exception cref="IO.IOException">An I/O error occurred while opening ZIP file with zipped custom project system</exception>
 /// <exception cref="UnauthorizedAccessException">
 ///     The caller does not have the required permission to access path where zipped custom project system is supposed to be stored. -or-
 ///     Reading of version file is not supported on the current platform. -or-
 ///     Version file is missing in local custom project system, but there is a directory instead with same path. -or-
 ///     The caller does not have the required permission to read version file from local custom project system
 /// </exception>
 /// <exception cref="IO.InvalidDataException">File where zipped custom project system is stored is corrupted (cannot be interpreted as ZIP file)</exception>
 /// <exception cref="SecurityException">The caller does not have the required permission to read version file in local custom project system</exception>
 /// <exception cref="NotSupportedException">The ZIP archive where zipped custom project system is stored does not support reading.</exception>
 /// <exception cref="IO.InvalidDataException">
 ///     The ZIP archive where zipped custom project system is stored is corrupt, and its entries cannot be retrieved. -or-
 ///     The entry "version.txt" is either missing from the archive or is corrupt and cannot be read. -or-
 ///     The entry "version.txt" has been compressed by using a compression method that is not supported.
 /// </exception>
 /// <exception cref="FormatException">
 ///     Version text stored in "version.txt" entry of ZIP file containing zipped custom project system has fewer than two or more than four version components. -or-
 ///     At least one component in of version text is not an integer.
 /// </exception>
 /// <exception cref="OverflowException">
 ///     At least one component in version text stored in "version.txt" entry of ZIP file containing zipped custom project system represents a number that is greater than <see cref="Int32.MaxValue"/>.
 /// </exception>
 public bool NeedsDeployment()
 {
     if (!IO.Directory.Exists(LocalCustomProjectSystemPath))
     {
         return(true);
     }
     using (var z = new ZippedCustomProjectSystem(ZippedCustomProjectSystemPath))
     {
         Version localVersion;
         try
         {
             localVersion = new LocalCustomProjectSystem(LocalCustomProjectSystemPath).GetVersion();
         }
         catch (Exception ex) when(ex is IO.IOException || ex is FormatException || ex is OverflowException)
         {
             return(true);
         }
         return(localVersion < z.GetVersion());
     }
 }