/// <summary>Adds the given image format to the global set for use.
		/// Note that you do not need to call this manually; Just deriving from
		/// ImageFormat is all that is required.</summary>
		/// <param name="format">The new format to add.</param>
		public static void Add(ImageFormat format){
			string[] nameSet=format.GetNames();
			
			if(nameSet==null){
				return;
			}
			
			foreach(string name in nameSet){
				Formats[name.ToLower()]=format;
			}
		}
        /// <summary>Adds the given image format to the global set for use.
        /// Note that you do not need to call this manually; Just deriving from
        /// ImageFormat is all that is required.</summary>
        /// <param name="format">The new format to add.</param>
        public static void Add(ImageFormat format)
        {
            string[] nameSet = format.GetNames();

            if (nameSet == null)
            {
                return;
            }

            foreach (string name in nameSet)
            {
                Formats[name.ToLower()] = format;
            }
        }
示例#3
0
        /// <summary>Adds the given image format to the global set for use.
        /// Note that you do not need to call this manually; Just deriving from
        /// ImageFormat is all that is required.</summary>
        /// <param name="formatType">The type for the format to add.</param>
        public static void Add(Type formatType)
        {
            if (Formats == null)
            {
                Formats = new Dictionary <string, ImageFormat>();
            }

            // Instance it:
            ImageFormat format = (ImageFormat)Activator.CreateInstance(formatType);

            string[] nameSet = format.GetNames();

            if (nameSet == null)
            {
                return;
            }

            foreach (string name in nameSet)
            {
                Formats[name.ToLower()] = format;
            }
        }