private ModListing Get(IModListingParser parser, ParseType type, string str)
        {
            ModListing?listing;

            switch (type)
            {
            case ParseType.String:
                return(parser.FromString(str));

            case ParseType.FileName:
                return(parser.FromFileName(str));

            case ParseType.TryFilename:
                if (parser.TryFromFileName(str, out listing))
                {
                    return(listing);
                }
                throw new Exception();

            case ParseType.TryString:
                if (parser.TryFromString(str, out listing))
                {
                    return(listing);
                }
                throw new Exception();

            default:
                throw new Exception();
            }
        }
示例#2
0
 public PluginListingsParser(
     IModListingParser listingParser)
 {
     _listingParser = listingParser;
 }