123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Runtime.InteropServices;
- using UnityEngine;
- namespace udSDK
- {
- class udConvertContext
- {
- public IntPtr pConvertContext;
- public void Create(udContext context)
- {
- udError error = udConvert_CreateContext(context.pContext, ref pConvertContext);
- if (error != udSDK.udError.udE_Success)
- throw new Exception("udConvertContext.Create failed.");
- }
- public void Destroy()
- {
- udError error = udConvert_DestroyContext(ref pConvertContext);
- if (error != udSDK.udError.udE_Success)
- throw new Exception("udConvertContext.Destroy failed.");
- }
- public void AddFile(string fileName)
- {
- udError error = udConvert_AddItem(pConvertContext, fileName);
- if (error != udSDK.udError.udE_Success)
- throw new Exception("udConvertContext.AddItem failed.");
- }
- public void SetFileName(string fileName)
- {
- udError error = udConvert_SetOutputFilename(pConvertContext, fileName);
- if (error != udSDK.udError.udE_Success)
- throw new Exception("udConvertContext.SetOutputFilename failed.");
- }
- public void DoConvert()
- {
- udError error = udConvert_DoConvert(pConvertContext);
- if (error != udSDK.udError.udE_Success)
- throw new Exception("udConvertContext.DoConvert failed.");
- }
- [DllImport(UDSDKLibrary.name)]
- private static extern udError udConvert_CreateContext(IntPtr pContext, ref IntPtr ppConvertContext);
- [DllImport(UDSDKLibrary.name)]
- private static extern udError udConvert_DestroyContext(ref IntPtr ppConvertContext);
- [DllImport(UDSDKLibrary.name)]
- private static extern udError udConvert_AddItem(IntPtr pConvertContext, string fileName);
- [DllImport(UDSDKLibrary.name)]
- private static extern udError udConvert_SetOutputFilename(IntPtr pConvertContext, string fileName);
- [DllImport(UDSDKLibrary.name)]
- private static extern udError udConvert_DoConvert(IntPtr pConvertContext);
- }
- }
|