예제 #1
0
 public Dictionary <string, string> GetAttributes()
 {
     if (!_readFileAttrs)
     {
         Dictionary <string, string> cacheAttrs = GlobalFileAttributeCache.GetFileAttributes(_fname);
         if (cacheAttrs == null)
         {
             _readFileAttrs = true;
             int id = HDF4Helper.SDstart(_fname, HDF4Helper.AccessCodes.DFACC_READ);
             try
             {
                 int dsCount  = 0;
                 int attCount = 0;
                 HDF4Helper.SDfileinfo(id, out dsCount, out attCount);
                 if (attCount == 0)
                 {
                     return(null);
                 }
                 _fileAttrs = GetAttributes(id, attCount);
                 GlobalFileAttributeCache.SetFileAttributes(_fname, _fileAttrs);
             }
             finally
             {
                 HDF4Helper.SDend(id);
             }
         }
         else
         {
             _fileAttrs = cacheAttrs;
         }
     }
     return(_fileAttrs);
 }
예제 #2
0
        private string[] GetALLDataset()
        {
            int sd_id = HDF4Helper.SDstart(_fname, HDF4Helper.AccessCodes.DFACC_READ);

            try
            {
                int num_datasets     = 0;
                int num_global_attrs = 0;
                HDF4Helper.SDfileinfo(sd_id, out num_datasets, out num_global_attrs);
                string[] dsNames = ReadSDinfo(sd_id, num_datasets);
                return(dsNames);
            }
            finally
            {
                HDF4Helper.SDend(sd_id);
            }
        }