Esempio n. 1
0
        /// <summary>Checks for update.</summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="url">The url to the package.</param>
        /// <returns>The <see cref="bool" />.</returns>
        public static bool CheckForUpdate(Assembly assembly, Uri url)
        {
            if (!File.Exists(assembly.Location))
            {
                throw new FileNotFoundException("The executable file doesn't exist.");
            }

            if (string.IsNullOrEmpty(url.OriginalString))
            {
                throw new NoNullAllowedException(StringManager.IsNullOrEmpty(url.OriginalString));
            }

            if (!NetworkManager.IsURLFormatted(url.OriginalString))
            {
                throw new UriFormatException(StringManager.UrlNotWellFormatted(url.OriginalString));
            }

            if (NetworkManager.InternetAvailable)
            {
                return(CompareVersion(assembly.Location, new Package(url)));
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>Throws a <see cref="NoNullAllowedException" />.</summary>
 /// <param name="value">The value.</param>
 public static void IsNullOrEmpty(string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         throw new NoNullAllowedException(StringManager.IsNullOrEmpty(value));
     }
 }
Esempio n. 3
0
        /// <summary>
        ///     Loads the assembly file.
        /// </summary>
        /// <param name="file">The file path.</param>
        /// <returns>
        ///     <see cref="Assembly" />
        /// </returns>
        public static Assembly LoadAssembly(string file)
        {
            if (string.IsNullOrEmpty(file))
            {
                VisualExceptionDialog.Show(new NoNullAllowedException(StringManager.IsNullOrEmpty(file)));
            }

            if (!File.Exists(file))
            {
                VisualExceptionDialog.Show(new NoNullAllowedException(StringManager.FileNotFound(file)));
            }

            return(Assembly.LoadFile(file));
        }