|
|
|
@ -12,16 +12,7 @@ namespace MouseInterception |
|
|
|
|
|
|
|
|
|
[DllImport( @DLL_NAME , CallingConvention=CallingConvention.Cdecl )] |
|
|
|
|
[return: MarshalAs(UnmanagedType.BStr)] |
|
|
|
|
private static extern string open_api( |
|
|
|
|
ref AppConfig.ApiSettings pAppSettings , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiDevice[] pDevices , int nDevices , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiDeviceConfig[] pDeviceConfigs , int nDeviceConfigs , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiAppProfile[] pAppProfiles , int nAppProfiles , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiEvent[] pEvents , int nEvents , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiAction[] pActions , int nActions , |
|
|
|
|
ref DebugConfig.ApiSettings pDebugSettings , |
|
|
|
|
int initConsole |
|
|
|
|
) ; |
|
|
|
|
private static extern string open_api( ref DebugConfig.ApiSettings pDebugSettings , int initConsole ) ; |
|
|
|
|
|
|
|
|
|
[DllImport( @DLL_NAME , CallingConvention=CallingConvention.Cdecl )] |
|
|
|
|
[return: MarshalAs(UnmanagedType.BStr)] |
|
|
|
@ -35,32 +26,21 @@ namespace MouseInterception |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiDeviceConfig[] pDeviceConfigs , int nDeviceConfigs , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiAppProfile[] pAppProfiles , int nAppProfiles , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiEvent[] pEvents , int nEvents , |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiAction[] pActions , int nActions , |
|
|
|
|
ref DebugConfig.ApiSettings pDebugSettings |
|
|
|
|
[MarshalAs(UnmanagedType.LPArray)] AppConfig.ApiAction[] pActions , int nActions |
|
|
|
|
) ; |
|
|
|
|
|
|
|
|
|
[DllImport( @DLL_NAME , CallingConvention=CallingConvention.Cdecl )] |
|
|
|
|
[return: MarshalAs(UnmanagedType.BStr)] |
|
|
|
|
private static extern string reload_debug_config( ref DebugConfig.ApiSettings pDebugSettings ) ; |
|
|
|
|
|
|
|
|
|
public MouseDll( bool initConsole ) |
|
|
|
|
{ |
|
|
|
|
// open the mouse API |
|
|
|
|
AppConfig.ApiSettings appSettings = Program.appConfig.settings ; |
|
|
|
|
AppConfig.ApiDevice[] devices = Program.appConfig.devices ; |
|
|
|
|
AppConfig.ApiDeviceConfig[] deviceConfigs = Program.appConfig.deviceConfigs ; |
|
|
|
|
AppConfig.ApiAppProfile[] appProfiles = Program.appConfig.appProfiles ; |
|
|
|
|
AppConfig.ApiEvent[] events = Program.appConfig.events ; |
|
|
|
|
AppConfig.ApiAction[] actions = Program.appConfig.actions ; |
|
|
|
|
DebugConfig.ApiSettings debugSettings = Program.debugConfig.settings ; |
|
|
|
|
string errorMsg = open_api( |
|
|
|
|
ref appSettings , |
|
|
|
|
devices , devices.Length , |
|
|
|
|
deviceConfigs , deviceConfigs.Length , |
|
|
|
|
appProfiles , appProfiles.Length , |
|
|
|
|
events , events.Length , |
|
|
|
|
actions , actions.Length , |
|
|
|
|
ref debugSettings , |
|
|
|
|
initConsole ? 1 : 0 |
|
|
|
|
) ; |
|
|
|
|
string errorMsg = open_api( ref debugSettings , initConsole?1:0 ) ; |
|
|
|
|
if ( errorMsg != null ) |
|
|
|
|
throw new Exception( errorMsg ) ; |
|
|
|
|
reloadConfig() ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
~MouseDll() |
|
|
|
@ -80,18 +60,26 @@ namespace MouseInterception |
|
|
|
|
AppConfig.ApiAppProfile[] appProfiles = Program.appConfig.appProfiles ; |
|
|
|
|
AppConfig.ApiEvent[] events = Program.appConfig.events ; |
|
|
|
|
AppConfig.ApiAction[] actions = Program.appConfig.actions ; |
|
|
|
|
DebugConfig.ApiSettings debugSettings = Program.debugConfig.settings ; |
|
|
|
|
string errorMsg = reload_config( |
|
|
|
|
ref appSettings , |
|
|
|
|
devices , devices.Length , |
|
|
|
|
deviceConfigs , deviceConfigs.Length , |
|
|
|
|
appProfiles , appProfiles.Length , |
|
|
|
|
events , events.Length , |
|
|
|
|
actions , actions.Length , |
|
|
|
|
ref debugSettings |
|
|
|
|
actions , actions.Length |
|
|
|
|
) ; |
|
|
|
|
if ( errorMsg != null ) |
|
|
|
|
throw new Exception( errorMsg ) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void reloadDebugConfig() |
|
|
|
|
{ |
|
|
|
|
// reload the debug config |
|
|
|
|
DebugConfig.ApiSettings debugSettings = Program.debugConfig.settings ; |
|
|
|
|
string errorMsg = reload_debug_config( ref debugSettings ) ; |
|
|
|
|
if ( errorMsg != null ) |
|
|
|
|
throw new Exception( errorMsg ) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|