public void LoadAlteredLicense() { LicenseManager manager = new LicenseManager(); manager.LoadPublicKeyFromString(TestKeys.PublicKey); License testLicense = manager.LoadLicenseFromString(TestLicenses.GetTestAlteredLicenseString()); }
public SEAdvComboBox() { LicenseManager.Validate(typeof(SEAdvComboBox)); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); this.txtValue = new TextBox(); this.txtValue.TabStop = false; this.txtValue.BorderStyle = BorderStyle.None; this.txtValue.ReadOnly = true; this.txtValue.BackColor = SystemColors.Window; this.txtValue.TextChanged += new EventHandler(txtValue_TextChanged); this.btnComboButton = new Button(); this.btnComboButton.Text = ""; this.btnComboButton.Click += new EventHandler(ToggleTreeView); this.formDropDown = new Form(); this.formDropDown.FormBorderStyle = FormBorderStyle.None; this.formDropDown.BringToFront(); this.formDropDown.StartPosition = FormStartPosition.Manual; this.formDropDown.ShowInTaskbar = false; this.formDropDown.BackColor = SystemColors.Control; this.formDropDown.Deactivate += new EventHandler(frmTreeView_Deactivate); txtBack = new TextBox(); txtBack.TabStop = false; this.Controls.Add(txtBack); this.Controls.AddRange(new Control[] { btnComboButton, txtValue }); }
public void LoadNonXml() { LicenseManager manager = new LicenseManager(); manager.LoadPublicKeyFromString(TestKeys.PublicKey); License testLicense = manager.LoadLicenseFromString(TestLicenses.GetNonXml()); }
private void RegisterGdp() { LicenseManager _manager = new LicenseManager(); _manager.RegisterKEY("411807659822389691114151231799986"); _manager.RegisterKEY("912167958713519651119121587784646"); }
private static void GetLicense(LicenseCategory licenseCategory) { LicenseClient licenseClient = new LicenseClient(LicenseClient.PublicKeyXmlFromAssembly(Assembly.GetExecutingAssembly())); try { LicensePublisherResponse response = licenseClient.GetLicense( Product, Assembly.GetExecutingAssembly().GetName().Version, s_licenseKeys[(int)licenseCategory], licenseCategory.ToString(), "Test User", "Test Company", "*****@*****.**", MachineLicense.LocalMachineData); License license = response.License; if (license == null) { Console.WriteLine("ERROR: " + response.ErrorMessage); } else { File.WriteAllText(Assembly.GetExecutingAssembly().Location + ".lic", license.SignedString); LicenseManager.Reset(); } licenseClient.Close(); } catch (CommunicationException exception) { Console.WriteLine("EXCEPTION: " + exception.Message); licenseClient.Abort(); } }
protected void Application_Start() { string licenseName = "60;100-KAI"; string licenseKey = "11ED9159EB11121F52FE8ABA629C07F1"; LicenseManager.AddLicense(licenseName, licenseKey); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); ModelBinders.Binders.Add(typeof(JArray), new JArrayModelBinder()); ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder()); //Database.SetInitializer<BaseReadDbContext>(null); //Database.SetInitializer<ReadDbContext>(null); //Database.SetInitializer<WriteDbContext>(null); //using (var dbcontext = new ReadDbContext()) //{ // var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext; // var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace); // mappingCollection.GenerateViews(new List<EdmSchemaError>()); //} //using (var dbcontext = new WriteDbContext()) //{ // var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext; // var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace); // mappingCollection.GenerateViews(new List<EdmSchemaError>()); //} }
public ShellTaskBarWPF() { Type type = typeof(ShellTaskBarWPF); License license1 = LicenseManager.Validate(type, this); base.Visibility = Visibility.Hidden; }
public LicManagerArticleNumSteps(IWebDriver driver) { _utilMethods = new UtilMethods(driver); _snowHome = new SnowHome(driver); _globeCommunity = new GlobeCommunity(driver); _licenseManager = new LicenseManager(driver); }
static void Main(string[] args) { // The library won't work without a license. You can get free time limited license // at https://bitmiracle.com/jpeg2000/ LicenseManager.SetTrialLicense("contact [email protected] for a license"); string fileName = @"Sample data/a1_mono.j2c"; using (var image = new J2kImage(fileName)) { Console.WriteLine("Size = {0}x{1}", image.Width, image.Height); Console.WriteLine("Color space = {0}", image.ColorSpace); Console.WriteLine("Component count = {0}", image.ComponentsInfo.Count); int componentIndex = 0; foreach (var component in image.ComponentsInfo) { Console.WriteLine("Component {0} offset = {1}x{2}", componentIndex, component.Left, component.Top); Console.WriteLine("Component {0} size = {1}x{2}", componentIndex, component.Width, component.Height); Console.WriteLine("Component {0} bytes per pixel = {1}", componentIndex, component.BitsPerPixel); componentIndex++; } if (image.TileCount > 1) { Console.WriteLine("Tile count = {0}", image.TileCount); Console.WriteLine("Tile size = {0}x{1}", image.TileWidth, image.TileHeight); } Console.WriteLine("Default tile coding style = {0}", image.DefaultTileInfo.CodingStyle); Console.WriteLine("Default tile progression order = {0}", image.DefaultTileInfo.ProgressionOrder); Console.WriteLine("Default tile quality layers count = {0}", image.DefaultTileInfo.QualityLayerCount); } }
private void buttonSave_Click(object sender, EventArgs e) { LicenseConfig config = new LicenseConfig(); config.Type = "HL7"; if (comboBoxDeviceName.Text.Trim() == "HL7_SENDER") { config.DeviceName = "HL7_SENDER"; config.Direction = "OUTBOUND"; } else { config.DeviceName = "HL7_RECEIVER"; config.Direction = "INBOUND"; } config.Enabled = bool.Parse(comboBoxEnabled.Text.Trim()); LicenseManager <LicenseConfig> lm = new LicenseManager <LicenseConfig>(this.textBoxLicenseFile.Text.Trim()); lm.Config = config; lm.EnabledCrypto = true; if (lm.Save()) { ShowMessageInfo("Save license success."); } else { ShowMessageError("Save license failed."); } }
protected internal override void Setup(FeatureConfigurationContext context) { try { var licenseManager = new LicenseManager(); licenseManager.InitializeLicense(context.Settings.Get<string>(LicenseTextSettingsKey)); context.Container.RegisterSingleton(licenseManager); var licenseExpired = licenseManager.HasLicenseExpired(); if (!licenseExpired) { return; } context.Pipeline.Register("LicenseReminder", new AuditInvalidLicenseBehavior(), "Audits that the message was processed by an endpoint with an expired license"); if (Debugger.IsAttached) { context.Pipeline.Register("LogErrorOnInvalidLicense", new LogErrorOnInvalidLicenseBehavior(), "Logs an error when running in debug mode with an expired license"); } } catch (Exception ex) { //we only log here to prevent licensing issue to abort startup and cause production outages Logger.Fatal("Failed to initialize the license", ex); } }
private ExecFactory() { #if LICENSING_ENABLED #if TIME_BOUNDED DateTime expiry = new DateTime(2016, 12, 31); #else DateTime expiry = DateTime.MaxValue; #endif // TIME_BOUNDED if (!_licenseChecked || DateTime.Now > expiry) { if (Debugger.IsAttached) { if (!LicenseManager.Check()) { MessageBox.Show("Sage® Simulation and Modeling Library license is invalid.", "Licensing Error"); } } try { LicenseManager.ReportUsage( ); } catch (WebException) { Console.WriteLine("Failure to report usage."); } catch (Exception) { Console.WriteLine("Failure to report usage."); } _licenseChecked = true; } #if TIME_BOUNDED Console.WriteLine("Trial license expiration, {0}.", expiry); #endif // TIME_BOUNDED #endif // LICENSING_ENABLED }
internal SceneNode CreateInstance(ILicenseFileManager licenseManager, ISceneInsertionPoint insertionPoint, Rect rect, OnCreateInstanceAction action) { if (LicenseManager.CurrentContext == null || !typeof(DesigntimeLicenseContext).IsAssignableFrom(LicenseManager.CurrentContext.GetType())) { LicenseManager.CurrentContext = (LicenseContext) new DesigntimeLicenseContext(); } LicenseManager.LockContext(Asset.licenseManagerLock); try { SceneNode instance = this.InternalCreateInstance(insertionPoint, rect, action); if (instance != null && instance.IsViewObjectValid) { TypeAsset typeAsset = this as TypeAsset; if (typeAsset != null && typeAsset.IsLicensed && licenseManager != null) { string projectPath = instance.ProjectContext.ProjectPath; licenseManager.AddLicensedItem(projectPath, typeAsset.Type.FullName, typeAsset.Type.RuntimeAssembly.FullName); } } return(instance); } finally { LicenseManager.UnlockContext(Asset.licenseManagerLock); } }
public SEPanel() { LicenseManager.Validate(typeof(SEPanel)); EnableDoubleBuffering(); this.FillBrush = new SolidBrush(this.FillColorStart); this.BorderPen = new Pen(this.BorderColor);; }
public SEDataGridView() { LicenseManager.Validate(typeof(SEDataGridView)); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.ResizeRedraw = true; DataGridViewRenderer renderer = new DataGridViewRenderer(this); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); NLicense license = new NLicense("0e826fb6-fd02-bb01-d5d2-840415e30261"); NLicenseManager.Instance.SetLicense(license); NLicenseManager.Instance.LockLicense = true; var lg = new FrmWaiting(); try { if (LicenseManager.Validate(typeof(FrmWaiting), lg).LicenseKey != null) { if (lg.ShowDialog() == DialogResult.OK) { Busi.Common.LogonUser = lg.LogUser; var mainForm = new Forms.MainForm(); Application.Run(mainForm); lg.Close(); } } } catch (LicenseException ex) { if (new Forms.LicenseManager().ShowDialog() == DialogResult.OK) { Application.Exit(); } } }
public SystemHotKeyWPF() { System.Type type = typeof(SystemHotKeyWPF); License license1 = LicenseManager.Validate(type, this); base.Visibility = Visibility.Hidden; }
private BotInputOutput ToHtml(BotInputOutput input) { try { var xml = GetItem(input, "Report"); using (var ms = new MemoryStream(UnicodeEncoding.UTF8.GetBytes(xml))) { HealthcheckData healthcheckData = DataHelper <HealthcheckData> .LoadXml(ms, "bot", null); var endUserReportGenerator = PingCastleFactory.GetEndUserReportGenerator <HealthcheckData>(); var license = LicenseManager.Validate(typeof(Program), new Program()) as ADHealthCheckingLicense; var report = endUserReportGenerator.GenerateReportFile(healthcheckData, license, healthcheckData.GetHumanReadableFileName()); var o = new BotInputOutput(); o.Data = new List <BotData>(); AddData(o, "Status", "OK"); AddData(o, "Report", report); return(o); } } catch (Exception ex) { Console.WriteLine("Exception:" + ex.Message); Console.WriteLine("StackTrace:" + ex.StackTrace); return(ExceptionOutput("Exception during the job " + ex.Message, ex.StackTrace)); } }
public SingleInstanceComponentWPF() { Type type = typeof(SingleInstanceComponentWPF); License license1 = LicenseManager.Validate(type, this); base.Visibility = Visibility.Hidden; }
private static void BeforeSchemaUpgrade(StorageEnvironment storageEnvironment, ServerStore serverStore) { // doing this before the schema upgrade to allow to downgrade in case we cannot start the server using (var contextPool = new TransactionContextPool(storageEnvironment, serverStore.Configuration.Memory.MaxContextSizeToKeep)) { var license = serverStore.LoadLicense(contextPool); if (license == null) { return; } var licenseStatus = LicenseManager.GetLicenseStatus(license); if (licenseStatus.Expiration >= RavenVersionAttribute.Instance.ReleaseDate) { return; } var licenseStorage = new LicenseStorage(); licenseStorage.Initialize(storageEnvironment, contextPool); var errorMessage = $"Cannot start the RavenDB server because the expiration date of this license ({FormattedDateTime(licenseStatus.Expiration ?? DateTime.MinValue)}) " + $"is before the release date of this version ({FormattedDateTime(RavenVersionAttribute.Instance.ReleaseDate)})"; var buildInfo = licenseStorage.GetBuildInfo(); if (buildInfo != null) { errorMessage += $" You can downgrade to the latest build that was working ({buildInfo.FullVersion})"; } throw new LicenseExpiredException(errorMessage);
protected internal override void Setup(FeatureConfigurationContext context) { try { var licenseManager = new LicenseManager(); licenseManager.InitializeLicense(context.Settings.Get <string>(LicenseTextSettingsKey), context.Settings.Get <string>(LicenseFilePathSettingsKey)); context.Container.RegisterSingleton(licenseManager); var licenseExpired = licenseManager.HasLicenseExpired(); if (!licenseExpired) { return; } context.Pipeline.Register("LicenseReminder", new AuditInvalidLicenseBehavior(), "Audits that the message was processed by an endpoint with an expired license"); if (Debugger.IsAttached) { context.Pipeline.Register("LogErrorOnInvalidLicense", new LogErrorOnInvalidLicenseBehavior(), "Logs an error when running in debug mode with an expired license"); } } catch (Exception ex) { //we only log here to prevent licensing issue to abort startup and cause production outages Logger.Fatal("Failed to initialize the license", ex); } }
public static void Main(string[] args) { LicenseManager.AddLicense("67;100-MASUIT", "809739091397182EC1ECEA8770EB4218"); RegisterAutomapper.Excute(); MyHub.Init(); CreateWebHostBuilder(args).Build().Run(); }
public void CanReadValidLicense() { IsValidIfLocalLicenseDoesNotAlreadyExist(); // Assuming test environment can write in one of folders license file may be. using (var path = new TemporaryFile(LicenseManager.GetLicenseFilePath())) { // In test environment there isn't license file/storage then this test must fail. // After this we must discard cached (and empty) license to load the newly created one. Assert.IsNull(LicenseManager.License); Assert.IsFalse(LicenseManager.IsLicenseValid); LicenseManager.Renew(); // Now we prepare a fake license file to check few basics in // LicenseManager class. var contact = ContactFactory.Create <Contact>(); var license = LicenseFactory.Create <License>(contact); license.Features.Add((int)Feature.Example1, 1); LicenseWriter.ToFile(path, license); Assert.IsTrue(LicenseManager.IsLicenseValid); Assert.IsNotNull(LicenseManager.License); Assert.AreEqual(LicenseManager.License.Id, license.Id); Assert.IsTrue(LicenseManager.IsFeatureAvailable(Feature.Example1)); } }
public TaskDialogWPF() { Type type = typeof(TaskDialogWPF); License license1 = LicenseManager.Validate(type, this); base.Visibility = Visibility.Hidden; }
static void Postfix(ref int __result) { if (LicenseManager.IsJobLicenseAcquired(PassLicenses.Passengers1)) { __result += 1; } }
/// <summary> /// Creates a new GA object with default values. /// </summary> public GA() { InitializeComponent(); LicenseManager.Validate(this.GetType(), this); Objective = null; Scaler = new ScalingDelegate(new Scaling.LinearFitnessScaler().Scale); Selector = new SelectionDelegate(Selection.RouletteSelector.Select); Recombinator = new RecombinationDelegate(Recombination.SinglePointCrossover.Recombine); //geneDescriptors = new GeneDescriptor[1]; //geneDescriptors[0] = new BinaryGeneDescriptor(); geneDescriptor = new BinaryGeneDescriptor(); highestObjective = System.Int32.MinValue; lowestObjective = System.Int32.MaxValue; license = LicenseManager.Validate(typeof(GA), this); encodingType = defaultEncodingType; selectionMethod = defaultSelectionMethod; recombinationOperator = defaultRecombinationOperator; mutationOperator = defaultMutationOperator; //PreScaler fitnessScaling = defaultFitnessScaling; }
internal CheckLicenseResult CheckLicenseIsValid() { var license = LicenseManager.FindLicense(); if (license.Details.HasLicenseExpired()) { return(new CheckLicenseResult(false, "License has expired")); } if (!license.Details.ValidForServiceControl) { return(new CheckLicenseResult(false, "This license edition does not include ServiceControl")); } if (ZipInfo.TryReadReleaseDate(out var releaseDate)) { if (license.Details.ReleaseNotCoveredByMaintenance(releaseDate)) { return(new CheckLicenseResult(false, "License does not cover this release of ServiceControl.Upgrade protection expired")); } } else { throw new Exception("Failed to retrieve release date for new version"); } return(new CheckLicenseResult(true)); }
public MyControl() { // Adds Validate to the control's constructor. license = LicenseManager.Validate(typeof(MyControl), this); // Insert code to perform other instance creation tasks here. }
public void LoadPublicKeyFromString() { LicenseManager manager = new LicenseManager(); manager.LoadPublicKeyFromString(TestKeys.PublicKey); Assert.IsNotNull(manager.PublicKey); }
/// <summary> /// /// </summary> /// <param name="maxOnlinePeople">最大在线人数</param> /// <param name="allowAccessFromDomain">安全域</param> /// <param name="fullDuplexChannel">全双工,发送时需调用addSend</param> public SocketAcceptorSync(string payUser, string SERVER_NAME, string allowAccessFromDomain, bool tipMaxConnection) { int payMaxOnline = LicenseManager.getMaxOnlinePeople(payUser, SERVER_NAME); //test //payMaxOnline = 2000; //Console.WriteLine("提示:当前系统授权允许最大" + payMaxOnline.ToString() + "个用户连接"); if (tipMaxConnection) { Console.WriteLine( SR.GetString(SR.The_current_maximum_number_of_online_people, payMaxOnline.ToString()) ); } this._maxOnlinePeople = payMaxOnline; this._allowAccessFromDomain = allowAccessFromDomain; //this._fullDuplexChannel = fullDuplexChannel; this._userList = System.Collections.Hashtable.Synchronized( new System.Collections.Hashtable(payMaxOnline, 0.1f) ); // setPolice(); }
static void ImportLicenseInstall(Session session, MSILogger logger) { logger.Info("Checking for license file"); var licenseFilePropertyValue = session["LICENSEFILE"]; if (string.IsNullOrWhiteSpace(licenseFilePropertyValue)) { return; } logger.Info($"LICENSEFILE: {licenseFilePropertyValue}"); var currentDirectory = session["CURRENTDIRECTORY"]; var licenseFilePath = Environment.ExpandEnvironmentVariables(Path.IsPathRooted(licenseFilePropertyValue) ? licenseFilePropertyValue : Path.Combine(currentDirectory, licenseFilePropertyValue)); logger.Info($"Expanded license filepath to : {licenseFilePropertyValue}"); if (File.Exists(licenseFilePath)) { logger.Info($"File Exists : {licenseFilePropertyValue}"); string errormessage; if (!LicenseManager.TryImportLicense(licenseFilePath, out errormessage)) { logger.Error(errormessage); } } else { logger.Error($"The specified license install file was not found : '{licenseFilePath}'"); } }
private void cmdNext_Click(object sender, EventArgs e) { if (step == 1) { // Going to step 2 pnlStep1.Visible = false; pnlStep2.Visible = true; cmdPrevious.Enabled = true; lblTopTitle.Text = "License Manager - Import License File"; step++; } else if (step == 2) { // Going to step 3 (Verify the license and display the // proper panel) if (txtLicFile.Text.Trim() == "") { MessageBox.Show("Please enter a license file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!File.Exists(txtLicFile.Text)) { MessageBox.Show("The filename entered does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Try to load the license LicenseManager license = null; try { license = new LicenseManager(txtLicFile.Text); } catch { // Go to step 3 failure cmdNext.Text = "&Finish"; pnlStep3Fail.Visible = true; lblTopTitle.Text = "License Manager - Failed to Import License"; step++; return; } // Get the license data and populate the fields lblLicTo.Text = license.LicensedUser; lblLicCompany.Text = license.LicensedCompany; lblLicExpires.Text = ((license.LicenseExpires.Year > 1) ? license.LicenseExpires.ToLongDateString() : "Never"); lblLicRestr.Text = ((license.LicenseLimit == "Unlimited") ? "None" : ("Licensed to " + license.LicenseLimit + " Computer(s)")); lblLicSerial.Text = license.LicenseSerial; // Check the license type switch (license.LicenseSerial.Substring(0, 3)) { case "CWF": lblLicType.Text = "Standard License"; break; case "CWP": lblLicType.Text = "Professional License"; break; case "CPS": lblLicType.Text = "Professional Site License"; break; case "CWM": lblLicType.Text = "Professional Education License"; break; case "CMS": lblLicType.Text = "Professional Education Site License"; break; case "CWD": lblLicType.Text = "Donator Site License"; break; default: lblLicType.Text = "Special License"; break; } // Copy over the license file File.Copy(txtLicFile.Text, Application.StartupPath + "\\license.xml", true); // Display the OK thing cmdNext.Text = "&Finish"; pnlStep3Success.Visible = true; lblTopTitle.Text = "License Manager - Import Successful"; // Set the back and cancel button to disabled cmdCancel.Enabled = false; cmdPrevious.Enabled = false; step++; } else if (step == 3) { // Going to step 4 (Finish) this.Close(); } }