chore(work): 调整目录结构

This commit is contained in:
Fu Diwei
2025-02-26 16:40:15 +08:00
parent 784dee7a28
commit 75e3899551
2 changed files with 9 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance
using SKIT.FlurlHttpClient.Primitives; using SKIT.FlurlHttpClient.Primitives;
using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.InteropServices; using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.InteropServices;
using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.Settings; using SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.Settings;
using SKIT.FlurlHttpClient.Wechat.Work.Utilities;
/// <summary> /// <summary>
/// 一个企业微信会话内容存档 API HTTP 客户端。 /// 一个企业微信会话内容存档 API HTTP 客户端。
@@ -159,7 +160,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance
IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) : IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) :
IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) :
throw new PlatformNotSupportedException(); throw new PlatformNotSupportedException();
string dataContent = MarshalerHelper.PtrToStringUTF8(dataContentPtr)!; string dataContent = MarshalHelper.PtrToStringUTF8(dataContentPtr)!;
response = JsonSerializer.Deserialize<Models.GetChatRecordsResponse>(dataContent); response = JsonSerializer.Deserialize<Models.GetChatRecordsResponse>(dataContent);
response._InternalRawBytes = Encoding.UTF8.GetBytes(dataContent); response._InternalRawBytes = Encoding.UTF8.GetBytes(dataContent);
@@ -253,7 +254,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance
IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) : IsRunOnWindows() ? FinanceDllWindowsPInvoker.GetContentFromSlice(dataPtr) :
IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) : IsRunOnLinux() ? FinanceDllLinuxPInvoker.GetContentFromSlice(dataPtr) :
throw new PlatformNotSupportedException(); throw new PlatformNotSupportedException();
string dataContent = MarshalerHelper.PtrToStringUTF8(dataContentPtr)!; string dataContent = MarshalHelper.PtrToStringUTF8(dataContentPtr)!;
try try
{ {
@@ -357,7 +358,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance
Marshal.Copy(dataContentPtr, bytes, 0, bytes.Length); Marshal.Copy(dataContentPtr, bytes, 0, bytes.Length);
response._InternalRawBytes = bytes; response._InternalRawBytes = bytes;
response.NextBufferIndex = MarshalerHelper.PtrToStringAnsi(dataNextBufferIndex); response.NextBufferIndex = MarshalHelper.PtrToStringAnsi(dataNextBufferIndex);
response.IsFinished = dataIsFinishFlag != 0; response.IsFinished = dataIsFinishFlag != 0;
} }

View File

@@ -1,11 +1,13 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security;
using System.Text; using System.Text;
namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.InteropServices namespace SKIT.FlurlHttpClient.Wechat.Work.Utilities
{ {
internal static class MarshalerHelper internal static class MarshalHelper
{ {
[SecurityCritical]
public static string? PtrToStringAnsi(IntPtr ptr) public static string? PtrToStringAnsi(IntPtr ptr)
{ {
if (ptr == IntPtr.Zero) if (ptr == IntPtr.Zero)
@@ -14,6 +16,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.ExtendedSDK.Finance.InteropServices
return Marshal.PtrToStringAnsi(ptr)!; return Marshal.PtrToStringAnsi(ptr)!;
} }
[SecurityCritical]
public static string? PtrToStringUTF8(IntPtr ptr) public static string? PtrToStringUTF8(IntPtr ptr)
{ {
if (ptr == IntPtr.Zero) if (ptr == IntPtr.Zero)