Notifications
Clear all

[Closed] LZO decompress/compress data

Hi, I have a problem, I’m trying to add to my sript a function that reads a lzo compressed data. Unfortunately, i don’t know very well C++ and i don’t know how to use the library into maxscript.

Someone can help me ?

24 Replies

You can use this in your maxscript if I’m correct. (.net).

http://lzo-net.sourceforge.net/

I cannot help you with the dotnet stuff – since I do not use it myself.
But I figured this would be a easier way then to implement it in c++ and then expose to maxscript as plugin function.

max2011 test:
dotnet.loadAssembly @“C:\Documents and Settings\User\Desktop\lzonet_1.0.1\lib\lzo.dll”
– Runtime error: dotNet runtime exception: Invalid directory on URL.

this mean that i must re-compiled dll with max SDK… but i don’t know how do…

uhmm… but this work:
lzo = dotnet.loadAssembly @“C:\Documents and Settings\User\Desktop\lzonet_1.0.1\lib\Simplicit.Net.Lzo.dll”
showProperties lzo
showMethods lzo

.CodeBase : <System.String>, read-only
.EntryPoint : <System.Reflection.MethodInfo>, read-only
.EscapedCodeBase : <System.String>, read-only
.Evidence : <System.Security.Policy.Evidence>, read-only
.FullName : <System.String>, read-only
.GlobalAssemblyCache : <System.Boolean>, read-only
.HostContext : <System.Int64>, read-only
.ImageRuntimeVersion : <System.String>, read-only
.Location : <System.String>, read-only
.ManifestModule : <System.Reflection.Module>, read-only
.ReflectionOnly : <System.Boolean>, read-only

