Ejemplo n.º 1
0
        private void Form_Main_Load(object sender, EventArgs e)
        {
            this.Text          = this.Text.Replace("{vv}", ProgramVersion);
            RB_DefaultMix.Text = RB_DefaultMix.Text.Replace("{xx}", defaultNumberOfLic.ToString());
            RB_DefaultMix.Text = RB_DefaultMix.Text.Replace("{yy}", defaultNumberOfLic.ToString());
            RB_DefaultMix.Text = RB_DefaultMix.Text.Replace("{zz}", defaultNumberOfLic.ToString());
            RB_DefaultSL.Text  = RB_DefaultSL.Text.Replace("{xx}", defaultNumberOfLic.ToString());
            RB_DefaultSL.Text  = RB_DefaultSL.Text.Replace("{yy}", defaultNumberOfLic.ToString());
            RB_DefaultHL.Text  = RB_DefaultHL.Text.Replace("{zz}", defaultNumberOfLic.ToString());

            P_CustomSettings.Visible = false;
            B_Start.Enabled          = false;
            LocalActivation          = defaultNumberOfLic;
            NetworkActivationSL      = defaultNumberOfLic;
            NetworkActivationHL      = defaultNumberOfLic;
            UnlockedTrialware        = true;

            Status = LicGenHelper.sntl_lg_initialize(InitParam);
            if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status)
            {
                /*handle error*/
                TB_Logs.Text = TB_Logs.Text + "LicGen API initialization error: " + Status;
            }
            else
            {
                TB_Logs.Text = TB_Logs.Text + "LicGen API initialization is successfully.";
            }
        }
Ejemplo n.º 2
0
 private void Form_Main_FormClosed(object sender, FormClosedEventArgs e)
 {
     Status = LicGenHelper.sntl_lg_cleanup();
     if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status)
     {
         /*handle error*/
     }
 }
Ejemplo n.º 3
0
        public string NetworkLicenseHL(int licNumber)
        {
            string StartParam = null;
            sntl_lg_license_type_t LicenseType = sntl_lg_license_type_t.SNTL_LG_LICENSE_TYPE_UPDATE;
            string Definition =
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                " <sentinel_ldk:license schema_version=\"1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:sentinel_ldk=\"http://www.safenet-inc.com/sentinelldk\">" +
                "   <!-- You can specify the acknowledgement request flag. Possible values are \"Yes\" or \"No\"-->" +
                "   <acknowledgement_request>Yes</acknowledgement_request>" +
                "   <!-- You can specify the enforcement type. Possible values are \"HL\", \"SL-AdminMode\", \"SL-UserMode\", \"HL or SL-AdminMode\" or \"HL or SL-AdminMode or SL-UserMode\"-->" +
                "   <enforcement_type>HL</enforcement_type>" +
                "   <upgrade_to_driverless>Yes</upgrade_to_driverless>" +
                "   <product>" +
                "      <id>123</id>" +
                "      <name>Sample Product 123</name>" +
                "      <use_vclock>No</use_vclock>" +
                "      <feature>" +
                "         <id>1000</id>" +
                "         <name>Sample Feature 1000</name>" +
                "         <license_properties>" +
                "            <!-- Only one of the below license model can be specified. -->" +
                "            <perpetual/>" +
                "            <!-- <expiration_date>2011-12-31</expiration_date> -->" +
                "            <!-- <execution_count>30</execution_count> -->" +
                "            <!-- <days_to_expiration>90</days_to_expiration> -->" +
                "            <!-- You can specify the remote desktop accessibility flag. Possible values are \"Yes\" or \"No\" --> " +
                "            <concurrency>" +
                "               <count>" + licNumber + "</count>" +
                "               <count_criteria>Per Station</count_criteria>" +
                "               <network_access>Yes</network_access>" +
                "            </concurrency>" +
                "            <remote_desktop_access>Yes</remote_desktop_access>" +
                "         </license_properties>" +
                "      </feature>" +
                "   </product>" +
                " </sentinel_ldk:license>";

            Status = LicGenHelper.sntl_lg_start(StartParam, VendorCode, LicenseType, Definition, CurrentStateForHL);

            if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status)
            {
                /*handle error*/
                return("StartS_" + Convert.ToString(Status));
            }
            else
            {
                string genStatus;
                genStatus = GenerationLicense();

                return(genStatus);
            }
        }
Ejemplo n.º 4
0
        public string GenerationLicense()
        {
            string GenerationParam = null;
            string License         = null;
            string UpdatedState    = null;

            Status = LicGenHelper.sntl_lg_generate_license(GenerationParam, ref License, ref UpdatedState);
            if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status)
            {
                return("GenS_" + Convert.ToString(Status));
            }
            else if (sntl_lg_status_t.SNTL_LG_MASTER_KEY_IO_ERROR == Status)
            {
                DialogResult ErrorMessageDialogResult = MessageBox.Show(
                    "Error Message: " + Environment.NewLine +
                    Status + Environment.NewLine +
                    "Error code: 5025 - may happened if you login on PC via RDP." + Environment.NewLine +
                    "Please check RDP connection firstly and then push:" + Environment.NewLine +
                    "Abort - if you would like to stop cleaning process." + Environment.NewLine +
                    "Retry - if you would like to try do last generation again." + Environment.NewLine +
                    "Ignore - if you would like to ignore last error. " + Environment.NewLine,
                    "!Error message!",
                    MessageBoxButtons.AbortRetryIgnore);

                if (ErrorMessageDialogResult == DialogResult.Abort)
                {
                    return("break");
                }
                else if (ErrorMessageDialogResult == DialogResult.Retry)
                {
                    return(GenerationLicense());
                }
                else // if (ErrorMessageDialogResult == DialogResult.Ignore)
                {
                    return("GenS_" + Convert.ToString(Status));
                }
            }
            else
            {
                return("success");
            }
        }
Ejemplo n.º 5
0
        public string UnlockedTrialwareLicense()
        {
            string StartParam = null;
            sntl_lg_license_type_t LicenseType = sntl_lg_license_type_t.SNTL_LG_LICENSE_TYPE_PROVISIONAL;
            string Definition =
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                " <sentinel_ldk:license schema_version=\"1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:sentinel_ldk=\"http://www.safenet-inc.com/sentinelldk\">" +
                "   <enforcement_type>SL-AdminMode</enforcement_type>" +
                "   <product>" +
                "      <id>123</id>" +
                "      <name>Sample Product 123</name>" +
                "      <feature>" +
                "         <id>1000</id>" +
                "         <name>Sample Feature 1000</name>" +
                "         <license_properties>" +
                "            <!-- You can specify the number of days until the license expires -->" +
                "            <days_to_expiration>30</days_to_expiration>" +
                "            <!-- You can specify the remote desktop accessibility flag. Possible values are \"Yes\" or \"No\" --> " +
                "            <remote_desktop_access>Yes</remote_desktop_access>" +
                "            <!-- You can specify the virtual machine accessibility flag. Possible values are \"Yes\" or \"No\" -->" +
                "            <virtual_machine_access>No</virtual_machine_access>" +
                "         </license_properties>" +
                "      </feature>" +
                "   </product>" +
                " </sentinel_ldk:license>";
            string CurrentStateProvisional = null;

            Status = LicGenHelper.sntl_lg_start(StartParam, VendorCode, LicenseType, Definition, CurrentStateProvisional);
            if (sntl_lg_status_t.SNTL_LG_STATUS_OK != Status)
            {
                /*handle error*/
                return("StartS_" + Convert.ToString(Status));
            }
            else
            {
                string genStatus;
                genStatus = GenerationLicense();

                return(genStatus);
            }
        }