inanms
Joined: 26 Aug 2015 Posts: 2
|
Posted: Wed Aug 26, 2015 12:46 pm Post subject: my application is crashing |
|
|
Hi,
I have added encrypted license to my app.
when i run the app it shows infralution dialog box but if i click continue evaluation it is crashing and if i install license after entering the product key it crashes again . only exit button is working fine.
here is my code please let me know if i am doing something wrong
using System;
using System.Configuration;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using Decav.Diagnostics;
using Infralution.Licensing;
using System.Drawing;
namespace pva
{
internal static class Program
{
const string LICENSE_PARAMETERS =
@"<EncryptedLicenseParameters>
<ProductName>quadsqPVA</ProductName>
<RSAKeyValue>
<Modulus>v/h5UFoIEfi90MdBWidwv/1Xnqwt+CT+NCJMc754ZgftljrHmfTA8LEFLEyG7EsMd7v2TjUrO+f5meaZw35NJQf0C9Axf4fIWw5O9rKi+xjR4z+XefaGJ4q8/v8eg+uLQmwRCBj4xEpgJfFhwUc8WdFa3g7yzlGMsRA0X0FxgQ8=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
<DesignSignature>uxfCNzxYAqZyyiHOJaN5OB1tA+HgVO5vUvVzG67Q3U3xYChISfntf1r/UN5nK5vP/bGlN4lSYuutwC6rQ2/5i4h3I9D8oSHRKOiZB7jiBVyEMvUS1A0A/zx5cNLC6W/moijZytHAd2ufX/AOF6OQLE8v8hUsHsBFf8zeJkI+uNA=</DesignSignature>
<RuntimeSignature>OF9KpLOIHfzLel17HRIgmEodvBQ4sepLDkPwSyu99M6n9mUrpmoXZMw5mDTrlm2mJskAwePeSp5Bk7TrUIdu6+PMCR2M12+NNBjk6yLq9RrBwHhysB/AqKEDL1U7I7+3zcsw1CSj4iILbSI21on9SWhKkqKUSx24slKSIyocGTs=</RuntimeSignature>
<KeyStrength>7</KeyStrength>
<ChecksumProductInfo>True</ChecksumProductInfo>
</EncryptedLicenseParameters>";
/// <summary>
/// The name of the file to store the license key in - the sub directory is created
/// automatically by ILS
/// </summary>
static string _licenseFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\PVA\pva.lic";
/// <summary>
/// The installed license if any
/// </summary>
static EncryptedLicense _license;
private static void CheckIfThereIsValidLicenseForApplication()
{
// check if there is a valid license for the application
//
EncryptedLicenseInstallForm licenseForm = new EncryptedLicenseInstallForm();
_license = licenseForm.ShowDialog(_licenseFile, _license);
}
[STAThread]
static void Main()
{
// check if there is a valid license for the application
//
EncryptedLicenseProvider provider = new EncryptedLicenseProvider();
_license = provider.GetLicense(LICENSE_PARAMETERS, _licenseFile);
CheckIfThereIsValidLicenseForApplication();
// if there is no installed license then display the evaluation dialog until
// the user installs a license or selects Exit or Continue
//
while (_license == null)
{
EvaluationMonitor evaluationMonitor = new RegistryEvaluationMonitor("quadsq.123");
EvaluationDialog evaluationDialog = new EvaluationDialog(evaluationMonitor, Application.ProductName);
EvaluationDialogResult dialogResult = evaluationDialog.ShowDialog();
if (dialogResult == EvaluationDialogResult.Exit) return; // exit the app
if (dialogResult == EvaluationDialogResult.Continue) break; // exit the loop
if (dialogResult == EvaluationDialogResult.InstallLicense)
{
EncryptedLicenseInstallForm licenseForm = new EncryptedLicenseInstallForm();
_license = licenseForm.ShowDialog(_licenseFile, null);
}
}
DecavDiagnostics.Write("Program", DiagnosticSeverity.Information, "Main", "Starting up");
// Bind to Application's thread exception to write out the error log if something bad happens.
Application.ThreadException += ApplicationThreadException;
Application.EnableVisualStyles();
DecavDiagnostics.Write("Program", DiagnosticSeverity.Information, "Main", "Visual Styles Enabled");
Application.SetCompatibleTextRenderingDefault(false);
DecavDiagnostics.Write("Program", DiagnosticSeverity.Information, "Main", "Running the form.");
DevExpress.Skins.SkinManager.EnableFormSkins();
if (Convert.ToBoolean(ConfigurationManager.AppSettings["FirstTimeRun"]))
{
MessageBox.Show("PVA hasn't been configured. Please execute the settings manager to configure PVA settings. This is located in: " +
Environment.NewLine +
Directory.GetCurrentDirectory() + @"\SettingsManager.exe");
Application.Exit();
}
else
{
Application.Run(new FrmMain());
}
}
static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
{
DecavDiagnostics.WriteException("Application_ThreadException", "An exception occured in the application", e.Exception);
string data = AppStateData.GetCurrentState().TraceHistory;
File.WriteAllText("PVA.Log", data);
MessageBox.Show("Error was generated. Please email the PVA.Log file stored in: " + Application.StartupPath +
" to the developer");
Application.Exit();
}
}
} |
|