コード例 #1
0
        private string GetUnknownFileIconBase64(IconSize size)
        {
            var iconSize     = GetIconSizeFromConfig(size);
            var iconExBase64 = WebFileManagerConfigurationSection.GetSection().UnknownFileTypeIcon.FileBase64;

            return(CorrectIcon(iconSize, iconExBase64));
        }
コード例 #2
0
        private void GetFileTypeIconsBase64(IconSize size, Dictionary <string, string> icons)
        {
            var iconSize = GetIconSizeFromConfig(size);

            foreach (var element in
                     WebFileManagerConfigurationSection.GetSection().FileTypeIcons.OfType <FileTypeIconConfigurationElement>())
            {
                icons.Add(element.FileExtension, CorrectIcon(iconSize, element.FileBase64));
            }
        }
コード例 #3
0
 private int GetIconSizeFromConfig(IconSize size)
 {
     if (size == IconSize.Large)
     {
         return(WebFileManagerConfigurationSection.GetSection().IconSize.Large);
     }
     else if (size == IconSize.Medium)
     {
         return(WebFileManagerConfigurationSection.GetSection().IconSize.Medium);
     }
     else
     {
         return(WebFileManagerConfigurationSection.GetSection().IconSize.Small);
     }
 }
コード例 #4
0
        public void WebFileManagerConfigurationSectionTest()
        {
            var section = WebFileManagerConfigurationSection.GetSection();

            Assert.AreEqual(128, section.IconSize.Large);
            Assert.AreEqual(64, section.IconSize.Medium);
            Assert.AreEqual(24, section.IconSize.Small);

            Assert.AreEqual("folder", section.FolderIcon.FileBase64);
            Assert.AreEqual("unknownFile", section.UnknownFileTypeIcon.FileBase64);

            Assert.AreEqual(4, section.FileTypeIcons.Count);

            Assert.AreEqual("txt", section.FileTypeIcons[0].FileExtension);
            Assert.AreEqual("txtFile", section.FileTypeIcons[0].FileBase64);
            Assert.AreEqual("jpg", section.FileTypeIcons[1].FileExtension);
            Assert.AreEqual("jpgFile", section.FileTypeIcons[1].FileBase64);
            Assert.AreEqual("pdf", section.FileTypeIcons[2].FileExtension);
            Assert.AreEqual("pdfFile", section.FileTypeIcons[2].FileBase64);
            Assert.AreEqual("doc", section.FileTypeIcons[3].FileExtension);
            Assert.AreEqual("docFile", section.FileTypeIcons[3].FileBase64);
        }