/// <summary> /// 读取MAT文件的变量信息列表 /// </summary> /// <param name="fileData">文件数据</param> /// <returns>MAT变量信息结构列表</returns> public static List <MatVariableInfo> GetVariableList(byte[] fileData) { if (fileData == null || fileData.Length == 0) { return(null); } try { IntPtr retptr = IntPtr.Zero; int datasize = 0; if (CommonMethod.Is64BitVersion()) { retptr = MATGetVariableList64(fileData, fileData.Length, ref datasize); } else { retptr = MATGetVariableList32(fileData, fileData.Length, ref datasize); } return(CommonMethod.CopyStructureListFromIntptrAndFree <MatVariableInfo>(ref retptr, datasize)); } catch (Exception ex) { ErrorString = ex.Message; return(null); } }
/// <summary> /// 获取组分信息 /// </summary> /// <param name="fileData"></param> /// <returns></returns> private static List <ComponentInfo> QuantGetComponentInfo(byte[] fileData) { try { IntPtr retptr = IntPtr.Zero; int compCount = 0; if (fileData == null || fileData.Length == 0) { throw new Exception("Invalid Parameter"); } if (CommonMethod.Is64BitVersion()) { retptr = SPAGetComponents64(fileData, fileData.Length, ref compCount); } else { retptr = SPAGetComponents32(fileData, fileData.Length, ref compCount); } if (retptr == IntPtr.Zero) { throw new Exception(FileFormat.GetDLLErrorMessage()); } return(CommonMethod.CopyStructureListFromIntptrAndFree <ComponentInfo>(ref retptr, compCount)); } catch (Exception ex) { ErrorString = ex.Message; return(null); } }