Notifications
Clear all

[Closed] DotNetClass [System.IO.DriveInfo]

you have to specify the actual resource… and make sure it exists.

e.g.


-- correct
dnGet.dnGetDiskFreeSpace @"c:"
false
GBleft = (((dnGet.freeBytes/1024)/1024)/1024)
17L

-- wrong
dnGet.dnGetDiskFreeSpace @"\\zb-test\"
false
GBleft = (((dnGet.freeBytes/1024)/1024)/1024)
17L -- bogus value left over from the previous call

-- correct
dnGet.dnGetDiskFreeSpace @"\\zb-test\Public"
false
GBleft = (((dnGet.freeBytes/1024)/1024)/1024)
489L -- that's better

I’ve updated my example, my bad sorry Just go by what ZBoxx said

Yeah, I’ve used VS2008 Express. Cheers!

Hi All,

I have just found out that due to security permissions, you can’t put the “KClasses.dll” onto a network server, which is annoying…!

dotnet.loadassembly @"\\\\myserver\
ewfolder\\KClasses.dll"
dnGet=dotnetObject "KClasses.DnGetDiskFreeSpaceEx"
dnGet.dnGetDiskFreeSpace @"\\myserver
ewfolder"
GBleft = (((dnGet.freeBytes/1024)/1024)/1024)
if GBleft > 10 then print "enough space" else print "medic!"

Causes the error:

-- Runtime error: dotNet runtime exception: System.Security.Permissions.SecurityPermission

Do you know of a workaround, apart from copying the dll to say, the root of whatever version of 3dsMax I am using?

Thanks,
Mike

One thing that I did was to check if the KClasses.dll file was in the network folder and if it was, copy it to the local scripts folder and load the assembly from there.

Thanks.
I have now taken this approach and its working at the moment.
Mike

Page 2 / 2