コード例 #1
0
        /// <summary> Indicates if the specified item matches the basic requirements for this viewer, or
        /// if this viewer should be ignored for this item </summary>
        /// <param name="CurrentItem"> Digital resource to examine to see if this viewer really should be included </param>
        /// <returns> TRUE if this viewer should generally be included with this item, otherwise FALSE </returns>
        public override bool Include_Viewer(BriefItemInfo CurrentItem)
        {
            // Check to see if there are any PDF files attached, but allow the configuration
            // to actually rule which files are necessary to be shown ( i.e., maybe 'PDFA' will be an extension
            // in the future )
            if (FileExtensions != null)
            {
                return(FileExtensions.Any(Extension => CurrentItem.Web.Contains_File_Extension(Extension)));
            }

            return(CurrentItem.Web.Contains_File_Extension("JPG"));
        }
コード例 #2
0
        public virtual bool TryLookup(string name, out object value)
        {
            if (name == null)
            {
                value = null;
                return(false);
            }

            if (Table != null &&
                Table.TryGetValue(name, out value))
            {
                return(true);
            }

            if (FileExtensions != null &&
                FileExtensions.Any())
            {
                if (FileExtensionAllowSubFolders == true ||
                    name.IndexOfAny(new[] { '/', '\\' }) == -1)
                {
                    foreach (var fileExtension in FileExtensions)
                    {
                        if (name.EndsWith(fileExtension, StringComparison.OrdinalIgnoreCase))
                        {
                            value = name;
                            return(true);
                        }
                    }
                }
            }

            if (Parser != null)
            {
                value = Parser.Invoke(name);
                if (value != null)
                {
                    return(true);
                }
            }

            value = null;
            return(false);
        }