private void GetFileAttrInfos(FileListItem fli) { if (HDF4Helper.IsHdf4(fli.FileName)) { Hdf4Operator oper = new Hdf4Operator(fli.FileName); try { Dictionary <string, string> fileAtrr = null; if (oper != null) { fileAtrr = oper.GetAttributes(); if (fileAtrr != null) { InitFileAttr(fileAtrr); } else { ClearFileAtrr(); } InitDataset(oper.GetDatasetNames, oper); } } catch (Exception ex) { AddLog(fli.FileName + "文件读取失败:" + ex.Message); } finally { if (oper != null) { oper.Dispose(); } } } }
public override bool IsSupport(string fname, byte[] header1024, Dictionary <string, string> datasetNames) { string ext = Path.GetExtension(fname).ToUpper(); if (ext != ".HDF" || !HDF4Helper.IsHdf4(header1024)) { return(false); } return(HasDatasets(fname)); }
public override bool IsSupport(string fname, byte[] header1024, Dictionary <string, string> datasetNames) { string ext = Path.GetExtension(fname).ToUpper(); if (ext != ".HDF" || !HDF4Helper.IsHdf4(header1024)) { return(false); } TryGetBandProviderDefinition(fname, datasetNames); return(_matchedBandProviderDef != null); }
private IHdfOperator HdfOperatorFactory(string filename) { if (HDF5Helper.IsHdf5(filename)) { return(new Hdf5Operator(filename)); } if (HDF4Helper.IsHdf4(filename)) { return(new Hdf4Operator(filename)); } return(null); }
private void lstDataSets_SelectedIndexChanged(object sender, EventArgs e) { ClearDataSetCombox(); if (lstDataSets.SelectedItems.Count == 0 || lstDataSets.SelectedItems[0].Tag == null || lstFileInfoList.SelectedItems.Count == 0 || (lstFileInfoList.SelectedItems[0]).Tag == null) { return; } FileListItem fli = (lstFileInfoList.SelectedItems[0]).Tag as FileListItem; DataSetMosaicInfo dsi = lstDataSets.SelectedItems[0].Tag as DataSetMosaicInfo; if (fli == null) { return; } if (HDF4Helper.IsHdf4(fli.FileName)) { Hdf4Operator oper = new Hdf4Operator(fli.FileName); try { Dictionary <string, string> datasetAtrr = new Dictionary <string, string>(); if (oper != null) { datasetAtrr = oper.GetAttributes(dsi.DataSetName); if (datasetAtrr != null) { InitDataSetAttr(datasetAtrr, ref dsi); } Size size = Size.Empty; int bandCount = 0; Type datatype; int datatypeSize = 0; HDF4Helper.DataTypeDefinitions hdf4DataType = HDF4Helper.DataTypeDefinitions.DFNT_NUINT16; if (GetDataSetSize(dsi.DataSetName, oper, out size, out bandCount, out hdf4DataType, out datatype, out datatypeSize)) { InitHeigthWidth(size.Width, size.Height, bandCount, ref dsi); if (dsi != null) { dsi.HDF4DataType = hdf4DataType; } } } } finally { if (oper != null) { oper.Dispose(); } } } }
protected override bool IsCompatible(string fileName, byte[] header1024, params object[] args) { if (args == null || args.Length == 0) { return(false); } string ext = Path.GetExtension(fileName).ToUpper(); if (ext != ".HDF" || !HDF4Helper.IsHdf4(header1024)) { return(false); } return(true); }
public static bool IsSupport(string filename, byte[] header1024) { bool status = false; if (header1024 != null) { status = HDF4Helper.IsHdf4(header1024); } else { status = HDF4Helper.IsHdf4(filename); } if (status) { DateTime dt; string ptname; status = TryParseFileName(filename, out dt, out ptname); } return(status); }
public static bool IsCompatible(string fileName, byte[] header1024) { if (header1024 == null) { header1024 = new byte[1024]; using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { fs.Read(header1024, 0, 1024); fs.Close(); } } if (!HDF5Helper.IsHdf5(header1024) && !HDF4Helper.IsHdf4(header1024)) { return(false); } L2ProductDefind[] l2Pros = L2ProductDefindParser.GetL2ProductDefs(fileName); if (l2Pros == null || l2Pros.Length == 0) { return(false); } return(true); }