// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov Date: 1/2/2009 3:47:41 PM
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: ClientKey.java
package com.aptana.ide.core.licensing;
import java.util.Calendar;
import java.util.TimeZone;
public final class ClientKey
{
public ClientKey(int i, String s, long l)
{
type = i;
email = s;
expiration = 0x7fffffffffffffffL;
}
public boolean isCloseToExpiring()
{
Calendar calendar = Calendar.getInstance(GMT);
calendar.add(2, 1);
return getExpiration().before(calendar);
}
public boolean isValid()
{
return email != null && email != "EMAILS_NON_MATCHING";
}
public boolean isCloseToMatching()
{
return email == "EMAILS_NON_MATCHING";
}
public boolean isExpired()
{
Calendar calendar = Calendar.getInstance(GMT);
return calendar.after(getExpiration());
}
public String getEmail()
{
return email;
}
public Calendar getExpiration()
{
Calendar calendar = Calendar.getInstance(GMT);
calendar.setTimeInMillis(expiration);
return calendar;
}
public boolean isTrial()
{
return type != 1;
}
public boolean isPro()
{
return !isTrial();
}
public boolean shouldProPluginsRun()
{
if(isPro())
return true;
else
return !isExpired();
}
public static String trimEncryptedLicense(String s)
{
String s1 = s;
s1 = s1.trim();
s1 = s1.replaceAll("--begin-aptana-license--", "");
s1 = s1.replaceAll("--end-aptana-license--", "");
s1 = s1.replaceAll("\\s+", "");
return s1;
}
public static final String BEGIN_LICENSE_MARKER = "--begin-aptana-license--";
public static final String END_LICENSE_MARKER = "--end-aptana-license--";
public static final int PRO = 0;
public static final int TRIAL = 1;
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
public static final String EMAILS_NON_MATCHING = "EMAILS_NON_MATCHING";
public static final ClientKey EMPTY_KEY = new ClientKey(2, "yourname@hotmail.com", 0L);
private String email;
private long expiration;
private int type;
}