Add new comment

Hello,

I have been trying to use your fantastic libraries (great work) but I have found two main problems during the integration with my libraries. I could solve the first one but I am stuck with the second so I need your help in order to know if I can continue to use netphp or I have to modify my solution.

First of all, I couldn´t access to member variables (I have to use a dll without properties but only public member variables). To solve this I modified the magic methods __set and __get of NetProxy.php class. I did the following:

function __set($name, $value)
{
try
{
NetProxyUtils::UnpackParameter($value);
$this->wrapper->PropertySet($name, $value);
}
catch (\Exception $e)
{
$this->wrapper->$name = $value;
}
}

function __get($name)
{
try
{
$result = $this->wrapper->PropertyGet($name);
return NetProxy::Get($result);
}
catch (\Exception $e)
{
return $this->wrapper->$name;
}
}

The second problem I found was when I try to invoke a method of a library with three parameters. I obtain the following exception:

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> netutilities<br/><b>Description:</b> This version of PhpNet does not support calling methods with more than 2 parameters.' in C:\Apache24\htdocs\netphp-master\src\Core\MagicWrapper.php:95 Stack trace: #0 C:\Apache24\htdocs\netphp-master\src\Core\MagicWrapper.php(95): com->CallMethod('Create', Array) #1 C:\Apache24\htdocs\netphp-master\src\Core\NetProxy.php(60): NetPhp\Core\MagicWrapper->CallMethod('Create', Array) #2 C:\Apache24\htdocs\com.php(49): NetPhp\Core\NetProxy->__call('Create', Array) #3 C:\Apache24\htdocs\com.php(49): NetPhp\Core\NetProxy->Create('C:\\www\\prueba.t...', 2048, Object(NetPhp\Core\NetProxy)) #4 {main} thrown in C:\Apache24\htdocs\netphp-master\src\Core\MagicWrapper.php on line 95

The code is the following:

$manager = new \NetPhp\Core\NetManager();
$manager->RegisterAssembly('mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'mscorlib');
$manager->RegisterClass('mscorlib', 'System.IO.File', 'File');
$manager->RegisterClass('mscorlib', 'System.IO.FileOptions', 'FileOptions');
$file = $manager->Create('mscorlib', 'File');
$fileoptions = $manager->Create('mscorlib', 'System.IO.FileOptions')->Enum('Encrypted');

$file->Create("C:\\www\\prueba.tres", 2048, $fileoptions);
//$file->Create("C:\\www\\prueba.tres", 2048); // This works

The problem here is that the exception is launched when netutilities MagicWrapper class in invoked so I am not sure if I can do anything (as I did in the first problem).

Any idea? suggestions? Thanks anyway