/// <summary> /// 获取激活文件信息 /// </summary> /// <param name="activeFileInfo">激活文件信息</param> /// <returns>返回0表示正常;返回负数请根据ErrorCodeUtil类注释查看;其他值请在官网-帮助中心查询</returns> public int ASFGetActiveFileInfo(out ActiveFileInfo activeFileInfo) { activeFileInfo = new ActiveFileInfo(); IntPtr pASFActiveFileInfo = MemoryUtil.Malloc(MemoryUtil.SizeOf <ASF_ActiveFileInfo>()); //调用SDK接口 int retCode = ASFFunctions.ASFGetActiveFileInfo(pASFActiveFileInfo); if (retCode != 0) { MemoryUtil.Free(pASFActiveFileInfo); return(retCode); } //转化结果 ASF_ActiveFileInfo asfActiveFileInfo = MemoryUtil.PtrToStructure <ASF_ActiveFileInfo>(pASFActiveFileInfo); activeFileInfo.startTime = Marshal.PtrToStringAnsi(asfActiveFileInfo.startTime); activeFileInfo.endTime = Marshal.PtrToStringAnsi(asfActiveFileInfo.endTime); activeFileInfo.platform = Marshal.PtrToStringAnsi(asfActiveFileInfo.platform); activeFileInfo.sdkType = Marshal.PtrToStringAnsi(asfActiveFileInfo.sdkType); activeFileInfo.appId = Marshal.PtrToStringAnsi(asfActiveFileInfo.appId); activeFileInfo.sdkKey = Marshal.PtrToStringAnsi(asfActiveFileInfo.sdkKey); activeFileInfo.sdkVersion = Marshal.PtrToStringAnsi(asfActiveFileInfo.sdkVersion); activeFileInfo.fileVersion = Marshal.PtrToStringAnsi(asfActiveFileInfo.fileVersion); MemoryUtil.Free(pASFActiveFileInfo); return(retCode); }
/// <summary> /// 获取激活文件信息接口 /// </summary> /// <param name="activeFileInfo"></param> /// <returns>接口返回码,返回0表示正常,返回其他值请在开发者中心-帮助中心查询</returns> public int ArcSoft_FIC_GetActiveFileInfo(out ActiveFileInfo activeFileInfo) { int retCode = -1; activeFileInfo = new ActiveFileInfo(); IntPtr pActiveFileInfo = MemoryUtil.Malloc(MemoryUtil.SizeOf <AFIC_FSDK_ActiveFileInfo>()); //获取激活文件信息接口 retCode = FICFunctions.ArcSoft_FIC_GetActiveFileInfo(pActiveFileInfo); if (!retCode.Equals(0)) { MemoryUtil.Free(pActiveFileInfo); return(retCode); } AFIC_FSDK_ActiveFileInfo sActiveFileInfo = MemoryUtil.PtrToStruct <AFIC_FSDK_ActiveFileInfo>(pActiveFileInfo); MemoryUtil.Free(pActiveFileInfo); #region 指针转化字符串 activeFileInfo.startTime = Marshal.PtrToStringAnsi(sActiveFileInfo.startTime); activeFileInfo.endTime = Marshal.PtrToStringAnsi(sActiveFileInfo.endTime); activeFileInfo.activeKey = Marshal.PtrToStringAnsi(sActiveFileInfo.activeKey); activeFileInfo.platform = Marshal.PtrToStringAnsi(sActiveFileInfo.platform); activeFileInfo.sdkType = Marshal.PtrToStringAnsi(sActiveFileInfo.sdkType); activeFileInfo.appId = Marshal.PtrToStringAnsi(sActiveFileInfo.appId); activeFileInfo.sdkKey = Marshal.PtrToStringAnsi(sActiveFileInfo.sdkKey); activeFileInfo.sdkVersion = Marshal.PtrToStringAnsi(sActiveFileInfo.sdkVersion); activeFileInfo.fileVersion = Marshal.PtrToStringAnsi(sActiveFileInfo.fileVersion); #endregion return(retCode); }