示例#1
0
        /// <summary>Retrieves the appropriate FileListReader given a specific file type.</summary>
        /// <param name="fileExtension">The filename extension of the FileListReader wanted.</param>
        /// <returns>The appropriate FileListReader.</returns>
        static public FileListReader GetReader(string fileExtension)
        {
            FileListReader flr;

            // Tidy up the extension we were given.
            fileExtension = fileExtension.ToLower(System.Globalization.CultureInfo.InvariantCulture);
            if (fileExtension.Substring(0, 1) == ".")
            {
                fileExtension = fileExtension.Substring(1);
            }

            // Figure out which reader to return.
            switch (fileExtension)
            {
            case "verify":  flr = new VerifyXMLFileListReader(); break;

            case "vfy":             flr = new VerifyXMLFileListReader(); break;

            case "sfv":             flr = new SFVFileListReader(); break;

            case "md5":             flr = new MD5FileListReader(); break;

            case "md5sum":  flr = new MD5FileListReader(); break;

            default:                throw new FileTypeException();
            }

            return(flr);
        }
示例#2
0
        /// <summary>Retrieves the appropriate FileListReader given a specific file type.</summary>
        /// <param name="type">The FileListType of the FileListReader wanted.</param>
        /// <returns>The appropriate FileListReader.</returns>
        static public FileListReader GetReader(FileListType type)
        {
            FileListReader flr;

            switch (type)
            {
            case FileListType.BSDMD5:       flr = new MD5FileListReader(); break;

            case FileListType.MD5SUM:       flr = new MD5FileListReader(); break;

            case FileListType.SFV:          flr = new SFVFileListReader(); break;

            case FileListType.VERIFYXML: flr = new VerifyXMLFileListReader(); break;

            default:                                        throw new FileTypeException();
            }

            return(flr);
        }