Exemplo n.º 1
0
 /// <summary>
 ///     Load prefetch cache file
 /// </summary>
 public void LoadPrefetch(DecimaManagerCollection managers)
 {
     using (var prefetchData = OpenFile(DecimaConstants.PREFETCH_CACHE))
     {
         Prefetch = prefetchData.Core.ToStructured <DecimaPrefetch>(managers);
     }
 }
        /// <summary>
        ///     Get text by hash, otherwise load it into cache.
        /// </summary>
        /// <param name="hash"></param>
        /// <param name="file"></param>
        /// <param name="managers"></param>
        /// <returns></returns>
        public DecimaSimpleText GetText(Guid hash, string file, DecimaManagerCollection managers)
        {
            if (Cache.TryGetValue(hash, out var simple))
            {
                return(simple);
            }

            ImportText(file, managers);

            return(Cache.TryGetValue(hash, out simple) ? simple : default);