VersionZiper/SevenZip/Formats.cs
/// <summary>
/// Gets InArchiveFormat for specified archive file name
/// </summary>
/// <param name="fileName">Archive file name</param>
/// <param name="reportErrors">Indicates whether to throw exceptions</param>
/// <returns>InArchiveFormat recognized by the file name extension</returns>
/// <exception cref="System.ArgumentException"/>
Gets InArchiveFormat for specified archive file name
Gets InArchiveFormat for specified archive file name
public static InArchiveFormat FormatByFileName(string fileName, bool reportErrors)
        {
            if (String.IsNullOrEmpty(fileName) && reportErrors)
            {
                throw new ArgumentException("File name is null or empty string!");
            }
            string extension = Path.GetExtension(fileName).Substring(1);
            if (!InExtensionFormats.ContainsKey(extension) && reportErrors)
            {
                throw new ArgumentException("Extension \"" + extension +
                                            "\" is not a supported archive file name extension.");
            }
            return InExtensionFormats[extension];
        }
public static InArchiveFormat FormatByFileName ( string fileName , bool reportErrors ) { if ( String . IsNullOrEmpty ( fileName ) && reportErrors ) { throw new ArgumentException ( " " ) ; } string extension = Path . GetExtension ( fileName ) . Substring ( 1 ) ; if ( ! InExtensionFormats . ContainsKey ( extension ) && reportErrors ) { throw new ArgumentException ( " \" " + extension + " \" " ) ; } return InExtensionFormats [ extension ] ; }
Gets InArchiveFormat for specified archive file name
Gets InArchiveFormat for specified archive file name
InArchiveFormat recognized by the file name extension
InArchiveFormat recognized by the file name extension
None
fileName
string
Archive file name
Archive file name
reportErrors
bool
Indicates whether to throw exceptions
Indicates whether to throw exceptions