public bool LoadCache(string filename)
        {
            using (var reader = new BinaryReader(
                       new FileStream(filename, FileMode.Open, FileAccess.Read)))
            {
                if (!ReadCacheHeader(reader))
                {
                    return(false);
                }

                var initors = new List <Action>((int)reader.BaseStream.Length / 1000);

                for (var i = 0; i < m_mapping.DataHolderDefinitions.Length; i++)
                {
                    var def           = m_mapping.DataHolderDefinitions[i];
                    var contentStream = new BinaryContentStream(def);
                    contentStream.LoadAll(reader, initors);
                }

                if (initors.Count == 0 || reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    // empty cache file or invalid cache size -> Consider it a fail
                    return(false);
                }

                foreach (var initor in initors)
                {
                    initor();
                }
            }
            return(true);
        }
        public void SaveCache(string filename)
        {
            using (var writer = new BinaryWriter(
                       new FileStream(filename, FileMode.Create, FileAccess.Write)))
            {
                WriteHeader(writer);

                for (var i = 0; i < m_mapping.DataHolderDefinitions.Length; i++)
                {
                    var def           = m_mapping.DataHolderDefinitions[i];
                    var holders       = def.CacheGetter.Invoke(null, new object[0]);
                    var contentStream = new BinaryContentStream(def);
                    contentStream.WriteAll(writer, (IEnumerable)holders);
                }
            }
        }