private void SetReadOnlyDictionary()
 {
     lock (_sync)
     {
         ReadOnly = new DictionaryReadOnly <TKey, TValue>(new SortedList <TKey, TValue>(_dict, _dict.Comparer));
     }
 }
Example #2
0
 /// <summary>
 /// email address
 /// </summary>
 /// <param name="email"></param>
 public SupportFileTypesRule(string fileName, string errorMessagePrefix,
                             DictionaryReadOnly <string, string> supporedTypesLookUp)
 {
     _fileName           = fileName;
     _supportedTypes     = supporedTypesLookUp;
     _errorMessagePrefix = errorMessagePrefix;
 }
Example #3
0
        static ImageSupportedFileTypesRule()
        {
            IDictionary <string, string> supportedTypes = new Dictionary <string, string>();

            supportedTypes.Add("gif", "gif");
            supportedTypes.Add("jpeg", "jpeg");
            supportedTypes.Add("tiff", "tiff");
            supportedTypes.Add("png", "png");
            supportedTypes.Add("jpg", "jpg");
            _readOnlySupportedTypes = new DictionaryReadOnly <string, string>(supportedTypes);
        }
Example #4
0
        /// <summary>
        /// Initialize default instance.
        /// </summary>
        /// <param name="text"></param>
        public void Init(string text, string escapeChar, string[] tokens, string[] whiteSpaceTokens, string[] eolTokens)
        {
            Reset();
            _text            = text;
            LAST_POSITION    = _text.Length - 1;
            _tokens          = tokens.ToDictionary();
            _whiteSpaceChars = whiteSpaceTokens.ToDictionary();
            _eolChars        = eolTokens.ToDictionary();

            _readonlyEolMap        = new DictionaryReadOnly <string, string>(_eolChars);
            _readonlyWhiteSpaceMap = new DictionaryReadOnly <string, string>(_whiteSpaceChars);
        }
Example #5
0
        /// <summary>
        /// Initialize default instance.
        /// </summary>
        /// <param name="text"></param>
        public void Init(string text, string escapeChar, string[] tokens, string[] whiteSpaceTokens, string[] eolTokens)
        {
            Reset();
            _text = text;
            LAST_POSITION = _text.Length - 1;
            _tokens = tokens.ToDictionary();
            _whiteSpaceChars = whiteSpaceTokens.ToDictionary();
            _eolChars = eolTokens.ToDictionary();

            _readonlyEolMap = new DictionaryReadOnly<string, string>(_eolChars);
            _readonlyWhiteSpaceMap = new DictionaryReadOnly<string, string>(_whiteSpaceChars);
        }