Example #1
0
 public bool Load(string file)
 {
     try
     {
         m_keys.Clear();
         TextReader tr = new StreamReader(file);
         while (true)
         {
             string line = tr.ReadLine();
             if (line != null)
             {
                 line = line.Trim();
                 if (line.Length > 0)
                 {
                     LicenseKey lk = new LicenseKey();
                     lk.Init(line);
                     m_keys.Add(lk);
                 }
             }
             else
             {
                 break;
             }
         }
         tr.Close();
         tr = null;
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
         return(false);
     }
     return(true);
 }
Example #2
0
 public bool Load(string file) 
 {
     try
     {
         m_keys.Clear();
         TextReader tr = new StreamReader(file);
         while (true) 
         {
             string line = tr.ReadLine();
             if (line != null)
             {
                 line = line.Trim();
                 if (line.Length > 0)
                 {
                     LicenseKey lk = new LicenseKey();
                     lk.Init(line);
                     m_keys.Add(lk);
                 }
             }
             else 
             {
                 break;
             }
         }
         tr.Close();
         tr = null;
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
         return false;
     }
     return true;
 }
Example #3
0
        private void cmdLicense_Click(object sender, EventArgs e)
        {
            // get the text string from
            string license = txtLicense.Text;

            license = license.Trim();
            if (license.Length != 32)
            {
                MessageBox.Show("Invalid license, please re-check");
                return;
            }
            LicenseKey lk = new LicenseKey();

            try
            {
                lk.Init(license);
                if (lk.valid)
                {
                    txtLicense.Text = "";
                    //should really check, vendor id against plugin vendor id
                    KeyRing.Instance().m_keys.Add(lk);
                    string licensefile = UVDLPApp.Instance().m_apppath + UVDLPApp.m_pathsep + "licenses.key";
                    if (KeyRing.Instance().Save(licensefile))
                    {
                        MessageBox.Show("License Added to Keyring, Restart to take effect");
                    }
                    else
                    {
                        MessageBox.Show("Error Saving Keyring");
                    }
                }
                else
                {
                    MessageBox.Show("Invalid license, please re-check");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error validating license, please re-check");
            }
        }
        private void cmdLicense_Click(object sender, EventArgs e)
        {
            // get the text string from
            string license = txtLicense.Text;

            license = license.Trim();
            if (license.Length != 32)
            {
                MessageBox.Show(((DesignMode) ? "InvalidLicensePleaseReCheck" :UVDLPApp.Instance().resman.GetString("InvalidLicensePleaseReCheck", UVDLPApp.Instance().cul)));
                return;
            }
            LicenseKey lk = new LicenseKey();

            try
            {
                lk.Init(license);
                if (lk.valid)
                {
                    txtLicense.Text = "";
                    //should really check, vendor id against plugin vendor id
                    KeyRing.Instance().m_keys.Add(lk);
                    string licensefile = UVDLPApp.Instance().m_apppath + UVDLPApp.m_pathsep + "licenses.key";
                    if (KeyRing.Instance().Save(licensefile))
                    {
                        MessageBox.Show(((DesignMode) ? "LicenseAddedToKeyringRestartToTakeEffect" :UVDLPApp.Instance().resman.GetString("LicenseAddedToKeyringRestartToTakeEffect", UVDLPApp.Instance().cul)));
                    }
                    else
                    {
                        MessageBox.Show(((DesignMode) ? "ErrorSavingKeyring" :UVDLPApp.Instance().resman.GetString("ErrorSavingKeyring", UVDLPApp.Instance().cul)));
                    }
                }
                else
                {
                    MessageBox.Show(((DesignMode) ? "InvalidLicensePleaseReCheck" :UVDLPApp.Instance().resman.GetString("InvalidLicensePleaseReCheck", UVDLPApp.Instance().cul)));
                }
            }
            catch (Exception)
            {
                MessageBox.Show(((DesignMode) ? "ErrorValidatingLicensePleaseReCheck" :UVDLPApp.Instance().resman.GetString("ErrorValidatingLicensePleaseReCheck", UVDLPApp.Instance().cul)));
            }
        }
 private void cmdLicense_Click(object sender, EventArgs e)
 {
     // get the text string from
     string license = txtLicense.Text;
     license = license.Trim();
     if (license.Length != 32)
     {
         MessageBox.Show("Invalid license, please re-check");
         return;
     }
     LicenseKey lk = new LicenseKey();
     try
     {
         lk.Init(license);
         if (lk.valid)
         {
             txtLicense.Text = "";
             //should really check, vendor id against plugin vendor id
             KeyRing.Instance().m_keys.Add(lk);
             string licensefile = UVDLPApp.Instance().m_apppath + UVDLPApp.m_pathsep + "licenses.key";
             if (KeyRing.Instance().Save(licensefile))
             {
                 MessageBox.Show("License Added to Keyring, Restart to take effect");
             }
             else
             {
                 MessageBox.Show("Error Saving Keyring");
             }
         }
         else
         {
             MessageBox.Show("Invalid license, please re-check");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error validating license, please re-check");
     }
 }