Example #1
0
        /// <summary>
        /// Creates a new HTTP content type based on the given media type,
        /// character set and file extentions.
        /// </summary>
        /// <param name="MediaType">The media type for the HTTP content type.</param>
        /// <param name="CharSet">The char set of the HTTP content type.</param>
        /// <param name="FileExtentions">Well-known file extentions using this HTTP content type.</param>
        public HTTPContentType(String MediaType,
                               CharSetType CharSet = CharSetType.UTF8,
                               params String[]  FileExtentions)
        {
            this._MediaType      = MediaType;
            this._CharSet        = CharSet;
            this._FileExtentions = FileExtentions;

            if (!_Lookup.ContainsKey(MediaType))
            {
                _Lookup.Add(MediaType, this);
            }

            if (_FileExtentions != null && _FileExtentions.Any())
            {
                _FileExtentions.ForEach(FileExtention => {
                    if (_ReverseLookup.ContainsKey(FileExtention))
                    {
                        var List = new List <HTTPContentType>(_ReverseLookup[FileExtention]);
                        List.Add(this);
                        _ReverseLookup[FileExtention] = List.ToArray();
                    }
                    else
                    {
                        _ReverseLookup.Add(FileExtention, new HTTPContentType[] { this });
                    }
                });
            }
        }
Example #2
0
        public CharSetEditor(string CharSetName, int CharWidth, int CharHeight, CharSetSort CharSetSort, CharSetType CharSetType)
        {
            ConfigureForm();

            this.CharWidth   = CharWidth;
            this.CharHeight  = CharHeight;
            this.CharSetSort = CharSetSort;
            this.CharSetName = CharSetName;
            this.CharSetType = CharSetType;
            this.CharSetId   = Guid.NewGuid();

            SetText();
            GenerateEditors();
        }
Example #3
0
 private void SetText()
 {
     this.Text = $"{CharSetType.ToString()} {CharSetName}, {CharWidth}x{CharHeight} chars, sorted {CharSetSort.ToString()}";
 }