Ejemplo n.º 1
0
 void CloseDog()
 {
     if (hasp == null)
     {
         return;
     }
     hasp.Logout();
     hasp.Dispose();
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Demonstrates how to perform a login using the default
    /// feature and how to perform an automatic logout
    /// using the Hasp's Dispose method.
    /// </summary>
    public void LoginDisposeDemo()
    {
        Verbose("Login/Dispose Demo with Default Feature (HaspFeature.Default)");

        HaspFeature feature = HaspFeature.Default;

        Hasp hasp = new Hasp(feature);

        HaspStatus status = hasp.Login(VendorCode.Code, scope);

        ReportStatus(status);

        Verbose("Disposing object - will perform an automatic logout");
        hasp.Dispose();

        Verbose("");
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Performs a logout operation on the key.
    /// </summary>
    public void LogoutDemo(ref Hasp hasp)
    {
        // sanity check
        if ((null == hasp) || !hasp.IsLoggedIn())
        {
            return;
        }

        Verbose("Logout Demo");

        HaspStatus status = hasp.Logout();

        ReportStatus(status);

        // get rid of the key immediately.
        hasp.Dispose();
        hasp = null;
        Verbose("");
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Demonstrates how to perform a login and a logout
    /// using the default feature.
    /// </summary>
    public void LoginLogoutDefaultDemo()
    {
        HaspFeature feature = HaspFeature.Default;


        Hasp hasp = new Hasp(feature);

        HaspStatus status = hasp.Login(VendorCode.Code, scope);

        ReportStatus(status);

        if (HaspStatus.StatusOk == status)
        {
            status = hasp.Logout();

            ReportStatus(status);
        }

        // recommended, but not mandatory
        // this call ensures that all resources to the key
        // are freed immediately.
        hasp.Dispose();
    }
Ejemplo n.º 5
0
 void CloseDog()
 {
     hasp.Logout();
     hasp.Dispose();
 }