Created
February 8, 2018 07:07
-
-
Save hsienwei/4e2c19d03f1bf78303dce99fb32aceec to your computer and use it in GitHub Desktop.
第三種作法, 只用IntPtr做參照, 要取值再個別呼叫
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLUGIN_DLL_API const Data* GamePlayer_GetBattleReportBaseInfo(const uint32 mail_id) { ... } | |
PLUGIN_DLL_API uint32 Repo_ReportID(Data *Dta) { return Dta->id; } | |
PLUGIN_DLL_API uint32 Repo_ReportTime(Data *Dta) { return Dta->time; } | |
PLUGIN_DLL_API uint16 Repo_Type(Data *Dta) { return Dta->type; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ReportBase //ReportHandle : ReportBase | |
{ | |
#region DllImport | |
[DllImport(SysPluginBase.PlatformDllName)] | |
private static extern UInt32 Repo_ReportID(HandleRef Dta); | |
[DllImport(SysPluginBase.PlatformDllName)] | |
private static extern UInt32 Repo_ReportTime(HandleRef Dta); | |
[DllImport(SysPluginBase.PlatformDllName)] | |
private static extern UInt16 Repo_Type(HandleRef Dta); | |
#endregion | |
bool IsSetted = false; | |
protected HandleRef _handle; | |
public ReportBase(IntPtr Ptr) | |
{ | |
if (Ptr == System.IntPtr.Zero) | |
return; | |
_handle = new HandleRef(this, Ptr); | |
IsSetted = true; | |
} | |
#region api | |
public UInt32 ID { get { return (IsSetted) ? Repo_ReportID(_handle) : 0; } } | |
public UInt32 Time { get { return (IsSetted) ? Repo_ReportTime(_handle) : 0; } } | |
public UInt16 Type { get { return (IsSetted) ? Repo_Type(_handle) : 0; } } | |
#endregion | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment