All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.ncactivate.utils.ActivationData Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package com.alachisoft.ncache.ncactivate.utils;

import com.alachisoft.ncache.ncactivate.appdata.MachineInfo;
import com.alachisoft.ncache.ncactivate.appdata.ProductInfo;
import com.alachisoft.ncache.ncactivate.appdata.UserInf;
import com.alachisoft.ncache.ncactivate.crypto.Crypto;

import java.util.Locale;

/**
 * @author Administrator
 */
public class ActivationData {

    public ProductInfo Product;
    public UserInf User;
    public MachineInfo Machine;

    /**
     * Creates a new instance of ActivationData
     */
    public ActivationData() {
        Product = new ProductInfo();
        User = new UserInf();
        Machine = new MachineInfo();
    }

    static String GetRegSection() {
        return "UserInfo";
    }

    public int Load() {
        if (Product.Load() < 0) return -1;
        if (Machine.Load() < 0) return -1;
        if (User.Load() < 0) return -1;
        return 0;
    }

    public void Save() {
        Machine.Save();
        Product.Save();
        User.Save();
        return;
    }

    public String ToXml() {
        String xml = new String();
        xml.format(Locale.US, ("%s%s%s"), Product.ToXml(), User.ToXml(), Machine.ToXml());
        return xml;
    }

    public String ToLinearText() {

        String text = String.format(Locale.US, "%s\n%s\n%s\n%s", Crypto.Encode(Product.ToLinearText()), Crypto.Encode(User.ToLinearText()), Crypto.Encode(Machine.ToLinearText()), Crypto.Encode(" \t0\t "));//This last portion is a replacement for DeploymentInfo for Java Clients >= 5.0
        return text;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy