Example #1
0
        internal void Reset(Hashtable sd)
        {
            _Fields      = new FieldDictionary();
            _ArrayFields = new ArrayFieldDictionary();

            // clone the keys array, b/c we may be changing the hashtable within the loop
            string[] keys = new string[sd.Keys.Count];
            sd.Keys.CopyTo(keys, 0);

            foreach (string s in keys)
            {
                //Console.WriteLine("{0} : {1}", s, sd[s]);
                if (isDigit(s[s.Length - 1]))
                {
                    string baseName = s.TrimEnd(digits);
                    if (sd.ContainsKey(baseName + "0"))
                    {
                        processArray(baseName, sd);
                    }
                    else if (baseName == "fileSize")
                    {
                        // fileSize has some stange behavior.  In a filelog command, a file that is deleted
                        // at the head revision will not have a fileSize0 field.  This blows up my logic,
                        // so I handle it here as a special case
                        sd.Add("fileSize0", "");
                        processArray(baseName, sd);
                    }
                    else
                    {
                        // not an array, so add it as a single value (key just happens to be a digit)
                        _Fields.Add(s, (string)sd[s]);
                    }
                }
                else
                {
                    _Fields.Add(s, (string)sd[s]);
                }
            }
        }
Example #2
0
        internal void Reset(Dictionary <string, string> sd)
        {
            _allFields   = sd;
            _Fields      = new FieldDictionary();
            _ArrayFields = new ArrayFieldDictionary();

            // clone the keys array, b/c we may be changing the hashtable within the loop
            string[] keys = new string[_allFields.Keys.Count];
            _allFields.Keys.CopyTo(keys, 0);

            foreach (string s in keys)
            {
                string baseName;
                if (isArray(s, out baseName))
                {
                    processArray(baseName);
                }
                else
                {
                    _Fields.Add(s, _allFields[s]);
                }
            }
        }
Example #3
0
        internal void Reset(Dictionary<string, string> sd)
        {
            _allFields = sd;
            _Fields = new FieldDictionary();
            _ArrayFields = new ArrayFieldDictionary();

            // clone the keys array, b/c we may be changing the hashtable within the loop
            string[] keys = new string[_allFields.Keys.Count];
            _allFields.Keys.CopyTo(keys, 0);

            foreach (string s in keys)
            {
                string baseName;
                if (isArray(s, out baseName))
                {
                    processArray(baseName);
                }
                else
                {
                    _Fields.Add(s, _allFields[s]);
                }
            }
        }