Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19487 |

    Hi,

    I need to load Xceed.Zip assembly dynamically (can’t have a reference from my project, because it is shared between a compact framework solution and a regular). The problem is that I get the License exception. Setting the license doesn’t seem to “stick”.
    Here’s a code snippet:

    Assembly a = Assembly.Load(“Xceed.Zip, Version=2.1.5228.0, Culture=neutral, PublicKeyToken=ba83ff368b7563c6”);
    Type tQuickZip = a.GetType(“Xceed.Zip.QuickZip”);
    Type tLicenser = a.GetType(“Xceed.Zip.Licenser”);

    string sMethodName = “GetZipContents”;
    object[] paramArray = new object[] { “C:\\tst_nodes.zip”, “” };

    tLicenser.InvokeMember(“LicenseKey”, BindingFlags.SetProperty, null, null, new object[] { “My-license-code-here” });
    tQuickZip.InvokeMember(sMethodName, BindingFlags.InvokeMethod, null, null, paramArray);

    Any suggestions?

    Thanx!
    /peter

    Imported from legacy forums. Posted by Peter (had 2788 views)

    User (Old forums)
    Member
    Post count: 23064

    I tried the following, and it works well:

    <code> Assembly a = Assembly.Load(“Xceed.Zip, Version=2.3.5479.0, Culture=neutral, PublicKeyToken=ba83ff368b7563c6”);
    Type tQuickZip = a.GetType(“Xceed.Zip.QuickZip”);
    Type tLicenser = a.GetType(“Xceed.Zip.Licenser”);

    string sMethodName = “GetZipContents”;
    object[] paramArray = new object[] { “d:\\foobar.zip”, “” };

    tLicenser.InvokeMember(“LicenseKey”, BindingFlags.SetProperty, null, null, new object[] { “ZIN23-BUNHK-Y4WMY-44XA” });

    try
    {
    object items = tQuickZip.InvokeMember(sMethodName, BindingFlags.InvokeMethod, null, null, paramArray);

    foreach( object item in items as IEnumerable )
    {
    Console.WriteLine( item.GetType().GetProperty( “FullName” ).GetValue( item, null ) );
    }
    }
    catch( TargetInvocationException except )
    {
    Console.WriteLine( except.InnerException.ToString() );
    }
    catch( Exception except )
    {
    Console.WriteLine( except.ToString() );
    }

    Console.WriteLine( “done.” );
    Console.ReadLine();
    </code>

    The above license key is a valid trial license not yet expired. Is yours still valid?

    Imported from legacy forums. Posted by Martin (had 223 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi!

    Thanks for your reply. My code worked too, when I got license code right. I accidently used the ZIP Compact Framework license key in a winforms project. Thanks for the hint!

    /peter

    Imported from legacy forums. Posted by Peter (had 3706 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.