Ejemplo n.º 1
0
        private Dictionary <string, ICacheItem> Load(Stream s)
        {
            var table     = new Dictionary <string, ICacheItem>();
            int itemCount = UtilityMethods.ReadInt32(s);

            for (int i = 0; i < itemCount; i++)
            {
                try
                {
                    string     key = UtilityMethods.ReadString(s);
                    ICacheItem val = persister.Read(s);
                    if (val == null) // corrupt cache file
                    {
                        return(table);
                    }

                    table[key] = val;
                }
                catch (IOException)
                {
                    return(table);
                }
            }
            return(table);
        }