package com.authentrend.licenseparser;

import com.authentrend.liblicense.LicenseVer;
import java.nio.file.Files;
import java.nio.file.Paths;

public class LicenseParser {
    public static void main(String[] args) {
        if (args.length < 1) {
            System.out.println("Please provide the path to the license file.");
            System.exit(1);
        }

        String licensePath = args[0];

        try {
            String licenseContent = new String(Files.readAllBytes(Paths.get(licensePath)));
            String decryptedLicense = LicenseVer.decryptLicenseFile(licenseContent);
            System.out.println(decryptedLicense);
        } catch (Exception e) {
            System.err.println("Error decrypting license: " + e.getMessage());
            System.exit(1);
        }
    }
}