Exemplo n.º 1
0
        /// <summary>
        /// Attempts to load this action history from disk
        /// </summary>
        void Load()
        {
            try
            {
                using (BinaryArchiveReader Reader = new BinaryArchiveReader(Location))
                {
                    int Version = Reader.ReadInt();
                    if (Version != CurrentVersion)
                    {
                        Log.TraceLog("Unable to read action history from {0}; version {1} vs current {2}", Location, Version, CurrentVersion);
                        return;
                    }

                    OutputItemToAttributeHash = new ConcurrentDictionary <FileItem, byte[]>(Reader.ReadDictionary(() => Reader.ReadFileItem(), () => Reader.ReadFixedSizeByteArray(HashLength)));
                }
            }
            catch (Exception Ex)
            {
                Log.TraceWarning("Unable to read {0}. See log for additional information.", Location);
                Log.TraceLog("{0}", ExceptionUtils.FormatExceptionDetails(Ex));
            }
        }