Пример #1
0
        public static GlobalHeapCollection GetGlobalHeapObject(H5BinaryReader reader, Superblock superblock, ulong address)
        {
            if (!_globalHeapMap.TryGetValue(superblock, out var addressToCollectionMap))
            {
                addressToCollectionMap     = new Dictionary <ulong, GlobalHeapCollection>();
                _globalHeapMap[superblock] = addressToCollectionMap;
            }

            if (!addressToCollectionMap.TryGetValue(address, out var collection))
            {
                collection = H5Cache.ReadGlobalHeapCollection(reader, superblock, address);
                addressToCollectionMap[address] = collection;
            }

            return(collection);
        }
Пример #2
0
        public void Dispose()
        {
            H5Cache.Clear(this.Context.Superblock);
            this.Context.Reader.Dispose();

            if (_deleteOnClose && System.IO.File.Exists(this.Path))
            {
                try
                {
                    System.IO.File.Delete(this.Path);
                }
                catch
                {
                    //
                }
            }
        }
        public H5NamedReference GetTarget(H5LinkAccess linkAccess)
        {
            // this file
            if (string.IsNullOrWhiteSpace(this.ObjectPath))
            {
                try
                {
                    var reference = this.Parent.InternalGet(this.Value, linkAccess);
                    reference.Name = this.Name;
                    return(reference);
                }
                catch (Exception ex)
                {
                    return(new H5NamedReference(this.Name, Superblock.UndefinedAddress)
                    {
                        Exception = ex
                    });
                }
            }
            // external file
            else
            {
                try
                {
                    var absoluteFilePath = H5Utils.ConstructExternalFilePath(this.Parent.File, this.Value, linkAccess);
                    var objectPath       = this.ObjectPath;
                    var externalFile     = H5Cache.GetH5File(this.Parent.Context.Superblock, absoluteFilePath);

                    return(externalFile.InternalGet(objectPath, linkAccess));
                }
                catch (Exception ex)
                {
                    return(new H5NamedReference(this.Name, Superblock.UndefinedAddress)
                    {
                        Exception = ex
                    });
                }
            }
        }