.<System.Object>CreateInstance <System.String>typeName
.<System.Object>CreateInstance <System.String>typeName <System.Boolean>ignoreCase
.<System.Object>CreateInstance <System.String>typeName <System.Boolean>ignoreCase <System.Reflection.BindingFlags>bindingAttr <System.Reflection.Binder>binder <System.Object[]>args <System.Globalization.CultureInfo>culture <System.Object[]>activationAttributes
.[static]<System.String>CreateQualifiedName <System.String>assemblyName <System.String>typeName
.<System.Boolean>Equals <System.Object>o
.[static]<System.Boolean>Equals <System.Object>objA <System.Object>objB
.[static]<System.Reflection.Assembly>GetAssembly <System.Type>type
.[static]<System.Reflection.Assembly>GetCallingAssembly()
.<System.Object[]>GetCustomAttributes <System.Boolean>inherit
.<System.Object[]>GetCustomAttributes <System.Type>attributeType <System.Boolean>inherit
.[static]<System.Reflection.Assembly>GetEntryAssembly()
.[static]<System.Reflection.Assembly>GetExecutingAssembly()
.<System.Type[]>GetExportedTypes()
.<System.IO.FileStream>GetFile <System.String>name
.<System.IO.FileStream[]>GetFiles()
.<System.IO.FileStream[]>GetFiles <System.Boolean>getResourceModules
.<System.Int32>GetHashCode()
.<System.Reflection.Module[]>GetLoadedModules()
.<System.Reflection.Module[]>GetLoadedModules <System.Boolean>getResourceModules
.<System.Reflection.ManifestResourceInfo>GetManifestResourceInfo <System.String>resourceName
.<System.String[]>GetManifestResourceNames()
.<System.IO.Stream>GetManifestResourceStream <System.String>name
.<System.IO.Stream>GetManifestResourceStream <System.Type>type <System.String>name
.<System.Reflection.Module>GetModule <System.String>name
.<System.Reflection.Module[]>GetModules()
.<System.Reflection.Module[]>GetModules <System.Boolean>getResourceModules
.<System.Reflection.AssemblyName>GetName()
.<System.Reflection.AssemblyName>GetName <System.Boolean>copiedName
.GetObjectData <System.Runtime.Serialization.SerializationInfo>info <System.Runtime.Serialization.StreamingContext>context
.<System.Reflection.AssemblyName[]>GetReferencedAssemblies()
.<System.Reflection.Assembly>GetSatelliteAssembly <System.Globalization.CultureInfo>culture
.<System.Reflection.Assembly>GetSatelliteAssembly <System.Globalization.CultureInfo>culture <System.Version>version
.<System.Type>GetType()
.<System.Type>GetType <System.String>name
.<System.Type>GetType <System.String>name <System.Boolean>throwOnError
.<System.Type>GetType <System.String>name <System.Boolean>throwOnError <System.Boolean>ignoreCase
.<System.Type[]>GetTypes()
.<System.Boolean>IsDefined <System.Type>attributeType <System.Boolean>inherit
.[static]<System.Reflection.Assembly>Load <System.String>assemblyString
.[static]<System.Reflection.Assembly>Load <System.Byte[]>rawAssembly
.[static]<System.Reflection.Assembly>Load <System.Reflection.AssemblyName>assemblyRef
.[static]<System.Reflection.Assembly>Load <System.String>assemblyString <System.Security.Policy.Evidence>assemblySecurity
.[static]<System.Reflection.Assembly>Load <System.Byte[]>rawAssembly <System.Byte[]>rawSymbolStore
.[static]<System.Reflection.Assembly>Load <System.Reflection.AssemblyName>assemblyRef <System.Security.Policy.Evidence>assemblySecurity
.[static]<System.Reflection.Assembly>Load <System.Byte[]>rawAssembly <System.Byte[]>rawSymbolStore <System.Security.Policy.Evidence>securityEvidence
.[static]<System.Reflection.Assembly>LoadFile <System.String>path
.[static]<System.Reflection.Assembly>LoadFile <System.String>path <System.Security.Policy.Evidence>securityEvidence
.[static]<System.Reflection.Assembly>LoadFrom <System.String>assemblyFile
.[static]<System.Reflection.Assembly>LoadFrom <System.String>assemblyFile <System.Security.Policy.Evidence>securityEvidence
.[static]<System.Reflection.Assembly>LoadFrom <System.String>assemblyFile <System.Security.Policy.Evidence>securityEvidence <System.Byte[]>hashValue <System.Configuration.Assemblies.AssemblyHashAlgorithm>hashAlgorithm
.<System.Reflection.Module>LoadModule <System.String>moduleName <System.Byte[]>rawModule
.<System.Reflection.Module>LoadModule <System.String>moduleName <System.Byte[]>rawModule <System.Byte[]>rawSymbolStore
.[static]<System.Reflection.Assembly>LoadWithPartialName <System.String>partialName
.[static]<System.Reflection.Assembly>LoadWithPartialName <System.String>partialName <System.Security.Policy.Evidence>securityEvidence
.[static]<System.Boolean>ReferenceEquals <System.Object>objA <System.Object>objB
.[static]<System.Reflection.Assembly>ReflectionOnlyLoad <System.Byte[]>rawAssembly
.[static]<System.Reflection.Assembly>ReflectionOnlyLoad <System.String>assemblyString
.[static]<System.Reflection.Assembly>ReflectionOnlyLoadFrom <System.String>assemblyFile
.<System.String>ToString()

 lo1

according to the docs, what you need is the LZOCompressor class:


lzocompressor = lzo.createInstance "LZOCompressor"
compressedByteArray = lzocompressor.compress yourByteArray
1 Reply
(@johnwhile)
Joined: 11 months ago

Posts: 0

thanks, i never used dotnet in maxscript. But don’t work, it return undefined
i found in Visual Studio project the class what i must instanced “public class LZOCompressor {…”
but lzocompressor = undefined…???

i recompiled in Framework 2.0 3.0 3.5 but the same issue … i’m confused

 lo1

sorry, you also need to include the namespace


lzocompressor = lzo.createInstance "Simplicit.Net.LZO.LZOCompressor"
compressedByteArray = lzocompressor.compress yourByteArray

ok, now load but how work the dll ? i write

>lzo = dotnet.loadAssembly “D:\Documents and Settings\Admin\Desktop\lzonet_1.0.1\lib\Simplicit.Net.Lzo.dll”
>lzocompressor = lzo.createInstance “Simplicit.Net.Lzo.LZOCompressor”
>compressedByteArray = lzocompressor.compress #()
and return
>#(17, 0, 0, 0, 0, 0, 0)
but if i write
>compressedByteArray = lzocompressor.compress #(1,2,3,4)
write a strange error…

… uhm… i must use Encoding.Default.GetBytes ?

 lo1
(dotnetclass "system.text.encoding").default.getbytes "my string"

>> #(109, 121, 32, 115, 116, 114, 105, 110, 103)

Page 1 / 3