Exemple #1
0
        public static WicEncoder FromMimeType(string mimeType)
        {
            if (mimeType == null)
            {
                return(null);
            }

            return(AllComponents.OfType <WicEncoder>().FirstOrDefault(c => c.SupportsMimeType(mimeType)));
        }
Exemple #2
0
        private static HashSet <string> GetDecoderExtensions()
        {
            var dic = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var dec in AllComponents.OfType <WicDecoder>())
            {
                foreach (var ext in dec.FileExtensionsList)
                {
                    dic.Add(ext);
                }
            }
            return(dic);
        }
Exemple #3
0
        public static WicEncoder FromFileExtension(string ext)
        {
            if (ext == null)
            {
                return(null);
            }

            if (!ext.StartsWith(".", StringComparison.Ordinal))
            {
                ext = Path.GetExtension(ext);
            }

            return(AllComponents.OfType <WicEncoder>().FirstOrDefault(e => e.SupportsFileExtension(ext)));
        }
Exemple #4
0
        public static T FromName <T>(string name) where T : WicImagingComponent
        {
            if (name == null)
            {
                return(null);
            }

            var item = AllComponents.OfType <T>().FirstOrDefault(f => f.FriendlyName.EqualsIgnoreCase(name));

            if (item != null)
            {
                return(item);
            }

            return(AllComponents.OfType <T>().FirstOrDefault(f => f.FriendlyName.Replace(" ", "").EqualsIgnoreCase(name)));
        }
Exemple #5
0
        public static WicEncoder FromName(string name)
        {
            if (name == null)
            {
                return(null);
            }

            var item = AllComponents.OfType <WicEncoder>().FirstOrDefault(c => c.FriendlyName.EqualsIgnoreCase(name));

            if (item != null)
            {
                return(item);
            }

            return(AllComponents.OfType <WicEncoder>().FirstOrDefault(f => f.FriendlyName.ToLowerInvariant().Replace("encoder", "").Trim().EqualsIgnoreCase(name)));
        }
Exemple #6
0
 public static T FromContainerFormatGuid <T>(Guid guid) where T : WicCodec => AllComponents.OfType <T>().FirstOrDefault(c => c.ContainerFormat == guid);
Exemple #7
0
 public IEnumerable <WicPixelFormatConverter> GetPixelFormatConvertersTo(Guid targetFormat) => AllComponents.OfType <WicPixelFormatConverter>().Where(pf => pf.CanConvert(Guid, targetFormat));
 /// <summary>
 /// Runs all matching api triggers, which matches the action window
 /// </summary>
 /// <param name="input"></param>
 /// <param name="args"></param>
 public void RunApiTrigger(string input, string[] args)
 {
     AllComponents.OfType <UrlTrigger>().Where(trigger => trigger.Action.Length > 0 && trigger.Action == input).ForEach(trigger => trigger.CallNext(args));
 }
 public static T FromFriendlyName <T>(string friendlyName) where T : WicMetadataHandler => AllComponents.OfType <T>().FirstOrDefault(c => c.FriendlyName.EqualsIgnoreCase(friendlyName));
Exemple #10
0
 public static T FromFormatGuid <T>(Guid guid) where T : WicMetadataHandler => AllComponents.OfType <T>().FirstOrDefault(c => c.Guid == guid);