Example #1
0
 /// <summary>Throws a <see cref="FileNotFoundException" />.</summary>
 /// <param name="path">The file path.</param>
 public static void FileExists(string path)
 {
     if (!File.Exists(path))
     {
         throw new FileNotFoundException(StringManager.FileNotFound(path));
     }
 }
Example #2
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));
        }
Example #3
0
        /// <summary>Gets the file version.</summary>
        /// <param name="fileName">The file to retrieve the version from.</param>
        /// <returns>The <see cref="Version" />.</returns>
        public static Version GetFileVersion(string fileName)
        {
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException(StringManager.FileNotFound(fileName));
            }

            Version _version = null;

            try
            {
                _version = AssemblyName.GetAssemblyName(fileName).Version;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(_version);
        }