private void btnOK_Click(object sender, EventArgs e) { if (!File.Exists(txtProductLicense.Text)) { MessageBox.Show("Please select an existing file.", msgBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // // Validate the product license // CryptoLicense license = ProductLicense.Methods.CreateLicense(); license.StorageMode = LicenseStorageMode.ToFile; license.FileStoragePath = txtProductLicense.Text; // Load the license from file if (license.Load()) { if (license.Status != LicenseStatus.Valid) { MessageBox.Show("ConfigOS Foundry license validation failed.\nThe application will be closed.\n" + license.GetAllStatusExceptionsAsString() + "\nPlease select a correct license file and restart the application.", msgBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); license.Dispose(); Process.GetCurrentProcess().Kill(); } else { } } else { MessageBox.Show("ConfigOS Foundry license not found.\nThe application will be closed.", msgBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); license.Dispose(); Process.GetCurrentProcess().Kill(); } // // // Copy the existing Foundrykey to the application folder try { File.Copy(txtProductLicense.Text, prouctLicensePath, true); } catch (Exception err) { MessageBox.Show("The ConfigOS Foundry license was not successfully copied to the ConfigOS Foundry application folder.\nThe application will be closed." + err.Message, msgBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); Process.GetCurrentProcess().Kill(); } this.Close(); }