示例#1
0
        /// <summary>
        /// Called during Loaded() method to copy values from PropertyKeys and PropertyValues
        /// to the CustomFields NameValueCollection
        /// </summary>
        internal void DeserializeCustomFields()
        {
            _nvc.Clear();

            if (PropertyKeys != null && PropertyValues != null)
            {
                char[] splitter = new char[1] {
                    ':'
                };
                string[] keyNames = PropertyKeys.Split(splitter);

                for (int i = 0; i < (keyNames.Length / 4); i++)
                {
                    int    start = int.Parse(keyNames[(i * 4) + 2], CultureInfo.InvariantCulture);
                    int    len   = int.Parse(keyNames[(i * 4) + 3], CultureInfo.InvariantCulture);
                    string key   = keyNames[i * 4];

                    if (((keyNames[(i * 4) + 1] == "S") && (start >= 0)) && (len > 0) && (PropertyValues.Length >= (start + len)))
                    {
                        _nvc[key] = PropertyValues.Substring(start, len);
                    }
                }
            }

            _isCustomReady = true;
        }