DDC.Properties-File.cs 5.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using TDMS.Common;
  4. namespace TDMS.Externals
  5. {
  6. internal partial class DDC : DIAdemConnectivity
  7. {
  8. /// <summary>
  9. /// 设置文件属性的值
  10. /// </summary>
  11. /// <param name="file">文件句柄</param>
  12. /// <param name="property">文件属性的名称</param>
  13. /// <param name="__arglist">可变参数列表,用于传递属性的值</param>
  14. /// <returns>执行结果。0 表示成功,负数表示错误代码</returns>
  15. [DllImport(DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DDC_SetFileProperty")]
  16. public static extern Error SetFileProperty(IntPtr file, string property, __arglist);
  17. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_SetFilePropertyTimestampComponents")]
  18. public static extern Error SetFilePropertyTimestampComponents(IntPtr file,
  19. string property,
  20. uint year,
  21. uint month,
  22. uint day,
  23. uint hour,
  24. uint minute,
  25. uint second,
  26. double milliSecond);
  27. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_SetFilePropertyV")]
  28. public static extern Error SetFilePropertyV(IntPtr file, string property, IntPtr args);
  29. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetFileProperty")]
  30. public static extern Error GetFileProperty(IntPtr file,
  31. string property,
  32. ref byte value,
  33. uint valueSizeInBytes);
  34. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetFilePropertyTimestampComponents")]
  35. public static extern Error GetFilePropertyTimestampComponents(IntPtr file,
  36. string property,
  37. out uint year,
  38. out uint month,
  39. out uint day,
  40. out uint hour,
  41. out uint minute,
  42. out uint second,
  43. out double milliSecond,
  44. out uint weekDay);
  45. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetFileStringPropertyLength")]
  46. public static extern Error GetFileStringPropertyLength(IntPtr file, string property, out uint length);
  47. [DllImport(DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "DDC_CreateFileProperty")]
  48. public static extern Error CreateFileProperty(IntPtr file,
  49. string property,
  50. TDMSDataType dataType,
  51. __arglist);
  52. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_CreateFilePropertyTimestampComponents")]
  53. public static extern Error CreateFilePropertyTimestampComponents(IntPtr file,
  54. string property,
  55. uint year,
  56. uint month,
  57. uint day,
  58. uint hour,
  59. uint minute,
  60. uint second,
  61. double milliSecond);
  62. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_CreateFilePropertyV")]
  63. public static extern Error CreateFilePropertyV(IntPtr file,
  64. string property,
  65. TDMSDataType dataType,
  66. IntPtr args);
  67. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_FilePropertyExists")]
  68. public static extern Error FilePropertyExists(IntPtr file, string property, out bool exists);
  69. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetNumFileProperties")]
  70. public static extern Error CountFileProperties(IntPtr file, out uint numProperties);
  71. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetFilePropertyNames")]
  72. public static extern Error GetFilePropertyNames(IntPtr file, IntPtr[] propertyNames, uint numPropertyNames);
  73. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetFilePropertyType")]
  74. public static extern Error GetFilePropertyType(IntPtr file, string property, out TDMSDataType dataType);
  75. }
  76. }