Ejemplo n.º 1
0
        public static H5File GetH5File(Superblock superblock, string absoluteFilePath)
        {
            if (!Uri.TryCreate(absoluteFilePath, UriKind.Absolute, out var uri))
            {
                throw new Exception("The provided path is not absolute.");
            }

            if (!uri.IsFile && !uri.IsUnc)
            {
                throw new Exception("The provided path is not a file path or aN UNC path.");
            }

            if (!_fileMap.TryGetValue(superblock, out var pathToH5FileMap))
            {
                pathToH5FileMap      = new Dictionary <string, H5File>();
                _fileMap[superblock] = pathToH5FileMap;
            }

            if (!pathToH5FileMap.TryGetValue(uri.AbsoluteUri, out var h5File))
            {
#warning This does not correspond to https://support.hdfgroup.org/HDF5/doc/RM/H5L/H5Lcreate_external.htm
                h5File = H5File.Open(uri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                pathToH5FileMap[uri.AbsoluteUri] = h5File;
            }

            return(h5File);
        }
Ejemplo n.º 2
0
 public static H5File Open(string filePath, FileMode mode, FileAccess fileAccess, FileShare fileShare)
 {
     return(H5File.Open(filePath, mode, fileAccess, fileShare, deleteOnClose: false));
 }