Blog Of Sem: Visual studio Projeni lisanslama olaylari

Visual studio Projeni lisanslama olaylari


Özetle CryptoLicesnsi kur ve crackle sonra aç programı visual studioda proje yeni de refereransa cyrptolicensin kurulduğu klasörden LogicNP.CryptoLicensing.dll ekle. Ve cryptolicense programına geri geç project get validationdan kodunu al.
Google Drive\visual studio\cryptolisans\CryptoLicensingNet2015Enterprise.rar

Aşağıda serili ama tam calısmıyor

            string licOrSerial = "3SNK-JR68-VWR4-CU3U-DK5T-6M4Y-TGNU-W99Z"; // may be entered by user
            CryptoLicense lic = new CryptoLicense("AMAAMACcdnLRtdM/BVep5vzxoSJkHW04yTbB6RBlL3AebAgDpcaAJ5m3ygqP8ueGL1ZQA1EDAAEAAQ==");
            lic.LicenseServiceURL = "<<URL of your license service>>";

            // Try to validate serial and retrieve license against the serial
            SerialValidationResult result = lic.GetLicenseFromSerial(licOrSerial);
            if (result == SerialValidationResult.Failed)
            {
                // 'licOrSerial' is in serial form but validation of serial failed
                MessageBox.Show("Serial Validation Failed");
                return;
            }
            else if (result == SerialValidationResult.NotASerial)
            {
                // 'licOrSerial' is not a serial but may be a license, set lic.LicenseCode and validate it
                lic.LicenseCode = licOrSerial;
            }
            else //if (result == SerialValidationResult.Success)
            {
                // CryptoLicense.GetLicenseFromSerial set the lic.LicenseCode with the retrieved license code
                // validate it
            }
            // Validate license by querying Status property
            if (lic.Status != LicenseStatus.Valid)
            {
                MessageBox.Show("License Validation Failed");
                return;
            }

To start using CryptoLicensing for the licensing and copy-protection of your software, follow these simple steps:
In CryptoLicensing Generator:
  1. Start the CryptoLicensing Generator application from the Start Menu.
  2. Create a new license project : File menu --> Create New Project --> accept default settings by clicking OK button.
  3. Save the license project : File menu --> Save Project.
  4. Get the validation code for your project : Project menu --> Get Validation Key And Code.
  5. Generate a simple license code without any settings : simply click the Generate button. A new license code will be generated and displayed in the bottom textbox.
In Your Software Source Code Project:
  • Reference the LogicNP.CryptoLicensing.dll file from your project. This is the CryptoLicensing validation module. Note: For Silverlight, Windows Phone 7, or other kinds of projects, see Deploying Your Software for the exact assembly to reference.
  • At the top of your code file, add the following namespace declarations:
  using LogicNP.CryptoLicensing;
  • Write simple license validation code as follows:
    
            CryptoLicense lic = new CryptoLicense();
            lic.ValidationKey = "validation key obtained in step #4 above";
            lic.LicenseCode = "license code generated in step #5 above";


            // Validate the license using .Status property
            if (lic.Status != LicenseStatus.Valid)
                throw new Exception("license validation failed");

That's it! Its that simple to start using CryptoLicensing for the licensing of your software.




Further Code Samples
The above code is a very simplistic code. Typically, you will not hard-code a license code in your software in the above manner, but load it as follows:
                       ...
                       ...

            // Load license from the registry
            lic.StorageMode = LicenseStorageMode.ToRegistry;
            if (lic.Load() == false)
                throw new Exception("License could not be loaded");

            // Validate the license using .Status property
            if (lic.Status != LicenseStatus.Valid)
                throw new Exception("license validation failed");

For the load method to succeed, there should be a previously saved license code in the first place. The license code is saved by calling the CryptoLicense.Save method in another part of your software which prompts the user for the license code. If you use the CryptoLicense.ShowEvaluationInfoDialog method to prompt the user for the license code, the dialog will automatically call the Save method for you.

If you are validating licenses requiring communication with the license service, make sure you specify the license service URL before validating the license code as follows:
                       ...
                       ...
            lic.LicenseServiceURL = "http://www.mysite.com/LicenseService/Service.asmx"

            // Validate the license using .Status property
            if (lic.Status != LicenseStatus.Valid)
                throw new Exception("license validation failed");


Further code samples demonstrating a variety of common licensing scenarios can be found in the Samples folder under the installation folder.