Chat Support
Loupe - Log - Monitor - Resolve
Gibraltar.Agent Namespace / Packager Class
Members Example

In This Topic
    Packager Class
    In This Topic
    Packages up session files collected on the local computer and sends them to a Loupe Server or anywhere via email or file transport with no user interface. For a user interface, see PackagerDialog.
    Syntax
    'Declaration
     
    
    Public NotInheritable Class Packager 
    public sealed class Packager 
    Remarks

    The packager class can be used to package up session files synchronously or asynchronously and send them via email or just store the results to a single, compact file without any user interface.

    When creating a package of sessions, the packager needs to know:

    • What sessions to include: The SessionCriteria enumeration is used to indicate how to select packages. It's a flag enumeration, allowing you to specify multiple values at the same time.
    • What to do with the package: It can be emailed or stored as a local file for you to subsequently handle on your own.
    • Whether to mark sessions as read: Typically you'll want to include sessions only on one package so that if a user generates a new package later it won't contain sessions that have been completely sent before. With this option set, Loupe will mark all of the sessions that it includes in the package as long as the package is created successfully. If there is a problem creating the package no sessions will be marked as sent.

    Asynchronous Usage

    The packager can function asynchronously by using the methods that end with Async. To get result information for asynchronous operations you need to subscribe to the EndSession event.

    Sending the Active Session

    When you specify Session Criteria that includes the ActiveSession several unique things happen.

    • To enable the session to be sent the current log file is ended and a new one is started (just like if Log.EndFile was called).
    • The session will not be marked as read as it is still being changed. Therefore, it can still be sent later after it closes when the complete session will be available.
    • If the session has already been split into multiple files they will have to be merged in memory first and then sent. Depending on the size of your session data this may consume significant memory and processor time. As a general rule of thumb it takes about 50 times the amount of memory as the session file size because of the significant compression used when storing the data.

    Example
    The following example sends all of the session files for the product the current application is running as to the email address specified in the application config file. Once packaged, sessions are marked as read and won't be automatically included in future packages.
    //Send an email with all of the information about the current application we haven't sent before.
    using(Packager packager = new Packager())
    {
        packager.SendEmail(SessionCriteria.NewSessions, true, null);
    }
    The following example packages all of the session files for the product the current application is running as into a local file. Once packaged, sessions are marked as read and won't be automatically included in future packages.
    //Send a file with all of the information about the current application we haven't sent before.
    using (Packager packager = new Packager())
    {
        //the file name will automatically have the appropriate extension added, so it is specified 
        //below without any file extension.  Typically you will want to generate a unique, temporary
        //file name to store the data as instead of using a fixed file name.
        packager.SendToFile(SessionCriteria.NewSessions, true, "C:\YourAppSessionData");
    }
    Inheritance Hierarchy

    System.Object
       Gibraltar.Agent.Packager

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also