/// <summary> Add the specified mime-type in the repository.</summary> /// <param name="type">is the mime-type to add. /// </param> internal void Add(MimeType type) { _typesIdx[type.Name] = type; _types.Add(type); // Update minLentgth _minLength = System.Math.Max(_minLength, type.MinLength); // Update the extensions index... var exts = type.Extensions; if (exts != null) { foreach (string ext in exts) { var list = (IList)_extIdx[ext]; if (list == null) { // No type already registered for this extension... // So, create a list of types list = new ArrayList(); _extIdx[ext] = list; } list.Add(type); } } // Update the magics index... if (type.HasMagic()) { _magicsIdx.Add(type); } }
/// <summary> Add the specified mime-type in the repository.</summary> /// <param name="type">is the mime-type to add. /// </param> internal void Add(MimeType type) { typesIdx[type.Name] = type; types.Add(type); // Update minLentgth m_iMinLength = System.Math.Max(m_iMinLength, type.MinLength); // Update the extensions index... System.String[] exts = type.Extensions; if (exts != null) { for (int i = 0; i < exts.Length; i++) { System.Collections.IList list = (System.Collections.IList)extIdx[exts[i]]; if (list == null) { // No type already registered for this extension... // So, create a list of types list = new System.Collections.ArrayList(); extIdx[exts[i]] = list; } list.Add(type); } } // Update the magics index... if (type.HasMagic()) { magicsIdx.Add(type); } }