├── .gitattributes
├── .gitignore
├── License.txt
├── Licensing.sln
├── README.md
├── deploy
├── AssemblyVersion.cs
├── DevZest.LicenseConsole
│ ├── DevZest.LicenseConsole.nuproj
│ └── Readme.txt
├── DevZest.Licensing
│ ├── DevZest.Licensing.nuproj
│ └── Readme.txt
├── LicensePublishKey.cs
├── Licensing.Deploy.sln
├── NuGetPackageVersion.props
├── VerGen.AssemblyVersion.cs
├── VerGen.NuGetPackageVersion.props
├── VerGen.bat
└── VerGen.ps1
├── docs
├── CNAME
├── api
│ ├── DevZest.Licensing.AssemblyInfo.-ctor.html
│ ├── DevZest.Licensing.AssemblyInfo.AssemblyData.html
│ ├── DevZest.Licensing.AssemblyInfo.AssemblyFileVersion.html
│ ├── DevZest.Licensing.AssemblyInfo.AssemblyVersion.html
│ ├── DevZest.Licensing.AssemblyInfo.GetReleaseDate.html
│ ├── DevZest.Licensing.AssemblyInfo.LicenseItems.html
│ ├── DevZest.Licensing.AssemblyInfo.Product.html
│ ├── DevZest.Licensing.AssemblyInfo.PublicKeyXml.html
│ ├── DevZest.Licensing.AssemblyInfo.ReleaseDate.html
│ ├── DevZest.Licensing.AssemblyInfo.html
│ ├── DevZest.Licensing.AssemblyLicense.GetAssemblyData.html
│ ├── DevZest.Licensing.AssemblyLicense.Validate.html
│ ├── DevZest.Licensing.AssemblyLicense.html
│ ├── DevZest.Licensing.AssemblyLicenseLoaderAttribute.-ctor.html
│ ├── DevZest.Licensing.AssemblyLicenseLoaderAttribute.LoaderType.html
│ ├── DevZest.Licensing.AssemblyLicenseLoaderAttribute.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.EntryAssemblyOnly.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.GetAssemblyLicenseFileName.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.GetTraceMessage.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.ProvideLicense.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.Reset.html
│ ├── DevZest.Licensing.AssemblyLicenseProviderAttribute.html
│ ├── DevZest.Licensing.CachedLicenseProviderAttribute.GetTraceMessage.html
│ ├── DevZest.Licensing.CachedLicenseProviderAttribute.Load.html
│ ├── DevZest.Licensing.CachedLicenseProviderAttribute.ProvideLicense.html
│ ├── DevZest.Licensing.CachedLicenseProviderAttribute.Reset.html
│ ├── DevZest.Licensing.CachedLicenseProviderAttribute.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.-ctor.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.FolderOption.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.Load.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.Name.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.SpecialFolder.html
│ ├── DevZest.Licensing.FileLicenseProviderAttribute.html
│ ├── DevZest.Licensing.FolderOption.html
│ ├── DevZest.Licensing.Freezable-1.IsFrozen.html
│ ├── DevZest.Licensing.Freezable-1.VerifyFrozenAccess.html
│ ├── DevZest.Licensing.Freezable-1.html
│ ├── DevZest.Licensing.IAssemblyLicenseLoader.Load.html
│ ├── DevZest.Licensing.IAssemblyLicenseLoader.html
│ ├── DevZest.Licensing.ILicensePublisher.Publish.html
│ ├── DevZest.Licensing.ILicensePublisher.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.-ctor.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.ApplicationEvidenceType.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.Load.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.Path.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.Scope.html
│ ├── DevZest.Licensing.IsolatedStorageFileLicenseProviderAttribute.html
│ ├── DevZest.Licensing.License.-ctor.html
│ ├── DevZest.Licensing.License.Assembly.html
│ ├── DevZest.Licensing.License.Category.html
│ ├── DevZest.Licensing.License.Company.html
│ ├── DevZest.Licensing.License.Data.html
│ ├── DevZest.Licensing.License.Expiration.html
│ ├── DevZest.Licensing.License.ExpirationDate.html
│ ├── DevZest.Licensing.License.Id.html
│ ├── DevZest.Licensing.License.IsExpired.html
│ ├── DevZest.Licensing.License.IsFrozen.html
│ ├── DevZest.Licensing.License.Item.html
│ ├── DevZest.Licensing.License.Items.html
│ ├── DevZest.Licensing.License.LoadFromXaml.html
│ ├── DevZest.Licensing.License.Product.html
│ ├── DevZest.Licensing.License.Provider.html
│ ├── DevZest.Licensing.License.ProviderData.html
│ ├── DevZest.Licensing.License.SetExpirationDate.html
│ ├── DevZest.Licensing.License.SetUpgradeExpirationDate.html
│ ├── DevZest.Licensing.License.SignedString.html
│ ├── DevZest.Licensing.License.UpgradeExpiration.html
│ ├── DevZest.Licensing.License.UpgradeExpirationDate.html
│ ├── DevZest.Licensing.License.UserCompany.html
│ ├── DevZest.Licensing.License.UserName.html
│ ├── DevZest.Licensing.License.Validate.html
│ ├── DevZest.Licensing.License.html
│ ├── DevZest.Licensing.LicenseClient.-ctor.html
│ ├── DevZest.Licensing.LicenseClient.GetLicense.html
│ ├── DevZest.Licensing.LicenseClient.PublicKeyXmlFromAssembly.html
│ ├── DevZest.Licensing.LicenseClient.html
│ ├── DevZest.Licensing.LicenseError.-ctor.html
│ ├── DevZest.Licensing.LicenseError.Assembly.html
│ ├── DevZest.Licensing.LicenseError.ExceptionMessage.html
│ ├── DevZest.Licensing.LicenseError.License.html
│ ├── DevZest.Licensing.LicenseError.Message.html
│ ├── DevZest.Licensing.LicenseError.Reason.html
│ ├── DevZest.Licensing.LicenseError.html
│ ├── DevZest.Licensing.LicenseErrorReason.html
│ ├── DevZest.Licensing.LicenseException.-ctor.html
│ ├── DevZest.Licensing.LicenseException.Error.html
│ ├── DevZest.Licensing.LicenseException.GetObjectData.html
│ ├── DevZest.Licensing.LicenseException.html
│ ├── DevZest.Licensing.LicenseItem.-ctor.html
│ ├── DevZest.Licensing.LicenseItem.IsFrozen.html
│ ├── DevZest.Licensing.LicenseItem.License.html
│ ├── DevZest.Licensing.LicenseItem.Name.html
│ ├── DevZest.Licensing.LicenseItem.OverrideExpirationDate.html
│ ├── DevZest.Licensing.LicenseItem.Validate.html
│ ├── DevZest.Licensing.LicenseItem.html
│ ├── DevZest.Licensing.LicenseItemAttribute.-ctor.html
│ ├── DevZest.Licensing.LicenseItemAttribute.DescriptionResourceBaseName.html
│ ├── DevZest.Licensing.LicenseItemAttribute.DescriptionResourceName.html
│ ├── DevZest.Licensing.LicenseItemAttribute.GetDescription.html
│ ├── DevZest.Licensing.LicenseItemAttribute.Name.html
│ ├── DevZest.Licensing.LicenseItemAttribute.html
│ ├── DevZest.Licensing.LicenseItemCollection.ClearItems.html
│ ├── DevZest.Licensing.LicenseItemCollection.Item.html
│ ├── DevZest.Licensing.LicenseItemCollection.License.html
│ ├── DevZest.Licensing.LicenseItemCollection.OnCollectionChanged.html
│ ├── DevZest.Licensing.LicenseItemCollection.html
│ ├── DevZest.Licensing.LicenseKey.-ctor.html
│ ├── DevZest.Licensing.LicenseKey.CanConvertFrom.html
│ ├── DevZest.Licensing.LicenseKey.Empty.html
│ ├── DevZest.Licensing.LicenseKey.Equals.html
│ ├── DevZest.Licensing.LicenseKey.GetHashCode.html
│ ├── DevZest.Licensing.LicenseKey.IsEmpty.html
│ ├── DevZest.Licensing.LicenseKey.NewLicenseKey.html
│ ├── DevZest.Licensing.LicenseKey.ToString.html
│ ├── DevZest.Licensing.LicenseKey.html
│ ├── DevZest.Licensing.LicenseKey.op_Equality.html
│ ├── DevZest.Licensing.LicenseKey.op_Inequality.html
│ ├── DevZest.Licensing.LicenseManager.Check.html
│ ├── DevZest.Licensing.LicenseManager.GetLicense.html
│ ├── DevZest.Licensing.LicenseManager.Reset.html
│ ├── DevZest.Licensing.LicenseManager.Validate.html
│ ├── DevZest.Licensing.LicenseManager.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.Assembly.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.Debug.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.DesignMode.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.GetTraceMessage.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.IsFrozen.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.IsTraceEnabled.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.ProvideLicense.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.Reset.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.VerifyFrozenAccess.html
│ ├── DevZest.Licensing.LicenseProviderAttribute.html
│ ├── DevZest.Licensing.LicenseProviderResult.Data.html
│ ├── DevZest.Licensing.LicenseProviderResult.Empty.html
│ ├── DevZest.Licensing.LicenseProviderResult.ErrorMessage.html
│ ├── DevZest.Licensing.LicenseProviderResult.FromErrorMessage.html
│ ├── DevZest.Licensing.LicenseProviderResult.FromLicense.html
│ ├── DevZest.Licensing.LicenseProviderResult.IsEmpty.html
│ ├── DevZest.Licensing.LicenseProviderResult.License.html
│ ├── DevZest.Licensing.LicenseProviderResult.html
│ ├── DevZest.Licensing.LicensePublicKeyAttribute.-ctor.html
│ ├── DevZest.Licensing.LicensePublicKeyAttribute.PublicKey.html
│ ├── DevZest.Licensing.LicensePublicKeyAttribute.html
│ ├── DevZest.Licensing.LicensePublisher.-ctor.html
│ ├── DevZest.Licensing.LicensePublisher.GetLicense.html
│ ├── DevZest.Licensing.LicensePublisher.GetPrivateKeyXml.html
│ ├── DevZest.Licensing.LicensePublisher.PrivateKeyXmlFromSnkFile.html
│ ├── DevZest.Licensing.LicensePublisher.Publish.html
│ ├── DevZest.Licensing.LicensePublisher.html
│ ├── DevZest.Licensing.LicensePublisherResponse.-ctor.html
│ ├── DevZest.Licensing.LicensePublisherResponse.ErrorMessage.html
│ ├── DevZest.Licensing.LicensePublisherResponse.License.html
│ ├── DevZest.Licensing.LicensePublisherResponse.html
│ ├── DevZest.Licensing.MachineLicense.LocalMachineData.html
│ ├── DevZest.Licensing.MachineLicense.Validate.html
│ ├── DevZest.Licensing.MachineLicense.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.-ctor.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.Load.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.RegistryHive.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.SubkeyName.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.ValueName.html
│ ├── DevZest.Licensing.RegistryLicenseProviderAttribute.html
│ ├── DevZest.Licensing.UserLicense.CurrentUserData.html
│ ├── DevZest.Licensing.UserLicense.Validate.html
│ ├── DevZest.Licensing.UserLicense.html
│ ├── DevZest.Licensing.html
│ ├── index.html
│ └── toc.html
├── articles
│ ├── concept.html
│ ├── designing_license_scheme.html
│ ├── diagnostic_tracing_output.html
│ ├── enabling_licensing_for_your_assembly.html
│ ├── extending_dotnet_licensing.html
│ ├── getting_started.html
│ ├── intro.html
│ ├── license_console_application.html
│ ├── programming_license_client.html
│ ├── programming_license_publisher.html
│ ├── programming_licensing.html
│ ├── quickstart_sample.html
│ ├── run_quickstart_sample.html
│ ├── sample_app.html
│ ├── sample_publisher.html
│ ├── samples_and_tools.html
│ └── toc.html
├── favicon.ico
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── images
│ ├── LicenseConsole1.jpg
│ ├── LicenseConsole2.jpg
│ ├── LicenseConsole3.jpg
│ ├── LicenseConsole4.jpg
│ ├── QuickStartEmptySolution.jpg
│ ├── QuickStartSampleApp1_Cs.jpg
│ ├── QuickStartSampleApp1_Vb.jpg
│ ├── QuickStartSampleApp2.jpg
│ ├── QuickStartSampleApp3.jpg
│ ├── QuickStartSampleApp4.jpg
│ ├── QuickStartSampleApp5.jpg
│ ├── QuickStartSampleApp6_Cs.jpg
│ ├── QuickStartSampleApp6_Vb.jpg
│ ├── QuickStartSamplePublisher1_Cs.jpg
│ ├── QuickStartSamplePublisher1_Vb.jpg
│ ├── QuickStartSamplePublisher2.jpg
│ ├── QuickStartSamplePublisher3.jpg
│ ├── QuickStartSamplePublisher4.jpg
│ ├── QuickStartSamplePublisher5.jpg
│ ├── QuickStartSamplePublisher6.jpg
│ ├── QuickStartSamplePublisher7.jpg
│ ├── QuickStartSamplePublisher8_Cs.jpg
│ ├── QuickStartSamplePublisher8_Vb.jpg
│ ├── QuickStartSamplePublisher9_Cs.jpg
│ ├── QuickStartSamplePublisher9_Vb.jpg
│ ├── QuickStartSamplePublisherA_Cs.jpg
│ ├── QuickStartSamplePublisherA_Vb.jpg
│ └── concept_summary.JPG
├── index.html
├── logo.svg
├── manifest.json
├── search-stopwords.json
├── styles
│ ├── docfx.css
│ ├── docfx.js
│ ├── docfx.vendor.css
│ ├── docfx.vendor.js
│ ├── lunr.js
│ ├── lunr.min.js
│ ├── main.css
│ ├── main.js
│ └── search-worker.js
├── toc.html
└── xrefmap.yml
├── docs_src
├── .gitignore
├── api
│ └── .gitignore
├── articles
│ ├── concept.md
│ ├── designing_license_scheme.md
│ ├── diagnostic_tracing_output.md
│ ├── enabling_licensing_for_your_assembly.md
│ ├── extending_dotnet_licensing.md
│ ├── getting_started.md
│ ├── license_console_application.md
│ ├── programming_license_client.md
│ ├── programming_license_publisher.md
│ ├── programming_licensing.md
│ ├── quickstart_sample.md
│ ├── run_quickstart_sample.md
│ ├── sample_app.md
│ ├── sample_publisher.md
│ ├── samples_and_tools.md
│ └── toc.yml
├── docfx.json
├── images
│ ├── LicenseConsole1.jpg
│ ├── LicenseConsole2.jpg
│ ├── LicenseConsole3.jpg
│ ├── LicenseConsole4.jpg
│ ├── QuickStartEmptySolution.jpg
│ ├── QuickStartSampleApp1_Cs.jpg
│ ├── QuickStartSampleApp1_Vb.jpg
│ ├── QuickStartSampleApp2.jpg
│ ├── QuickStartSampleApp3.jpg
│ ├── QuickStartSampleApp4.jpg
│ ├── QuickStartSampleApp5.jpg
│ ├── QuickStartSampleApp6_Cs.jpg
│ ├── QuickStartSampleApp6_Vb.jpg
│ ├── QuickStartSamplePublisher1_Cs.jpg
│ ├── QuickStartSamplePublisher1_Vb.jpg
│ ├── QuickStartSamplePublisher2.jpg
│ ├── QuickStartSamplePublisher3.jpg
│ ├── QuickStartSamplePublisher4.jpg
│ ├── QuickStartSamplePublisher5.jpg
│ ├── QuickStartSamplePublisher6.jpg
│ ├── QuickStartSamplePublisher7.jpg
│ ├── QuickStartSamplePublisher8_Cs.jpg
│ ├── QuickStartSamplePublisher8_Vb.jpg
│ ├── QuickStartSamplePublisher9_Cs.jpg
│ ├── QuickStartSamplePublisher9_Vb.jpg
│ ├── QuickStartSamplePublisherA_Cs.jpg
│ ├── QuickStartSamplePublisherA_Vb.jpg
│ └── concept_summary.JPG
├── index.md
└── toc.yml
├── samples
├── Key.snk
├── LicenseConsole
│ ├── LicenseConsole.Readme.txt
│ ├── LicenseConsole.sln
│ ├── TestComponent
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── TestComponent.cs
│ │ └── TestComponent.csproj
│ ├── TestServer
│ │ ├── Default.aspx
│ │ ├── Default.aspx.cs
│ │ ├── Default.aspx.designer.cs
│ │ ├── LicensePublishService.asmx
│ │ ├── LicensePublishService.asmx.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Publisher.cs
│ │ ├── TestServer.csproj
│ │ └── Web.config
│ ├── TestSignedApp
│ │ ├── AppKey.snk
│ │ ├── Program.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── TestSignedApp.csproj
│ ├── TestUnsignedApp
│ │ ├── Program.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── TestUnsignedApp.csproj
│ └── src
│ │ ├── About.xaml
│ │ ├── About.xaml.cs
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── ChangeProductLicenseValidationError.cs
│ │ ├── ChangeProductLicenseWindow.xaml
│ │ ├── ChangeProductLicenseWindow.xaml.cs
│ │ ├── CheckUpdateResult.cs
│ │ ├── CheckUpdateWindow.xaml
│ │ ├── CheckUpdateWindow.xaml.cs
│ │ ├── ClipboardDistributableLicenseWindow.xaml
│ │ ├── ClipboardDistributableLicenseWindow.xaml.cs
│ │ ├── ClipboardLicenseWindow.xaml
│ │ ├── ClipboardLicenseWindow.xaml.cs
│ │ ├── ClipboardProductLicenseWindow.xaml
│ │ ├── ClipboardProductLicenseWindow.xaml.cs
│ │ ├── EmailLicenseRequestWindow.xaml
│ │ ├── EmailLicenseRequestWindow.xaml.cs
│ │ ├── EnumToBooleanConverter.cs
│ │ ├── GetLicenseWindow.xaml
│ │ ├── GetLicenseWindow.xaml.cs
│ │ ├── Images
│ │ ├── Green.gif
│ │ ├── LicenseConsole.ico
│ │ ├── Red.gif
│ │ └── Yellow.gif
│ │ ├── LicenseAgreement.rtf
│ │ ├── LicenseAgreementWindow.xaml
│ │ ├── LicenseAgreementWindow.xaml.cs
│ │ ├── LicenseConsole.csproj
│ │ ├── LicenseConsole.deploy.csproj
│ │ ├── LicenseConsole.ico
│ │ ├── LicenseConsoleData.cs
│ │ ├── LicenseEntry.cs
│ │ ├── LicenseInfo.cs
│ │ ├── LicenseItemData.cs
│ │ ├── LicenseItemState.cs
│ │ ├── LicenseMethod.cs
│ │ ├── LicenseState.cs
│ │ ├── LicenseType.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── NewVersionAvailableWindow.xaml
│ │ ├── NewVersionAvailableWindow.xaml.cs
│ │ ├── ProductRelease.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ ├── Settings.settings
│ │ └── app.manifest
│ │ ├── SR.Designer.cs
│ │ ├── SR.resx
│ │ ├── Strings.cs
│ │ ├── VersionAndReleaseDateConverter.cs
│ │ └── app.config
└── QuickStart
│ ├── CSharp
│ ├── QuickStart.sln
│ ├── SampleApp
│ │ ├── App.config
│ │ ├── Program.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── SampleApp.csproj
│ └── SamplePublisher
│ │ ├── AsmxPublisher.asmx
│ │ ├── AsmxPublisher.asmx.cs
│ │ ├── Default.aspx
│ │ ├── Default.aspx.cs
│ │ ├── Default.aspx.designer.cs
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── Publisher.cs
│ │ ├── SamplePublisher.csproj
│ │ ├── SvcPublisher.svc
│ │ ├── SvcPublisher.svc.cs
│ │ └── Web.config
│ └── VB
│ ├── QuickStart.sln
│ ├── SampleApp
│ ├── Module1.vb
│ ├── My Project
│ │ ├── Application.Designer.vb
│ │ ├── Application.myapp
│ │ ├── AssemblyInfo.vb
│ │ ├── Resources.Designer.vb
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.vb
│ │ └── Settings.settings
│ ├── SampleApp.vbproj
│ └── app.config
│ └── SamplePublisher
│ ├── AsmxPublisher.asmx
│ ├── AsmxPublisher.asmx.vb
│ ├── Default.aspx
│ ├── Default.aspx.designer.vb
│ ├── Default.aspx.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── MyExtensions
│ │ └── MyWebExtension.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
│ ├── Publisher.vb
│ ├── SamplePublisher.vbproj
│ ├── SvcPublisher.svc
│ ├── SvcPublisher.svc.vb
│ └── Web.config
└── src
├── AssemblyInfo.cs
├── AssemblyLicense.cs
├── AssemblyLicenseLoaderAttribute.cs
├── AssemblyLicenseProviderAttribute.cs
├── CachedLicenseProviderAttribute.cs
├── Dictionary.xml
├── ExceptionMessages.cs
├── FileLicenseProviderAttribute.cs
├── FolderOption.cs
├── Freezable.cs
├── GlobalSuppressions.cs
├── IAssemblyLicenseLoader.cs
├── ILicensePublisher.cs
├── IsolatedStorageFileLicenseProviderAttribute.cs
├── License.cs
├── LicenseClient.cs
├── LicenseError.cs
├── LicenseErrorReason.cs
├── LicenseException.cs
├── LicenseItem.cs
├── LicenseItemAttribute.cs
├── LicenseItemCollection.cs
├── LicenseKey.cs
├── LicenseManager.RsaKey.cs
├── LicenseManager.cs
├── LicenseProviderAttribute.cs
├── LicenseProviderResult.cs
├── LicensePublicKeyAttribute.cs
├── LicensePublisher.cs
├── LicensePublisherResponse.cs
├── Licensing.csproj
├── Licensing.deploy.csproj
├── MachineLicense.cs
├── Messages.cs
├── Properties
└── AssemblyInfo.cs
├── RegistryLicenseProviderAttribute.cs
├── Rsa.BigInteger.cs
├── Rsa.cs
├── SR.Designer.cs
├── SR.resx
├── UserLicense.cs
├── XamlWriter.NamespaceCache.cs
├── XamlWriter.NamespaceMap.cs
├── XamlWriter.cs
└── app.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/License.txt:
--------------------------------------------------------------------------------
1 | Copyright DevZest (http://www.devzest.com)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DevZest.Licensing
2 |
3 | A lightweight yet comprehensive licensing solution for Microsoft .Net platform. Protect your .Net components and applications from illegal use.
4 |
5 | This solution, provided as a .Net component, provides the same level security as signing your .Net assembly, and gives you utmost control and flexibility.
6 |
7 | [](https://www.nuget.org/packages/DevZest.Licensing)
8 |
9 | For more details, check out [https://licensing.devzest.com/](http://licensing.devzest.com/).
--------------------------------------------------------------------------------
/deploy/AssemblyVersion.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | [assembly: AssemblyVersion("3.0.0.0")]
4 | [assembly: AssemblyFileVersion("3.0.6248.0")]
--------------------------------------------------------------------------------
/deploy/DevZest.LicenseConsole/DevZest.LicenseConsole.nuproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 |
8 |
9 | Release
10 | AnyCPU
11 |
12 |
13 |
14 | c2ef7679-6f18-4747-9878-79d59e16b2bd
15 |
16 |
17 | $(MSBuildExtensionsPath)\NuProj\
18 |
19 |
20 |
21 | DevZest.LicenseConsole
22 | DevZest.LicenseConsole
23 | DevZest
24 | DevZest
25 | Tools only package contains compiled LicenseConsole application.
26 | Tools only package contains compiled LicenseConsole application.
27 |
28 |
29 |
30 |
31 |
32 |
33 | Copyright © DevZest
34 | DevZest LicenseConsole
35 | true
36 |
37 |
38 |
39 | tools\DevZest.Licensing.dll
40 |
41 |
42 | tools\LicenseConsole.exe
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/deploy/DevZest.LicenseConsole/Readme.txt:
--------------------------------------------------------------------------------
1 | DevZest.LicenseConsole:
2 | Tools only package contains compiled LicenseConsole.exe application.
3 |
4 | Source code available at:
5 | https://github.com/DevZest/Licensing.Samples
6 |
7 | Copyright © DevZest, All Rights Reserved.
--------------------------------------------------------------------------------
/deploy/DevZest.Licensing/DevZest.Licensing.nuproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 |
8 |
9 | Release
10 | AnyCPU
11 |
12 |
13 |
14 | 3e225c06-f12d-45a7-bedb-a0919be2cc82
15 |
16 |
17 | $(MSBuildExtensionsPath)\NuProj\
18 |
19 |
20 |
21 | DevZest.Licensing
22 | DevZest.Licensing
23 | DevZest
24 | DevZest
25 | A lightweight yet comprehensive licensing solution for Microsoft .Net platform. Protect your .Net components and applications from illegal use.
26 | A lightweight yet comprehensive licensing solution for Microsoft .Net platform. Protect your .Net components and applications from illegal use.
27 |
28 |
29 | https://github.com/devzest/licensing
30 | https://opensource.org/licenses/mit-license.php
31 | Copyright © DevZest
32 | DevZest Licensing
33 | false
34 | true
35 |
36 |
37 |
38 | Documentation.chm
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/deploy/DevZest.Licensing/Readme.txt:
--------------------------------------------------------------------------------
1 | DevZest .Net Licensing a lightweight yet comprehensive licensing solution for Microsoft .Net platform.
2 | Protect your .Net components and applications from illegal use.
3 |
4 | See Documentation.chm for more information.
5 |
6 | Source code available at:
7 | https://github.com/DevZest/Licensing
8 |
9 | Samples source code available at:
10 | https://github.com/DevZest/Licensing.Samples
11 |
12 | The MIT License:
13 |
14 | Copyright DevZest (http://www.devzest.com)
15 |
16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/deploy/LicensePublishKey.cs:
--------------------------------------------------------------------------------
1 | using DevZest.Licensing;
2 |
3 | [assembly: LicensePublicKey("0024000004800000940000000602000000240000525341310004000001000100ed58bddcb7bb19" +
4 | "9ed08c99bd83f732f26d49db4be3ea11c03a0c01bc0774bdcf5bbd3f00fd853f761598dd28489d" +
5 | "9849a27e9eb901bb227d2c88b6644bd8e1b1453d021ea6b724995bdc5f839a608a5aa98f2ba6c6" +
6 | "02d25eaed7147e8046db369ad5ff0847423d926526176ff43902ee012d98f7010a598744834210" +
7 | "7eb632b8")]
8 |
--------------------------------------------------------------------------------
/deploy/Licensing.Deploy.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Licensing.deploy", "..\src\Licensing.deploy.csproj", "{B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LicenseConsole.deploy", "..\samples\LicenseConsole\src\LicenseConsole.deploy.csproj", "{FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}"
9 | EndProject
10 | Project("{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}") = "Documentation", "..\doc\Documentation.shfbproj", "{BE414430-71B3-4543-A8BB-978EBBBE1D90}"
11 | ProjectSection(ProjectDependencies) = postProject
12 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50} = {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}
13 | EndProjectSection
14 | EndProject
15 | Project("{FF286327-C783-4F7A-AB73-9BCBAD0D4460}") = "DevZest.Licensing", "DevZest.Licensing\DevZest.Licensing.nuproj", "{3E225C06-F12D-45A7-BEDB-A0919BE2CC82}"
16 | ProjectSection(ProjectDependencies) = postProject
17 | {BE414430-71B3-4543-A8BB-978EBBBE1D90} = {BE414430-71B3-4543-A8BB-978EBBBE1D90}
18 | {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24} = {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}
19 | EndProjectSection
20 | EndProject
21 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{08D7B4D2-4B90-4C1B-80A4-C4C8DA019EEC}"
22 | ProjectSection(SolutionItems) = preProject
23 | AssemblyVersion.cs = AssemblyVersion.cs
24 | LicensePublishKey.cs = LicensePublishKey.cs
25 | NuGetPackageVersion.props = NuGetPackageVersion.props
26 | VerGen.AssemblyVersion.cs = VerGen.AssemblyVersion.cs
27 | VerGen.bat = VerGen.bat
28 | VerGen.NuGetPackageVersion.props = VerGen.NuGetPackageVersion.props
29 | VerGen.ps1 = VerGen.ps1
30 | EndProjectSection
31 | EndProject
32 | Global
33 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
34 | Debug|Any CPU = Debug|Any CPU
35 | Release|Any CPU = Release|Any CPU
36 | EndGlobalSection
37 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
38 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.Build.0 = Release|Any CPU
42 | {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {FCB3AB4C-9CC6-476C-ABA4-679FF6D41F24}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {BE414430-71B3-4543-A8BB-978EBBBE1D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {BE414430-71B3-4543-A8BB-978EBBBE1D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {BE414430-71B3-4543-A8BB-978EBBBE1D90}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {BE414430-71B3-4543-A8BB-978EBBBE1D90}.Release|Any CPU.Build.0 = Release|Any CPU
50 | {3E225C06-F12D-45A7-BEDB-A0919BE2CC82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {3E225C06-F12D-45A7-BEDB-A0919BE2CC82}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {3E225C06-F12D-45A7-BEDB-A0919BE2CC82}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 | {3E225C06-F12D-45A7-BEDB-A0919BE2CC82}.Release|Any CPU.Build.0 = Release|Any CPU
54 | EndGlobalSection
55 | GlobalSection(SolutionProperties) = preSolution
56 | HideSolutionNode = FALSE
57 | EndGlobalSection
58 | EndGlobal
59 |
--------------------------------------------------------------------------------
/deploy/NuGetPackageVersion.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3.0.0
5 |
6 |
--------------------------------------------------------------------------------
/deploy/VerGen.AssemblyVersion.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | [assembly: AssemblyVersion("$ASSEMBLY_VERSION$")]
4 | [assembly: AssemblyFileVersion("$ASSEMBLY_FILE_VERSION$")]
--------------------------------------------------------------------------------
/deploy/VerGen.NuGetPackageVersion.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $PACKAGE_VERSION$
5 |
6 |
--------------------------------------------------------------------------------
/deploy/VerGen.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | setlocal
3 | SET PARAM_VERSION="-version %1"
4 | if "%1"=="" (SET PARAM_VERSION=)
5 | SET PARAM_ADDTIONAL_LABEL="-additionalLabel %2"
6 | if "%2"=="" (SET PARAM_ADDTIONAL_LABEL=)
7 | @powershell -NoProfile -ExecutionPolicy unrestricted -Command "%~dp0VerGen.ps1" %PARAM_VERSION% %PARAM_ADDTIONAL_LABEL%
8 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | licensing.devzest.com
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/docs/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/docs/images/LicenseConsole1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/LicenseConsole1.jpg
--------------------------------------------------------------------------------
/docs/images/LicenseConsole2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/LicenseConsole2.jpg
--------------------------------------------------------------------------------
/docs/images/LicenseConsole3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/LicenseConsole3.jpg
--------------------------------------------------------------------------------
/docs/images/LicenseConsole4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/LicenseConsole4.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartEmptySolution.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartEmptySolution.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp1_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp1_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp1_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp1_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp2.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp3.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp4.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp5.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp6_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp6_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSampleApp6_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSampleApp6_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher1_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher1_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher1_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher1_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher2.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher3.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher4.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher5.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher6.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher7.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher8_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher8_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher8_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher8_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher9_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher9_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisher9_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisher9_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisherA_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisherA_Cs.jpg
--------------------------------------------------------------------------------
/docs/images/QuickStartSamplePublisherA_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/QuickStartSamplePublisherA_Vb.jpg
--------------------------------------------------------------------------------
/docs/images/concept_summary.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/images/concept_summary.JPG
--------------------------------------------------------------------------------
/docs/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
26 |
--------------------------------------------------------------------------------
/docs/search-stopwords.json:
--------------------------------------------------------------------------------
1 | [
2 | "a",
3 | "able",
4 | "about",
5 | "across",
6 | "after",
7 | "all",
8 | "almost",
9 | "also",
10 | "am",
11 | "among",
12 | "an",
13 | "and",
14 | "any",
15 | "are",
16 | "as",
17 | "at",
18 | "be",
19 | "because",
20 | "been",
21 | "but",
22 | "by",
23 | "can",
24 | "cannot",
25 | "could",
26 | "dear",
27 | "did",
28 | "do",
29 | "does",
30 | "either",
31 | "else",
32 | "ever",
33 | "every",
34 | "for",
35 | "from",
36 | "get",
37 | "got",
38 | "had",
39 | "has",
40 | "have",
41 | "he",
42 | "her",
43 | "hers",
44 | "him",
45 | "his",
46 | "how",
47 | "however",
48 | "i",
49 | "if",
50 | "in",
51 | "into",
52 | "is",
53 | "it",
54 | "its",
55 | "just",
56 | "least",
57 | "let",
58 | "like",
59 | "likely",
60 | "may",
61 | "me",
62 | "might",
63 | "most",
64 | "must",
65 | "my",
66 | "neither",
67 | "no",
68 | "nor",
69 | "not",
70 | "of",
71 | "off",
72 | "often",
73 | "on",
74 | "only",
75 | "or",
76 | "other",
77 | "our",
78 | "own",
79 | "rather",
80 | "said",
81 | "say",
82 | "says",
83 | "she",
84 | "should",
85 | "since",
86 | "so",
87 | "some",
88 | "than",
89 | "that",
90 | "the",
91 | "their",
92 | "them",
93 | "then",
94 | "there",
95 | "these",
96 | "they",
97 | "this",
98 | "tis",
99 | "to",
100 | "too",
101 | "twas",
102 | "us",
103 | "wants",
104 | "was",
105 | "we",
106 | "were",
107 | "what",
108 | "when",
109 | "where",
110 | "which",
111 | "while",
112 | "who",
113 | "whom",
114 | "why",
115 | "will",
116 | "with",
117 | "would",
118 | "yet",
119 | "you",
120 | "your"
121 | ]
122 |
--------------------------------------------------------------------------------
/docs/styles/main.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs/styles/main.css
--------------------------------------------------------------------------------
/docs/styles/main.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
2 |
--------------------------------------------------------------------------------
/docs/styles/search-worker.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | importScripts('lunr.min.js');
3 |
4 | var lunrIndex;
5 |
6 | var stopWords = null;
7 | var searchData = {};
8 |
9 | lunr.tokenizer.seperator = /[\s\-\.]+/;
10 |
11 | var stopWordsRequest = new XMLHttpRequest();
12 | stopWordsRequest.open('GET', '../search-stopwords.json');
13 | stopWordsRequest.onload = function () {
14 | if (this.status != 200) {
15 | return;
16 | }
17 | stopWords = JSON.parse(this.responseText);
18 | buildIndex();
19 | }
20 | stopWordsRequest.send();
21 |
22 | var searchDataRequest = new XMLHttpRequest();
23 |
24 | searchDataRequest.open('GET', '../index.json');
25 | searchDataRequest.onload = function () {
26 | if (this.status != 200) {
27 | return;
28 | }
29 | searchData = JSON.parse(this.responseText);
30 |
31 | buildIndex();
32 |
33 | postMessage({ e: 'index-ready' });
34 | }
35 | searchDataRequest.send();
36 |
37 | onmessage = function (oEvent) {
38 | var q = oEvent.data.q;
39 | var hits = lunrIndex.search(q);
40 | var results = [];
41 | hits.forEach(function (hit) {
42 | var item = searchData[hit.ref];
43 | results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords });
44 | });
45 | postMessage({ e: 'query-ready', q: q, d: results });
46 | }
47 |
48 | function buildIndex() {
49 | if (stopWords !== null && !isEmpty(searchData)) {
50 | lunrIndex = lunr(function () {
51 | this.pipeline.remove(lunr.stopWordFilter);
52 | this.ref('href');
53 | this.field('title', { boost: 50 });
54 | this.field('keywords', { boost: 20 });
55 |
56 | for (var prop in searchData) {
57 | if (searchData.hasOwnProperty(prop)) {
58 | this.add(searchData[prop]);
59 | }
60 | }
61 |
62 | var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords);
63 | lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter');
64 | this.pipeline.add(docfxStopWordFilter);
65 | this.searchPipeline.add(docfxStopWordFilter);
66 | });
67 | }
68 | }
69 |
70 | function isEmpty(obj) {
71 | if(!obj) return true;
72 |
73 | for (var prop in obj) {
74 | if (obj.hasOwnProperty(prop))
75 | return false;
76 | }
77 |
78 | return true;
79 | }
80 | })();
81 |
--------------------------------------------------------------------------------
/docs/toc.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs_src/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # folder #
3 | ###############
4 | /**/DROP/
5 | /**/TEMP/
6 | /**/packages/
7 | /**/bin/
8 | /**/obj/
9 | _site
10 | /nuget_packages
11 |
--------------------------------------------------------------------------------
/docs_src/api/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # temp file #
3 | ###############
4 | *.yml
5 | .manifest
6 |
--------------------------------------------------------------------------------
/docs_src/articles/diagnostic_tracing_output.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: diagnostic_tracing_output
3 | ---
4 |
5 | # Diagnostic Tracing Output
6 |
7 | You can enable tracing to help diagnose problems for specified license provider or all license providers globally. .Net Licensing utilizes standard .Net application tracing. Once tracing is enabled, the tracing output will be displayed in the debug output window by default. You can also determine where you want the tracing output to appear by adding/removing the appropriate listeners. For more information, see .Net Framework documentation.
8 |
9 | >[!Note]
10 | >Enabling tracing may impact the performance. Disable tracing after you finished the troubleshooting.
11 |
12 | ## Enable Tracing for Specified License Provider
13 |
14 | To enable tracing for specified license provider, set the license provider's `Debug` property to true:
15 |
16 | ```csharp
17 | [assembly: FileLicenseProvider(Debug=true)]
18 | ```
19 |
20 | ```vb
21 |
22 | ```
23 |
24 | ## Enable Tracing for All License Providers
25 |
26 | To enable tracing for all license providers, add the following section to your application configuration file:
27 |
28 | ```xml
29 |
30 |
31 |
32 |
33 |
34 | ```
--------------------------------------------------------------------------------
/docs_src/articles/enabling_licensing_for_your_assembly.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: enabling_licensing_for_your_assembly
3 | ---
4 |
5 | # Enabling Licensing for Your Assembly
6 |
7 | The following needs to be done to enable licensing for your assembly:
8 |
9 | ## Sign Your Assembly
10 |
11 | Your assembly must be signed with a strong name before enabling licensing. For more information on how to sign an assembly, refer to the documentation of .Net Framework SDK.
12 |
13 | ## Apply LicensePublicKeyAttribute (Partial Trust Only)
14 |
15 | [FileIOPermission](https://docs.microsoft.com/en-us/dotnet/api/system.security.permissions.fileiopermission) is required to get the public key of the assembly. If you plan to distribute your assembly running under partial trust, you need to declare the @DevZest.Licensing.LicensePublicKeyAttribute for your assembly:
16 |
17 | ```csharp
18 | [assembly: LicensePublicKey("0024000004800000940000000602000000240000525341310004000001000100ed58bddcb7bb199ed08c99bd83f732f26d49db4be3ea11c03a0c01bc0774bdcf5bbd3f00fd853f761598dd28489d9849a27e9eb901bb227d2c88b6644bd8e1b1453d021ea6b724995bdc5f839a608a5aa98f2ba6c602d25eaed7147e8046db369ad5ff0847423d926526176ff43902ee012d98f7010a5987448342107eb632b8")]
19 | ```
20 |
21 | ```vb
22 |
23 | ```
24 |
25 | Use the command line `sn.exe` utility to get the public key string from an signed assembly:
26 |
27 | ```powershell
28 | sn -Tp assemblyFile
29 | ```
30 |
31 | ## Apply LicenseProviderAttribute
32 |
33 | You must apply one or more @DevZest.Licensing.LicenseProviderAttribute to specify where the license can be retrieved for your assembly. What attributes to be used should be determined when you [Designing License Scheme](xref:designing_license_scheme). For example, .Net Licensing itself may have the following license providers declared:
34 |
35 | ```csharp
36 | [assembly: RegistryLicenseProvider(@"Software\DevZest\.Net Licensing\", "RuntimeLicense")]
37 | [assembly: AssemblyLicenseProvider(EntryAssemblyOnly=false)]
38 | ```
39 |
40 | ```vb
41 |
42 |
43 | ```
44 |
45 | .Net Licensing will attempt to load the evaluation or developer license from "RuntimeLicense" value under registry key "HKLM\Software\DevZest\.Net Licensing\X.x", where "X.x" stands for the major and minor version of DevZest.Licensing.dll. If the evaluation or developer license can not be found, it will try to look up a distributable license from the chain of caller assembly.
46 |
47 | ## Call LicenseManager Method
48 |
49 | You can then call [LicenseManager.Validate](xref:DevZest.Licensing.LicenseManager.Validate*) or [LicenseManager.Check](xref:DevZest.Licensing.LicenseManager.Check*) to determine whether a valid license can be granted for your assembly:
50 |
51 | ```csharp
52 | LicenseManager.Validate("Your License Item Name");
53 | ```
54 |
55 | ```vb
56 | LicenseManager.Validate("Your License Item Name")
57 | ```
58 |
59 | The [LicenseManager.Validate](xref:DevZest.Licensing.LicenseManager.Validate*) method throws a @DevZest.Licensing.LicenseException when a valid license cannot be granted; the [LicenseManager.Check](xref:DevZest.Licensing.LicenseManager.Check*) method does not.
--------------------------------------------------------------------------------
/docs_src/articles/extending_dotnet_licensing.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: extending_dotnet_licensing
3 | ---
4 |
5 | # Extending .Net Licensing
6 |
7 | The default implementation of .Net Licensing can meet most of your requirements, however you still have the freedom to extend this component easily by developing custom license, license item or license provider.
8 |
9 | ## Custom License/License Item
10 |
11 | To develop custom license, derive your class from @DevZest.Licensing.License class and override [Validate](xref:DevZest.Licensing.License#DevZest_Licensing_License_Validate) method.
12 |
13 | To develop custom license item, derive your class from @DevZest.Licensing.LicenseItem class and override [Validate](xref:DevZest.Licensing.LicenseItem#DevZest_Licensing_LicenseItem_Validate) method.
14 |
15 | Your class should:
16 |
17 | Be XAML friendly. Since .Net Licensing uses XAML to serialize/deserialize license and license item object, your class must be XAML friendly. The following are some rules to writing a XAML friendly class:
18 |
19 | - Appropriate namespaces
20 | - Public, default constructors
21 | - Public properties for everything you want to expose to the outside world
22 | - Collections are usually read-only properties
23 | - Type converters when .NET can't handle the conversion itself
24 |
25 | For more information, see XAML documentation.
26 |
27 | ## Custom License Provider
28 |
29 | Call [VerifyFrozenAccess](xref:DevZest.Licensing.LicenseProviderAttribute.VerifyFrozenAccess*) method in all the public methods and property setters. Before performing the validation on the License or License Item object, the license provider seals the object and any attempt to modify the object throws an InvalidOperationException. Your derived classes should respect this rule for consistency.
--------------------------------------------------------------------------------
/docs_src/articles/getting_started.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: getting_started
3 | ---
4 |
5 | # Getting Started
6 |
7 | It's pretty straightforward to get started with .Net Licensing:
8 |
9 | - Create a project in Visual Studio or other IDE, targeting .Net Framework 3.0 or later;
10 | - Add nuget package [DevZest.Licensing](https://www.nuget.org/packages/DevZest.Licensing/) to your project.
11 | - Documentation available: [Programming Guide](xref:getting_started) and [Class Library](xref:DevZest.Licensing)
12 | - Source code available: [https://github.com/DevZest/Licensing](https://github.com/DevZest/Licensing).
13 | - Samples available: [https://github.com/DevZest/Licensing.Samples](https://github.com/DevZest/Licensing.Samples).
--------------------------------------------------------------------------------
/docs_src/articles/programming_licensing.md:
--------------------------------------------------------------------------------
1 | # Programming .Net Licensing
2 |
3 | This page contains links to information of programming .Net Licensing:
4 |
5 | - @concept
6 | - @designing_license_scheme
--------------------------------------------------------------------------------
/docs_src/articles/quickstart_sample.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: quickstart_sample
3 | ---
4 |
5 | # QuickStart Sample
6 |
7 | ## Create an empty QuickStart Solution in Visual Studio 2008
8 |
9 | Open `Visual Studio 2008`, select menu `File` -> `New` -> `Project...`:
10 |
11 | 
12 |
13 | In left side `Project types`, select `Other Project Types` -> `Visual Studio Solutions`, then select `Blank Solution` in Templates. Enter `QuickStart` as Name:
14 |
15 | Click `OK` button, an empty solution named `QuickStart` created.
16 |
17 | ## Create a new .snk key pair file
18 |
19 | 1. Open Visual Studio 2008 Command Prompt from the start menu: `Microsoft Visual Studio 2008` -> `Visual Studio Tools`.
20 | 2. Change the current directory to the directory where the empty solution was created.
21 | 3. Enter the following command to generate a new .snk file:
22 | ```powershell
23 | sn -k key.snk
24 | ```
25 | 4. Verify a new file named `key.snk` created in the directory where the empty solution was created.
26 |
27 | ## Next Steps
28 |
29 | - @sample_publisher
30 | - @sample_app
31 | - @run_quickstart_sample
--------------------------------------------------------------------------------
/docs_src/articles/run_quickstart_sample.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: run_quickstart_sample
3 | ---
4 |
5 | # Run QuickStart Sample
6 |
7 | This walk-through runs the QuickStart sample previously created.
8 |
9 | 1. Enable debugging in the web server, by changing `Web.config` of `SamplePublisher` project:
10 | ```xml
11 |
12 | ...
13 |
14 | ...
15 |
16 | ...
17 |
18 | ...
19 |
20 | ```
21 | 2. Set `SampleApp` as startup project by right clicking `SampleApp` project, then select `Set as StartUp Project`.
22 | 3. Press F5 to run the application.
--------------------------------------------------------------------------------
/docs_src/articles/samples_and_tools.md:
--------------------------------------------------------------------------------
1 | ---
2 | uid: samples_and_tools
3 | ---
4 |
5 | # Samples and Tools
6 |
7 | This page contains samples and tools for .Net Licensing product.
8 |
9 | - @quickstart_sample
10 | - @license_console_application
--------------------------------------------------------------------------------
/docs_src/articles/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Getting Started
2 | href: getting_started.md
3 | - name: Programming .Net Licensing
4 | href: programming_licensing.md
5 | items:
6 | - name: Concept
7 | href: concept.md
8 | - name: Designing License Scheme
9 | href: designing_license_scheme.md
10 | - name: Programming License Publisher
11 | href: programming_license_publisher.md
12 | - name: Programming License Client
13 | href: programming_license_client.md
14 | - name: Enabling Licensing for Your Assembly
15 | href: enabling_licensing_for_your_assembly.md
16 | - name: Extending .Net Licensing
17 | href: extending_dotnet_licensing.md
18 | - name: Diagnostic Tracing Output
19 | href: diagnostic_tracing_output.md
20 | - name: Samples and Tools
21 | href: samples_and_tools.md
22 | items:
23 | - name: QuickStart Sample
24 | href: quickstart_sample.md
25 | items:
26 | - name: SamplePublisher
27 | href: sample_publisher.md
28 | - name: SampleApp
29 | href: sample_app.md
30 | - name: Run QuickStart Sample
31 | href: run_quickstart_sample.md
32 | - name: License Console Application
33 | href: license_console_application.md
34 |
--------------------------------------------------------------------------------
/docs_src/docfx.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": [
3 | {
4 | "src": [
5 | {
6 | "cwd": "../",
7 | "files": [
8 | "src/Licensing.csproj"
9 | ]
10 | }
11 | ],
12 | "dest": "api",
13 | "disableGitFeatures": false,
14 | "disableDefaultFilter": false
15 | }
16 | ],
17 | "build": {
18 | "content": [
19 | {
20 | "files": [
21 | "api/**.yml",
22 | "api/index.md"
23 | ]
24 | },
25 | {
26 | "files": [
27 | "articles/**.md",
28 | "articles/**/toc.yml",
29 | "toc.yml",
30 | "*.md"
31 | ]
32 | }
33 | ],
34 | "resource": [
35 | {
36 | "files": [
37 | "images/**"
38 | ]
39 | }
40 | ],
41 | "overwrite": [
42 | {
43 | "files": [
44 | "apidoc/**.md"
45 | ],
46 | "exclude": [
47 | "obj/**",
48 | "../docs/**"
49 | ]
50 | }
51 | ],
52 | "dest": "../docs",
53 | "globalMetadata": {
54 | "_appFooter": "Copyright © Weifen Luo | DevZest"
55 | },
56 | "globalMetadataFiles": [],
57 | "fileMetadataFiles": [],
58 | "template": [
59 | "default",
60 | "nuget_packages/memberpage.2.40.4/content"
61 | ],
62 | "postProcessors": [],
63 | "markdownEngineName": "markdig",
64 | "noLangKeyword": false,
65 | "keepFileLink": false,
66 | "cleanupCacheHistory": false,
67 | "disableGitFeatures": false
68 | }
69 | }
--------------------------------------------------------------------------------
/docs_src/images/LicenseConsole1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/LicenseConsole1.jpg
--------------------------------------------------------------------------------
/docs_src/images/LicenseConsole2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/LicenseConsole2.jpg
--------------------------------------------------------------------------------
/docs_src/images/LicenseConsole3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/LicenseConsole3.jpg
--------------------------------------------------------------------------------
/docs_src/images/LicenseConsole4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/LicenseConsole4.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartEmptySolution.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartEmptySolution.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp1_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp1_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp1_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp1_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp2.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp3.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp4.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp5.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp6_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp6_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSampleApp6_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSampleApp6_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher1_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher1_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher1_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher1_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher2.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher3.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher4.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher5.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher6.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher7.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher8_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher8_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher8_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher8_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher9_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher9_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisher9_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisher9_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisherA_Cs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisherA_Cs.jpg
--------------------------------------------------------------------------------
/docs_src/images/QuickStartSamplePublisherA_Vb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/QuickStartSamplePublisherA_Vb.jpg
--------------------------------------------------------------------------------
/docs_src/images/concept_summary.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/docs_src/images/concept_summary.JPG
--------------------------------------------------------------------------------
/docs_src/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Programming Guide
2 | href: articles/
3 | - name: Class Library
4 | href: api/DevZest.Licensing.yml
5 |
6 |
--------------------------------------------------------------------------------
/samples/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/Key.snk
--------------------------------------------------------------------------------
/samples/LicenseConsole/LicenseConsole.Readme.txt:
--------------------------------------------------------------------------------
1 | The LicenseConsole solution contains the following projects:
2 |
3 | LicenseConsole WPF application providing UI to manage product and distributable license for components.
4 | TestServer ASP.Net application providing license publisher web service.
5 | TestComponent Class library protected by .Net Licensing.
6 | TestSignedApp Console application signed with strong name, referencing TestComponent.
7 | TestUnsignedApp Console application not signed with strong name, referencing TestComponent.
8 |
9 | To test the product license:
10 | 1. Launch TestServer and LicenseConsole;
11 | 2. Obtain an evaluation or paid license through License Console UI. For paid license, any valid license key is acceptable, for example: M48KX-HZ6H4-W3XRG-7PL6G-QZN92;
12 | 3. Run TestSignedApp and TestUnsignedApp, both output will indicate the TestComponent is licensed successfully.
13 |
14 | To test the distributable license for TestSignedApp:
15 | 1. Launch TestServer and LicenseConsole;
16 | 2. Disable product license through License Console UI by clicking "Disable" button;
17 | 3. Run TestSignedApp application, the output will indicate a valid license cannot be granted to TestComponenet;
18 | 4. Through License Console UI, get a distributable license for TestSignedApp.exe, and save the distributable license as embedded resource of TestSignedApp project;
19 | 5. Rebuild TestSignedApp project;
20 | 6. Run TestSignedApp application, the output will indicate the TestComponent is licensed successfully.
21 |
22 | To test the distributable license for TestUnsignedApp:
23 | 1. Launch TestServer and LicenseConsole;
24 | 2. Disable product license through License Console UI by clicking "Disable" button;
25 | 3. Run TestUnsignedApp application, the output will indicate a valid license cannot be granted to TestComponenet;
26 | 4. Through License Console UI, get a distributable license for TestUnsignedApp.exe, and save the distributable license to the output directory of TestUnsignedApp project;
27 | 5. Run TestUnsignedApp application, the output will indicate the TestComponent is licensed successfully.
28 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestComponent/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using DevZest.Licensing;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("TestComponent")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("TestComponent")]
14 | [assembly: AssemblyCopyright("Copyright © 2009")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("50480436-98b4-41ca-a8d1-b95505c55b98")]
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestComponent/TestComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using DevZest.Licensing;
4 |
5 | [assembly: AssemblyVersion("1.0.0.0")]
6 | [assembly: AssemblyFileVersion("1.0.3525.0")]
7 |
8 | // This TestComponent is expecting license from two places:
9 | // 1. The product license from local file : %LocalAppData%DevZest\LicenseConsole\TestComponent\License.txt;
10 | // 2. The distributable license from calling assembly.
11 | [assembly: FileLicenseProvider(FolderOption = FolderOption.EnvironmentSpecial,
12 | SpecialFolder = Environment.SpecialFolder.LocalApplicationData,
13 | Name = @"DevZest\LicenseConsole\TestComponent\RuntimeLicense.txt")]
14 | [assembly: AssemblyLicenseProvider(EntryAssemblyOnly = false)]
15 |
16 | // This TestComponent has two LicenseItems: Feature1 and Feature2
17 | [assembly: LicenseItem("Feature1")]
18 | [assembly: LicenseItem("Feature2")]
19 |
20 |
21 | namespace TestComponent
22 | {
23 | public class MyComponent
24 | {
25 | public static void Feature1()
26 | {
27 | CheckLicense("Feature1");
28 | }
29 |
30 | public static void Feature2()
31 | {
32 | CheckLicense("Feature2");
33 | }
34 |
35 | static void CheckLicense(string licenseItem)
36 | {
37 | LicenseError error = LicenseManager.Check(licenseItem);
38 | if (error == null)
39 | Console.WriteLine(string.Format(string.Format("{0} licensed successfully.", licenseItem)));
40 | else
41 | OutputError(licenseItem, error);
42 |
43 | }
44 |
45 | private static void OutputError(string feature, LicenseError error)
46 | {
47 | Console.WriteLine(string.Format("Cannot grant a valid license to {0}, reason=\"{1}\", message=\"{2}\"",
48 | feature, error.Reason, error.Message));
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestComponent/TestComponent.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.30729
7 | 2.0
8 | {AC59DE67-DF1B-4E02-B927-6197EE45C1A0}
9 | Library
10 | Properties
11 | TestComponent
12 | TestComponent
13 | v3.0
14 | 512
15 | true
16 | ..\..\key.snk
17 |
18 |
19 | 3.5
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | {b12ba784-c9e4-4cf6-a5f1-5ebd09206e50}
50 | Licensing
51 |
52 |
53 |
54 |
61 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/Default.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestServer._Default" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/Default.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 | using System.Web.UI;
6 | using System.Web.UI.WebControls;
7 |
8 | namespace TestServer
9 | {
10 | public partial class _Default : System.Web.UI.Page
11 | {
12 | protected void Page_Load(object sender, EventArgs e)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/Default.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | namespace TestServer {
11 |
12 |
13 | public partial class _Default {
14 |
15 | ///
16 | /// form1 control.
17 | ///
18 | ///
19 | /// Auto-generated field.
20 | /// To modify move field declaration from designer file to code-behind file.
21 | ///
22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/LicensePublishService.asmx:
--------------------------------------------------------------------------------
1 | <%@ WebService Language="C#" CodeBehind="LicensePublishService.asmx.cs" Class="TestServer.LicensePublishService" %>
2 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/LicensePublishService.asmx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web;
3 | using System.Web.Services;
4 |
5 | namespace TestServer
6 | {
7 | [WebService(Namespace = "http://services.devzest.com/Licensing")]
8 | public class LicensePublishService : Publisher
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestServer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestServer")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestServer/Publisher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using DevZest.Licensing;
5 | using System.IO;
6 | using System.Web.Services;
7 | using System.Reflection;
8 | using System.Globalization;
9 |
10 | namespace TestServer
11 | {
12 | public class Publisher : LicensePublisher
13 | {
14 | // The license item names
15 | private static class LicenseItems
16 | {
17 | public const string Feature1 = "Feature1";
18 | public const string Feature2 = "Feature2";
19 | }
20 |
21 | private enum LicenseCategory
22 | {
23 | ExpiredEvaluation = 0,
24 | Evaluation,
25 | Registered
26 | }
27 |
28 | protected override string GetPrivateKeyXml(string product)
29 | {
30 | // Load the private key file from current assembly's embedded resource.
31 | // Note the resource name is namespace + file name, and it's CASE SENSITIVE.
32 | // If wrong resource name provided, PrivateKeyXmlFromSnkFile throws ArgumentNullException!
33 | using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TestServer.Key.snk"))
34 | {
35 | return PrivateKeyXmlFromSnkFile(stream);
36 | }
37 |
38 | }
39 |
40 | protected override LicensePublisherResponse GetLicense(CultureInfo cultureInfo, string product, Version version, LicenseKey licenseKey, string category, string userName, string company, string emailAddress, string data)
41 | {
42 | if (category == "Distributable")
43 | {
44 | AssemblyLicense license = new AssemblyLicense();
45 | license.Product = product;
46 | license.Category = category;
47 | license.UserName = userName;
48 | license.Company = company;
49 | license.Data = data;
50 | license.Items.Add(new LicenseItem(LicenseItems.Feature1));
51 | license.Items.Add(new LicenseItem(LicenseItems.Feature2));
52 | license.SetUpgradeExpirationDate(new DateTime(2999, 12, 31));
53 |
54 | return new LicensePublisherResponse(license);
55 | }
56 | else
57 | {
58 | MachineLicense license = new MachineLicense();
59 | license.Product = product;
60 | license.Category = category;
61 | license.UserName = userName;
62 | license.Company = company;
63 | license.Data = data;
64 | license.Items.Add(new LicenseItem(LicenseItems.Feature1));
65 | license.Items.Add(new LicenseItem(LicenseItems.Feature2));
66 | if (category == "Evaluation")
67 | license.SetExpirationDate(DateTime.UtcNow.AddMonths(3));
68 | license.SetUpgradeExpirationDate(new DateTime(2999, 12, 31));
69 |
70 | return new LicensePublisherResponse(license);
71 | }
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestSignedApp/AppKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/TestSignedApp/AppKey.snk
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestSignedApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TestComponent;
3 | using DevZest.Licensing;
4 |
5 | namespace TestSignedApp
6 | {
7 | class Program
8 | {
9 | static void Main(string[] args)
10 | {
11 | Console.WriteLine("Calling TestComponent.MyComponent from SIGNED app:");
12 | Console.WriteLine("--------------------------------------------------");
13 | MyComponent.Feature1();
14 | MyComponent.Feature2();
15 | Console.WriteLine();
16 | Console.WriteLine("Press any key to exit...");
17 | Console.ReadKey();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestSignedApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestSignedApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestSignedApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7ad15e82-9a95-4940-873c-78cd0f13c638")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestSignedApp/TestSignedApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.30729
7 | 2.0
8 | {2E63E1DB-DB32-41E0-A0AA-934F1B7F0EFB}
9 | Exe
10 | Properties
11 | TestSignedApp
12 | TestSignedApp
13 | v4.0
14 | 512
15 | true
16 | AppKey.snk
17 |
18 |
19 | 3.5
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | {b12ba784-c9e4-4cf6-a5f1-5ebd09206e50}
53 | Licensing
54 |
55 |
56 | {AC59DE67-DF1B-4E02-B927-6197EE45C1A0}
57 | TestComponent
58 |
59 |
60 |
61 |
68 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestUnsignedApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using TestComponent;
4 | using DevZest.Licensing;
5 | using TestUnsignedApp;
6 |
7 | [assembly: AssemblyLicenseLoader(typeof(LicenseLoader))]
8 |
9 | namespace TestUnsignedApp
10 | {
11 | class Program
12 | {
13 | static void Main(string[] args)
14 | {
15 | Console.WriteLine("Calling TestComponent.MyComponent from UNSIGNED app:");
16 | Console.WriteLine("----------------------------------------------------");
17 | MyComponent.Feature1();
18 | MyComponent.Feature2();
19 | Console.WriteLine();
20 | Console.WriteLine("Press any key to exit...");
21 | Console.ReadKey();
22 | }
23 | }
24 |
25 | class LicenseLoader : IAssemblyLicenseLoader
26 | {
27 | public string Load(System.Reflection.Assembly assembly)
28 | {
29 | string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyLicenseProviderAttribute.GetAssemblyLicenseFileName(assembly.GetName()));
30 | if (!File.Exists(filePath))
31 | return null;
32 |
33 | return File.ReadAllText(filePath);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestUnsignedApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestUnsignedApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("IBM")]
12 | [assembly: AssemblyProduct("TestUnsignedApp")]
13 | [assembly: AssemblyCopyright("Copyright © IBM 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("bc964c41-b98d-4077-a518-39170a716567")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/TestUnsignedApp/TestUnsignedApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {C1B785D1-E527-447C-9932-317F0C82DCBA}
9 | Exe
10 | Properties
11 | TestUnsignedApp
12 | TestUnsignedApp
13 | v3.5
14 | 512
15 |
16 |
17 | AnyCPU
18 | bin\Debug\
19 |
20 |
21 | AnyCPU
22 | bin\Release\
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {b12ba784-c9e4-4cf6-a5f1-5ebd09206e50}
34 | Licensing
35 |
36 |
37 | {AC59DE67-DF1B-4E02-B927-6197EE45C1A0}
38 | TestComponent
39 |
40 |
41 |
42 |
49 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/About.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/About.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.Reflection;
15 | using DevZest.Licensing;
16 |
17 | namespace LicenseConsole
18 | {
19 | public partial class About : Window
20 | {
21 | public About()
22 | {
23 | InitializeComponent();
24 | }
25 |
26 | public string ProductVersion
27 | {
28 | get
29 | {
30 | Assembly assembly = Assembly.GetExecutingAssembly();
31 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
32 | return fvi.ProductVersion;
33 | }
34 | }
35 |
36 | public Version FrameworkVersion
37 | {
38 | get { return Environment.Version; }
39 | }
40 |
41 | public IEnumerable References
42 | {
43 | get
44 | {
45 | foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
46 | yield return assembly.GetName();
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Windows;
5 |
6 | namespace LicenseConsole
7 | {
8 | ///
9 | /// Interaction logic for App.xaml
10 | ///
11 | public partial class App : Application
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ChangeProductLicenseValidationError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | [Flags]
6 | public enum ChangeProductLicenseValidationErrors
7 | {
8 | None = 0,
9 | LicenseKeyRequired = 1,
10 | UserNameRequired = 2,
11 | EmailAddressRequired = 4,
12 | AcceptLicenseAgreementRequired = 8
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/CheckUpdateResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | public enum CheckUpdateResult
6 | {
7 | UpToDate,
8 | Failed,
9 | NewVersionAvailable
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/CheckUpdateWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
30 |
36 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/CheckUpdateWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Configuration;
6 |
7 | namespace LicenseConsole
8 | {
9 | ///
10 | /// Interaction logic for CheckUpdateWindow.xaml
11 | ///
12 | public partial class CheckUpdateWindow : Window
13 | {
14 | public CheckUpdateWindow()
15 | {
16 | DataContext = LicenseConsoleData.Singleton;
17 | InitializeComponent();
18 | }
19 |
20 | private void ButtonYes_Click(object sender, RoutedEventArgs e)
21 | {
22 | Program.NavigateUri(new Uri(ConfigurationManager.AppSettings["ProductReleasesWebPageUrl"]));
23 | Close();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ClipboardDistributableLicenseWindow.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ClipboardDistributableLicenseWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Specialized;
4 | using System.Windows;
5 |
6 | namespace LicenseConsole
7 | {
8 | ///
9 | /// Interaction logic for ClipboardDistributableLicenseWindow.xaml
10 | ///
11 | public partial class ClipboardDistributableLicenseWindow : Window
12 | {
13 | private static readonly DependencyPropertyKey AssemblyPathPropertyKey = DependencyProperty.RegisterReadOnly(
14 | "AssemblyPath", typeof(string), typeof(ClipboardDistributableLicenseWindow), new FrameworkPropertyMetadata());
15 | public static readonly DependencyProperty AssemblyPathProperty = AssemblyPathPropertyKey.DependencyProperty;
16 |
17 | private string _license;
18 |
19 | public ClipboardDistributableLicenseWindow()
20 | {
21 | InitializeComponent();
22 | }
23 |
24 | public string AssemblyPath
25 | {
26 | get { return (string)GetValue(AssemblyPathProperty); }
27 | private set { SetValue(AssemblyPathPropertyKey, value); }
28 | }
29 |
30 | public static bool Show(Window owner, NameValueCollection parameters)
31 | {
32 | ClipboardDistributableLicenseWindow window = new ClipboardDistributableLicenseWindow();
33 | window.AssemblyPath = parameters["AssemblyPath"];
34 | window._license = parameters["License"];
35 | window.Owner = owner;
36 | bool? result = window.ShowDialog();
37 | if (result.HasValue && result.Value)
38 | return true;
39 | else
40 | return false;
41 | }
42 |
43 | private void ButtonYes_Click(object sender, RoutedEventArgs e)
44 | {
45 | if (GetLicenseWindow.SaveLicense(_license))
46 | {
47 | Clipboard.Clear();
48 | DialogResult = true;
49 | Close();
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ClipboardLicenseWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ClipboardProductLicenseWindow.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/EmailLicenseRequestWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
15 |
16 | Copy
17 |
18 |
19 |
20 | Copy
21 |
22 |
23 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/EnumToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 | using System.Windows.Data;
5 | using System.Globalization;
6 |
7 | namespace LicenseConsole
8 | {
9 | public class EnumToBooleanConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12 | {
13 | Type enumType = value.GetType();
14 | string strParam = parameter as string;
15 | if (strParam == null)
16 | return DependencyProperty.UnsetValue;
17 |
18 | object valueParam = Enum.Parse(enumType, strParam);
19 | if (enumType.IsDefined(typeof(FlagsAttribute), false) && (int)valueParam != 0)
20 | return ((int)value & (int)valueParam) == (int)valueParam;
21 | else
22 | return valueParam.Equals(value);
23 | }
24 |
25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26 | {
27 | string strParam = parameter as string;
28 | if (strParam == null)
29 | return DependencyProperty.UnsetValue;
30 | return Enum.Parse(targetType, strParam);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/GetLicenseWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Web Service
33 | Email
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Images/Green.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/src/Images/Green.gif
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Images/LicenseConsole.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/src/Images/LicenseConsole.ico
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Images/Red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/src/Images/Red.gif
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Images/Yellow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/src/Images/Yellow.gif
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseAgreementWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseAgreementWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.ComponentModel;
4 | using System.Collections.Generic;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.IO;
14 | using System.Configuration;
15 |
16 | namespace LicenseConsole
17 | {
18 | public partial class LicenseAgreementWindow : Window
19 | {
20 | public LicenseAgreementWindow()
21 | {
22 | InitializeComponent();
23 | }
24 |
25 | private static string LicenseAgreementFile
26 | {
27 | get { return ConfigurationManager.AppSettings["licenseAgreementFile"]; }
28 | }
29 |
30 | private void RichTextBox_Loaded(object sender, RoutedEventArgs e)
31 | {
32 | Debug.Assert(!string.IsNullOrEmpty(LicenseAgreementFile));
33 |
34 | TextRange textRange = new TextRange(_richTextBox.Document.ContentStart, _richTextBox.Document.ContentEnd);
35 |
36 | using (FileStream stream = new FileStream(LicenseAgreementFile, FileMode.Open, FileAccess.Read))
37 | {
38 | textRange.Load(stream, DataFormats.Rtf);
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseConsole.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DevZest/Licensing/eda726dfe2747dfcb9037cbbda737a32fe8e1365/samples/LicenseConsole/src/LicenseConsole.ico
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseInfo.cs:
--------------------------------------------------------------------------------
1 | namespace LicenseConsole
2 | {
3 | public class LicenseInfo
4 | {
5 | public string LicenseKey { get; set; }
6 | public string Name { get; set; }
7 | public string Company { get; set; }
8 | public string Email { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseItemData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 |
5 | namespace LicenseConsole
6 | {
7 | public class LicenseItemData : DependencyObject
8 | {
9 | private static readonly DependencyPropertyKey NamePropertyKey = DependencyProperty.RegisterReadOnly(
10 | "Name", typeof(string), typeof(LicenseItemData), new FrameworkPropertyMetadata());
11 | public static readonly DependencyProperty NameProperty = NamePropertyKey.DependencyProperty;
12 | private static readonly DependencyPropertyKey DescriptionPropertyKey = DependencyProperty.RegisterReadOnly(
13 | "Description", typeof(string), typeof(LicenseItemData), new FrameworkPropertyMetadata());
14 | public static readonly DependencyProperty DescriptionProperty = DescriptionPropertyKey.DependencyProperty;
15 | public static readonly DependencyProperty StateProperty = DependencyProperty.Register(
16 | "State", typeof(LicenseItemState), typeof(LicenseItemData), new FrameworkPropertyMetadata(LicenseItemState.Blocked));
17 |
18 | public LicenseItemData(string name, string description)
19 | {
20 | Name = name;
21 | Description = description;
22 | }
23 |
24 | public string Name
25 | {
26 | get { return (string)GetValue(NameProperty); }
27 | private set { SetValue(NamePropertyKey, value); }
28 | }
29 |
30 | public string Description
31 | {
32 | get { return (string)GetValue(DescriptionProperty); }
33 | private set { SetValue(DescriptionPropertyKey, value); }
34 | }
35 |
36 | public LicenseItemState State
37 | {
38 | get { return (LicenseItemState)GetValue(StateProperty); }
39 | set { SetValue(StateProperty, value); }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseItemState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | public enum LicenseItemState
6 | {
7 | Blocked,
8 | Evaluated,
9 | Granted
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseMethod.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | public enum LicenseMethod
6 | {
7 | WebService,
8 | Email
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | public enum LicenseState
6 | {
7 | NotLicensed,
8 | FreeFeature,
9 | Evaluation,
10 | EvaluationExpired,
11 | Paid
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/LicenseType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LicenseConsole
4 | {
5 | public enum LicenseType
6 | {
7 | FreeFeature,
8 | Evaluation,
9 | Paid,
10 | Distributable
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace LicenseConsole
16 | {
17 | public partial class MainWindow : Window
18 | {
19 | public MainWindow()
20 | {
21 | LicenseConsoleData data = LicenseConsoleData.Singleton;
22 | DataContext = data;
23 | InitializeComponent();
24 | data.BeginCheckUpdate();
25 | }
26 |
27 | private LicenseConsoleData Data
28 | {
29 | get { return DataContext as LicenseConsoleData; }
30 | }
31 |
32 | private void Change_Click(object sender, RoutedEventArgs e)
33 | {
34 | if (ClipboardLicenseWindow.CheckClipboard(this, false))
35 | return;
36 |
37 | ChangeProductLicenseWindow changeProductLicenseWindow = new ChangeProductLicenseWindow();
38 | changeProductLicenseWindow.Owner = this;
39 | changeProductLicenseWindow.ShowDialog();
40 | }
41 |
42 | private void GetLicense_Click(object sender, RoutedEventArgs e)
43 | {
44 | if (ClipboardLicenseWindow.CheckClipboard(this, true))
45 | return;
46 |
47 | GetLicenseWindow getLicenseWindow = new GetLicenseWindow();
48 | getLicenseWindow.Owner = this;
49 | getLicenseWindow.ShowDialog();
50 | }
51 |
52 | private void ToggleButton_Click(object sender, RoutedEventArgs e)
53 | {
54 | Data.ToggleRuntimeLicense();
55 | }
56 |
57 | private void DotNetLicensing_Click(object sender, RoutedEventArgs e)
58 | {
59 | Hyperlink hyperLink = (Hyperlink)sender;
60 | Program.NavigateUri(hyperLink.NavigateUri);
61 | }
62 |
63 | private void CheckUpdate_Click(object sender, RoutedEventArgs e)
64 | {
65 | CheckUpdateWindow window = new CheckUpdateWindow();
66 | window.Owner = this;
67 | window.ShowDialog();
68 | }
69 |
70 | private void NewVersionAvailable_Click(object sender, RoutedEventArgs e)
71 | {
72 | NewVersionAvailableWindow window = new NewVersionAvailableWindow();
73 | window.Owner = this;
74 | window.ShowDialog();
75 | }
76 |
77 | private void About_Click(object sender, RoutedEventArgs e)
78 | {
79 | About window = new About();
80 | window.Owner = this;
81 | window.ShowDialog();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/NewVersionAvailableWindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/NewVersionAvailableWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Documents;
6 | using System.Configuration;
7 |
8 | namespace LicenseConsole
9 | {
10 | ///
11 | /// Interaction logic for NewVersionAvailableWindow.xaml
12 | ///
13 | public partial class NewVersionAvailableWindow : Window
14 | {
15 | public NewVersionAvailableWindow()
16 | {
17 | DataContext = LicenseConsoleData.Singleton;
18 | InitializeComponent();
19 | }
20 |
21 | private void Download_Click(object sender, RoutedEventArgs e)
22 | {
23 | Hyperlink hyperlink = (Hyperlink)sender;
24 | Program.NavigateUri(hyperlink.NavigateUri);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/ProductRelease.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace LicenseConsole
5 | {
6 | public class ProductRelease : DependencyObject
7 | {
8 | private static readonly DependencyPropertyKey VersionPropertyKey = DependencyProperty.RegisterReadOnly("Version", typeof(Version), typeof(ProductRelease),
9 | new FrameworkPropertyMetadata());
10 | public static readonly DependencyProperty VersionProperty = VersionPropertyKey.DependencyProperty;
11 |
12 | private static readonly DependencyPropertyKey DownloadUrlPropertyKey = DependencyProperty.RegisterReadOnly("DownloadUrl", typeof(Uri), typeof(ProductRelease),
13 | new FrameworkPropertyMetadata());
14 | public static readonly DependencyProperty DownloadUrlProperty = DownloadUrlPropertyKey.DependencyProperty;
15 |
16 | private static readonly DependencyPropertyKey ReleaseNotesPropertyKey = DependencyProperty.RegisterReadOnly("ReleaseNotes", typeof(string), typeof(ProductRelease),
17 | new FrameworkPropertyMetadata());
18 | public static readonly DependencyProperty ReleaseNotesProperty = ReleaseNotesPropertyKey.DependencyProperty;
19 |
20 | internal ProductRelease(Version version, Uri downloadUrl, string releaseNotes)
21 | {
22 | Version = version;
23 | DownloadUrl = downloadUrl;
24 | ReleaseNotes = releaseNotes;
25 | }
26 |
27 | public Version Version
28 | {
29 | get { return (Version)GetValue(VersionProperty); }
30 | private set { SetValue(VersionPropertyKey, value); }
31 | }
32 |
33 | public Uri DownloadUrl
34 | {
35 | get { return (Uri)GetValue(DownloadUrlProperty); }
36 | private set { SetValue(DownloadUrlPropertyKey, value); }
37 | }
38 |
39 | public string ReleaseNotes
40 | {
41 | get { return (string)GetValue(ReleaseNotesProperty); }
42 | private set { SetValue(ReleaseNotesPropertyKey, value); }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using System.Collections.Specialized;
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using System.Windows.Input;
8 | using System.ServiceModel;
9 | using System.IO;
10 | using System.Text;
11 | using System.Reflection;
12 | using System.Web;
13 | using System.Runtime.InteropServices;
14 | using DevZest.Licensing;
15 |
16 | namespace LicenseConsole
17 | {
18 |
19 | internal static class Program
20 | {
21 | [STAThread()]
22 | static int Main(string[] args)
23 | {
24 | string errorMessage = LicenseConsoleData.Initialize();
25 | if (errorMessage != null)
26 | {
27 | MessageBox.Show(errorMessage);
28 | return 0;
29 | }
30 |
31 | LicenseError licenseError = DevZest.Licensing.LicenseManager.Check(".Net Licensing", typeof(LicenseClient));
32 | if (licenseError != null)
33 | {
34 | MessageBox.Show(licenseError.ExceptionMessage);
35 | return -1;
36 | }
37 |
38 | App.Main();
39 | return 0;
40 | }
41 |
42 | internal static String ConstructQueryString(NameValueCollection parameters)
43 | {
44 | List items = new List();
45 |
46 | foreach (string name in parameters)
47 | {
48 | string value = parameters[name];
49 | if (value == null)
50 | value = string.Empty;
51 | items.Add(string.Concat(name, "=", Uri.EscapeDataString(value)));
52 | }
53 |
54 | return String.Join("&", items.ToArray());
55 | }
56 |
57 | internal static void NavigateUri(Uri uri)
58 | {
59 | try
60 | {
61 | Mouse.OverrideCursor = Cursors.Wait;
62 | Process.Start(uri.ToString());
63 | }
64 | catch (Win32Exception ex)
65 | {
66 | Mouse.OverrideCursor = null;
67 | MessageBox.Show(ex.Message);
68 | }
69 | finally
70 | {
71 | Mouse.OverrideCursor = null;
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Resources;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 | using System.Windows;
7 |
8 | // General Information about an assembly is controlled through the following
9 | // set of attributes. Change these attribute values to modify the information
10 | // associated with an assembly.
11 | [assembly: AssemblyTitle("License Console")]
12 | [assembly: AssemblyDescription("License Console")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("DevZest")]
15 | [assembly: AssemblyProduct("License Console")]
16 | [assembly: AssemblyCopyright("Copyright © DevZest")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Setting ComVisible to false makes the types in this assembly not visible
21 | // to COM components. If you need to access a type in this assembly from
22 | // COM, set the ComVisible attribute to true on that type.
23 | [assembly: ComVisible(false)]
24 |
25 | //In order to begin building localizable applications, set
26 | //CultureYouAreCodingWith in your .csproj file
27 | //inside a . For example, if you are using US english
28 | //in your source files, set the to en-US. Then uncomment
29 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
30 | //the line below to match the UICulture setting in the project file.
31 |
32 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
33 |
34 |
35 | [assembly: ThemeInfo(
36 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
37 | //(used if a resource is not found in the page,
38 | // or application resource dictionaries)
39 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
40 | //(used if a resource is not found in the page,
41 | // app, or any theme specific resource dictionaries)
42 | )]
43 |
44 |
45 | // Version information for an assembly consists of the following four values:
46 | //
47 | // Major Version
48 | // Minor Version
49 | // Build Number
50 | // Revision
51 | //
52 | // You can specify all the values or you can default the Build and Revision Numbers
53 | // by using the '*' as shown below:
54 | // [assembly: AssemblyVersion("1.0.*")]
55 | [assembly: NeutralResourcesLanguageAttribute("en-US")]
56 | [assembly: CLSCompliant(true)]
57 |
58 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace LicenseConsole.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LicenseConsole.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace LicenseConsole.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/VersionAndReleaseDateConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Windows;
4 | using System.Windows.Data;
5 | using System.Globalization;
6 | using DevZest.Licensing;
7 |
8 | namespace LicenseConsole
9 | {
10 | public class VersionAndReleaseDateConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13 | {
14 | Version version = value as Version;
15 |
16 | if (version == null)
17 | return DependencyProperty.UnsetValue;
18 |
19 | DateTime releaseDate = AssemblyInfo.GetReleaseDate(version);
20 | string strReleaseDate = releaseDate.Year.ToString("0000", CultureInfo.InvariantCulture) + "/"
21 | + releaseDate.Month.ToString("00", CultureInfo.InvariantCulture) + "/"
22 | + releaseDate.Day.ToString("00", CultureInfo.InvariantCulture);
23 |
24 | return string.Format(CultureInfo.InvariantCulture, "{0} ({1})", version, strReleaseDate);
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
28 | {
29 | throw new NotImplementedException();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/samples/LicenseConsole/src/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/QuickStart.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp", "SampleApp\SampleApp.csproj", "{16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePublisher", "SamplePublisher\SamplePublisher.csproj", "{616E6588-B1D6-41DA-BC3F-438EFAAF99C5}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Licensing", "..\..\..\src\Licensing.csproj", "{B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {616E6588-B1D6-41DA-BC3F-438EFAAF99C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {616E6588-B1D6-41DA-BC3F-438EFAAF99C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {616E6588-B1D6-41DA-BC3F-438EFAAF99C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {616E6588-B1D6-41DA-BC3F-438EFAAF99C5}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SampleApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SampleApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using DevZest.Licensing;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("SampleApp")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("SampleApp")]
14 | [assembly: AssemblyCopyright("Copyright © 2009")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("ba0b2f84-343c-4bbf-82de-2d4f8220f392")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("1.0.*")]
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SampleApp/SampleApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.30729
7 | 2.0
8 | {16EEB3AF-1DBB-4ECD-B6C1-B94C2FA7AB24}
9 | Exe
10 | Properties
11 | SampleApp
12 | SampleApp
13 | v4.0
14 | 512
15 | true
16 | ..\..\..\Key.snk
17 |
18 |
19 | 3.5
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 |
43 | 3.5
44 |
45 |
46 | 3.0
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | {b12ba784-c9e4-4cf6-a5f1-5ebd09206e50}
59 | Licensing
60 |
61 |
62 |
63 |
70 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/AsmxPublisher.asmx:
--------------------------------------------------------------------------------
1 | <%@ WebService Language="C#" CodeBehind="AsmxPublisher.asmx.cs" Class="SamplePublisher.AsmxPublisher" %>
2 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/AsmxPublisher.asmx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web;
3 | using System.Web.Services;
4 |
5 | namespace SamplePublisher
6 | {
7 | [WebService(Namespace = "http://services.devzest.com/Licensing")]
8 | public class AsmxPublisher : Publisher
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Default.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SamplePublisher._Default" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Default.aspx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web;
3 | using System.Web.UI;
4 | using System.Web.UI.WebControls;
5 |
6 | namespace SamplePublisher
7 | {
8 | public partial class _Default : System.Web.UI.Page
9 | {
10 | protected void Page_Load(object sender, EventArgs e)
11 | {
12 |
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Default.aspx.designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:2.0.50727.42
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace SamplePublisher
12 | {
13 |
14 |
15 | public partial class _Default
16 | {
17 |
18 | ///
19 | /// form1 control.
20 | ///
21 | ///
22 | /// Auto-generated field.
23 | /// To modify move field declaration from designer file to code-behind file.
24 | ///
25 | protected global::System.Web.UI.HtmlControls.HtmlForm form1;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SamplePublisher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SamplePublisher")]
13 | [assembly: AssemblyCopyright("Copyright © 2009")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Publisher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using DevZest.Licensing;
5 | using System.IO;
6 | using System.Web.Services;
7 | using System.Reflection;
8 | using System.Globalization;
9 |
10 | namespace SamplePublisher
11 | {
12 | public class Publisher : LicensePublisher
13 | {
14 | // The AssemblyProduct attribute of SampleApp
15 | private const string Product = "SampleApp";
16 |
17 | // The license item names
18 | private static class LicenseItems
19 | {
20 | public const string Feature1 = "Feature1";
21 | public const string Feature2 = "Feature2";
22 | }
23 |
24 | private enum LicenseCategory
25 | {
26 | ExpiredEvaluation = 0,
27 | Evaluation,
28 | Registered
29 | }
30 |
31 | private static LicenseKey[] s_licenseKeys = {
32 | new LicenseKey("6VL8P-QHCRS-PF2GJ-8XLYG-VKHH4"),
33 | new LicenseKey("ZSWPT-Q3QV8-V9MM9-4WVFA-9Z9CQ"),
34 | new LicenseKey("XYDSY-LSKC5-9XVSJ-3QYLT-MALBQ") };
35 |
36 | protected override string GetPrivateKeyXml(string product)
37 | {
38 | // Load the private key file from current assembly's embedded resource.
39 | // Note the resource name is namespace + file name, and it's CASE SENSITIVE.
40 | // If wrong resource name provided, PrivateKeyXmlFromSnkFile throws ArgumentNullException!
41 | using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SamplePublisher.Key.snk"))
42 | {
43 | return PrivateKeyXmlFromSnkFile(stream);
44 | }
45 |
46 | }
47 |
48 | protected override LicensePublisherResponse GetLicense(CultureInfo cultureInfo, string product, Version version, LicenseKey licenseKey, string category, string userName, string company, string emailAddress, string data)
49 | {
50 | // Check the product
51 | if (product != Product)
52 | return new LicensePublisherResponse("Invalid product!");
53 |
54 | // Check the license key and category
55 | LicenseCategory? licenseCategory = null;
56 | for (int i = 0; i < s_licenseKeys.Length; i++)
57 | {
58 | if (s_licenseKeys[i] == licenseKey)
59 | {
60 | licenseCategory = (LicenseCategory)i;
61 | break;
62 | }
63 | }
64 | if (!licenseCategory.HasValue)
65 | return new LicensePublisherResponse("Invalid license key!");
66 | if (licenseCategory.ToString() != category)
67 | return new LicensePublisherResponse("Invalid category!");
68 |
69 | License license = new MachineLicense();
70 | license.Product = Product;
71 | license.Category = category;
72 | license.UserName = userName;
73 | license.Company = company;
74 | license.Data = data;
75 | license.Items.Add(new LicenseItem(LicenseItems.Feature1, true)); // Feature1's OverrideExpirationDate is true
76 | license.Items.Add(new LicenseItem(LicenseItems.Feature2));
77 |
78 | if (licenseCategory == LicenseCategory.Evaluation)
79 | license.SetExpirationDate(DateTime.UtcNow.AddMonths(3));
80 | else if (licenseCategory == LicenseCategory.ExpiredEvaluation)
81 | license.SetExpirationDate(DateTime.UtcNow); // Set ExpirationDate to now always expires the license
82 |
83 | return new LicensePublisherResponse(license);
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/SvcPublisher.svc:
--------------------------------------------------------------------------------
1 | <%@ ServiceHost Language="C#" Debug="true" Service="SamplePublisher.SvcPublisher" CodeBehind="SvcPublisher.svc.cs" %>
2 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/SvcPublisher.svc.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceModel;
3 |
4 | namespace SamplePublisher
5 | {
6 | public class SvcPublisher : Publisher
7 | {
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/QuickStart/CSharp/SamplePublisher/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
14 |
15 |
20 |
21 |
33 |
34 |
35 |
36 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/QuickStart.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SamplePublisher", "SamplePublisher\SamplePublisher.vbproj", "{E3DCADC5-1CDE-4CC6-91EF-AA1E66E6A7D7}"
7 | EndProject
8 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SampleApp", "SampleApp\SampleApp.vbproj", "{C7D9C257-666E-4F25-BC95-9C95ED6ED075}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Licensing", "..\..\..\src\Licensing.csproj", "{B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {E3DCADC5-1CDE-4CC6-91EF-AA1E66E6A7D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {E3DCADC5-1CDE-4CC6-91EF-AA1E66E6A7D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {E3DCADC5-1CDE-4CC6-91EF-AA1E66E6A7D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {E3DCADC5-1CDE-4CC6-91EF-AA1E66E6A7D7}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {C7D9C257-666E-4F25-BC95-9C95ED6ED075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {C7D9C257-666E-4F25-BC95-9C95ED6ED075}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {C7D9C257-666E-4F25-BC95-9C95ED6ED075}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {C7D9C257-666E-4F25-BC95-9C95ED6ED075}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {B12BA784-C9E4-4CF6-A5F1-5EBD09206E50}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:2.0.50727.3053
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 2
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:2.0.50727.3053
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My.Resources
16 |
17 | 'This class was auto-generated by the StronglyTypedResourceBuilder
18 | 'class via a tool like ResGen or Visual Studio.
19 | 'To add or remove a member, edit your .ResX file then rerun ResGen
20 | 'with the /str option, or rebuild your VS project.
21 | '
22 | ' A strongly-typed resource class, for looking up localized strings, etc.
23 | '
24 | _
28 | Friend Module Resources
29 |
30 | Private resourceMan As Global.System.Resources.ResourceManager
31 |
32 | Private resourceCulture As Global.System.Globalization.CultureInfo
33 |
34 | '
35 | ' Returns the cached ResourceManager instance used by this class.
36 | '
37 | _
38 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
39 | Get
40 | If Object.ReferenceEquals(resourceMan, Nothing) Then
41 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SampleApp.Resources", GetType(Resources).Assembly)
42 | resourceMan = temp
43 | End If
44 | Return resourceMan
45 | End Get
46 | End Property
47 |
48 | '
49 | ' Overrides the current thread's CurrentUICulture property for all
50 | ' resource lookups using this strongly typed resource class.
51 | '
52 | _
53 | Friend Property Culture() As Global.System.Globalization.CultureInfo
54 | Get
55 | Return resourceCulture
56 | End Get
57 | Set(ByVal value As Global.System.Globalization.CultureInfo)
58 | resourceCulture = value
59 | End Set
60 | End Property
61 | End Module
62 | End Namespace
63 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:2.0.50727.3053
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.SampleApp.My.MySettings
68 | Get
69 | Return Global.SampleApp.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SampleApp/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/AsmxPublisher.asmx:
--------------------------------------------------------------------------------
1 | <%@ WebService Language="vb" CodeBehind="AsmxPublisher.asmx.vb" Class="SamplePublisher.AsmxPublisher" %>
2 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/AsmxPublisher.asmx.vb:
--------------------------------------------------------------------------------
1 | Imports System.Web.Services
2 |
3 | _
4 | Public Class AsmxPublisher
5 | Inherits Publisher
6 |
7 | End Class
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/Default.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="SamplePublisher._Default" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/Default.aspx.designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:2.0.50727.42
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 |
16 | Partial Public Class _Default
17 |
18 | '''
19 | '''form1 control.
20 | '''
21 | '''
22 | '''Auto-generated field.
23 | '''To modify move field declaration from designer file to code-behind file.
24 | '''
25 | Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm
26 | End Class
27 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/Default.aspx.vb:
--------------------------------------------------------------------------------
1 | Partial Public Class _Default
2 | Inherits System.Web.UI.Page
3 |
4 | Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
5 |
6 | End Sub
7 |
8 | End Class
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | false
4 | false
5 | 0
6 | true
7 | 0
8 | 1
9 | true
10 |
11 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
20 |
21 |
22 | ' Version information for an assembly consists of the following four values:
23 | '
24 | ' Major Version
25 | ' Minor Version
26 | ' Build Number
27 | ' Revision
28 | '
29 | ' You can specify all the values or you can default the Build and Revision Numbers
30 | ' by using the '*' as shown below:
31 | '
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/MyExtensions/MyWebExtension.vb:
--------------------------------------------------------------------------------
1 | #If _MyType <> "Empty" Then
2 |
3 | Namespace My
4 | '''
5 | ''' Module used to define the properties that are available in the My Namespace for Web projects.
6 | '''
7 | '''
8 | _
9 | Module MyWebExtension
10 | Private s_Computer As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Devices.ServerComputer)
11 | Private s_User As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.ApplicationServices.WebUser)
12 | Private s_Log As New ThreadSafeObjectProvider(Of Global.Microsoft.VisualBasic.Logging.AspLog)
13 | '''
14 | ''' Returns information about the host computer.
15 | '''
16 | _
17 | Friend ReadOnly Property Computer() As Global.Microsoft.VisualBasic.Devices.ServerComputer
18 | Get
19 | Return s_Computer.GetInstance()
20 | End Get
21 | End Property
22 | '''
23 | ''' Returns information for the current Web user.
24 | '''
25 | _
26 | Friend ReadOnly Property User() As Global.Microsoft.VisualBasic.ApplicationServices.WebUser
27 | Get
28 | Return s_User.GetInstance()
29 | End Get
30 | End Property
31 | '''
32 | ''' Returns Request object.
33 | '''
34 | _
35 | _
36 | Friend ReadOnly Property Request() As Global.System.Web.HttpRequest
37 | _
38 | Get
39 | Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current
40 | If CurrentContext IsNot Nothing Then
41 | Return CurrentContext.Request
42 | End If
43 | Return Nothing
44 | End Get
45 | End Property
46 | '''
47 | ''' Returns Response object.
48 | '''
49 | _
50 | _
51 | Friend ReadOnly Property Response() As Global.System.Web.HttpResponse
52 | _
53 | Get
54 | Dim CurrentContext As Global.System.Web.HttpContext = Global.System.Web.HttpContext.Current
55 | If CurrentContext IsNot Nothing Then
56 | Return CurrentContext.Response
57 | End If
58 | Return Nothing
59 | End Get
60 | End Property
61 | '''
62 | ''' Returns the Asp log object.
63 | '''
64 | _
65 | Friend ReadOnly Property Log() As Global.Microsoft.VisualBasic.Logging.AspLog
66 | Get
67 | Return s_Log.GetInstance()
68 | End Get
69 | End Property
70 | End Module
71 | End Namespace
72 |
73 | #End If
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SamplePublisher.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.SamplePublisher.My.MySettings
68 | Get
69 | Return Global.SamplePublisher.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/Publisher.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Diagnostics
3 | Imports System.Collections.Generic
4 | Imports DevZest.Licensing
5 | Imports System.IO
6 | Imports System.Web.Services
7 | Imports System.Reflection
8 | Imports System.Globalization
9 |
10 |
11 | _
12 | Public Class Publisher
13 | Inherits LicensePublisher
14 |
15 | 'The AssemblyProduct attribute of SampleApp
16 | Private Const Product As String = "SampleApp"
17 |
18 | 'The license item names
19 | Private NotInheritable Class LicenseItems
20 | Public Const Feature1 As String = "Feature1"
21 | Public Const Feature2 As String = "Feature2"
22 | End Class
23 |
24 | Private Enum LicenseCategory
25 | ExpiredEvaluation = 0
26 | Evaluation
27 | Registered
28 | End Enum
29 |
30 |
31 | Private Shared s_licenseKeys As LicenseKey() = { _
32 | New LicenseKey("6VL8P-QHCRS-PF2GJ-8XLYG-VKHH4"), _
33 | New LicenseKey("ZSWPT-Q3QV8-V9MM9-4WVFA-9Z9CQ"), _
34 | New LicenseKey("XYDSY-LSKC5-9XVSJ-3QYLT-MALBQ")}
35 |
36 | Protected Overrides Function GetPrivateKeyXml(ByVal product As String) As String
37 | ' Load the private key file from current assembly's embedded resource.
38 | ' Note the resource name is namespace + file name, and it's CASE SENSITIVE.
39 | ' If wrong resource name provided, PrivateKeyXmlFromSnkFile throws ArgumentNullException!
40 | Using stream As Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SamplePublisher.Key.snk")
41 | Return PrivateKeyXmlFromSnkFile(stream)
42 | End Using
43 | End Function
44 |
45 | Protected Overrides Function GetLicense(ByVal cultureInfo As CultureInfo, ByVal product As String, ByVal version As Version, ByVal licenseKey As LicenseKey, ByVal category As String, ByVal userName As String, ByVal company As String, ByVal emailAddress As String, ByVal data As String) As LicensePublisherResponse
46 | 'Check the product
47 | If product <> Publisher.Product Then
48 | Return New LicensePublisherResponse("Invalid product!")
49 | End If
50 |
51 | 'Check the license key and category
52 | Dim licenseCategory As Nullable(Of LicenseCategory) = Nothing
53 | For i As Integer = 0 To s_licenseKeys.Length - 1
54 | If s_licenseKeys(i) = licenseKey Then
55 | licenseCategory = CType(i, LicenseCategory)
56 | Exit For
57 | End If
58 | Next
59 |
60 | If Not licenseCategory.HasValue Then
61 | Return New LicensePublisherResponse("Invalid license key!")
62 | End If
63 | If licenseCategory.ToString() <> category Then
64 | Return New LicensePublisherResponse("Invalid category!")
65 | End If
66 |
67 | Dim license As License = New MachineLicense()
68 | license.Product = product
69 | license.Category = category
70 | license.UserName = userName
71 | license.Company = company
72 | license.Data = data
73 | license.Items.Add(New LicenseItem(LicenseItems.Feature1, True)) 'Feature1's OverrideExpirationDate is true
74 | license.Items.Add(New LicenseItem(LicenseItems.Feature2))
75 |
76 | If licenseCategory = Publisher.LicenseCategory.Evaluation Then
77 | license.SetExpirationDate(DateTime.UtcNow.AddMonths(3))
78 | ElseIf licenseCategory = Publisher.LicenseCategory.ExpiredEvaluation Then
79 | license.SetExpirationDate(DateTime.UtcNow) 'Set ExpirationDate to now always expires the license
80 | End If
81 |
82 | Return New LicensePublisherResponse(license)
83 | End Function
84 |
85 | End Class
86 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/SvcPublisher.svc:
--------------------------------------------------------------------------------
1 | <%@ ServiceHost Language="VB" Debug="true" Service="SamplePublisher.SvcPublisher" CodeBehind="SvcPublisher.svc.vb" %>
2 |
--------------------------------------------------------------------------------
/samples/QuickStart/VB/SamplePublisher/SvcPublisher.svc.vb:
--------------------------------------------------------------------------------
1 | Public Class SvcPublisher
2 | Inherits Publisher
3 |
4 | End Class
5 |
--------------------------------------------------------------------------------
/src/AssemblyLicenseLoaderAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DevZest.Licensing
4 | {
5 | /// Specifies the assembly license loader.
6 | ///
7 | /// If does not exist for the caller assembly, the assembly license is retrieved from the embedded resource of
8 | /// the caller assembly. The name of the embedded resource must end with the value returned by GetAssemblyLicenseFileName
9 | /// If exists for the caller assembly, a instance of
10 | /// will be created to retrieve the assembly license. This allows the caller assembly to customize the
11 | /// storage of the assembly license.
12 | ///The following example loads the assembly file from the application root directory:
13 | ///
28 | ///
30 | ///
31 | ///Class LicenseLoader
32 | /// Implements IAssemblyLicenseLoader
33 | ///
34 | /// Public Function Load(ByVal assembly As System.Reflection.Assembly) As String
35 | /// Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyLicenseProviderAttribute.GetAssemblyLicenseFileName(assembly.GetName))
36 | /// If Not File.Exists(filePath) Then
37 | /// Return Nothing
38 | /// End If
39 | /// Return File.ReadAllText(filePath)
40 | /// End Function
41 | ///End Class
42 | ///]]>
43 | ///
44 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false)]
45 | public class AssemblyLicenseLoaderAttribute : Attribute
46 | {
47 | /// Initializes a new instance of .
48 | /// The type that implements .
49 | public AssemblyLicenseLoaderAttribute(Type loaderType)
50 | {
51 | if (loaderType == null)
52 | throw new ArgumentNullException("loaderType");
53 | if (!typeof(IAssemblyLicenseLoader).IsAssignableFrom(loaderType))
54 | throw new ArgumentException(SR.Exception_InvalidLoaderType, "loaderType");
55 | LoaderType = loaderType;
56 | }
57 |
58 | /// Gets the type that implements .
59 | /// The type that implements .
60 | public Type LoaderType { get; private set; }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/CachedLicenseProviderAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Security.Permissions;
4 | using System.Reflection;
5 | using System.Runtime.CompilerServices;
6 | using System.Globalization;
7 |
8 | namespace DevZest.Licensing
9 | {
10 | /// Provides cached license.
11 | public abstract class CachedLicenseProviderAttribute : LicenseProviderAttribute
12 | {
13 | private LicenseProviderResult _result;
14 |
15 | ///
16 | [MethodImpl(MethodImplOptions.Synchronized)]
17 | protected internal sealed override LicenseProviderResult ProvideLicense()
18 | {
19 | if (_result.IsEmpty)
20 | {
21 | _result = Load();
22 | if (_result.IsEmpty)
23 | throw new InvalidOperationException(ExceptionMessages.EmptyLicenseProviderResult);
24 | }
25 |
26 | return _result;
27 | }
28 |
29 | /// Loads a when there is no cached value.
30 | /// The result of loaded .
31 | protected abstract LicenseProviderResult Load();
32 |
33 | ///
34 | [MethodImpl(MethodImplOptions.Synchronized)]
35 | protected internal sealed override void Reset()
36 | {
37 | _result = new LicenseProviderResult();
38 | }
39 |
40 | internal abstract string TraceString { get; }
41 |
42 | ///
43 | protected internal override string GetTraceMessage(LicenseProviderResult result)
44 | {
45 | if (result.License == null)
46 | return string.Format(CultureInfo.InvariantCulture, "{0} - {1}", TraceString, result.ErrorMessage);
47 | else
48 | return string.Format(CultureInfo.InvariantCulture, "{0}\n{1}", TraceString, result.License);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Dictionary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | rsa
6 | snk
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/ExceptionMessages.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Globalization;
4 | using System.Reflection;
5 |
6 | namespace DevZest.Licensing
7 | {
8 | internal static class ExceptionMessages
9 | {
10 | public static string FormatInvalidLicenseKey(string licenseKey)
11 | {
12 | return string.Format(CultureInfo.InvariantCulture, SR.Exception_InvalidLicenseKey, licenseKey);
13 | }
14 |
15 | public static string CanNotVerifySignedLicense
16 | {
17 | get { return SR.Exception_CanNotVerifySignedLicense; }
18 | }
19 |
20 | public static string FrozenAccess
21 | {
22 | get { return SR.Exception_FrozenAccess; }
23 | }
24 |
25 | public static string FormatDuplicateLicenseItemName(string name)
26 | {
27 | return string.Format(CultureInfo.InvariantCulture, SR.Exception_DuplicateLicenseItemName, name);
28 | }
29 |
30 | public static string FormatEmptyLicenseItemName(int index)
31 | {
32 | return string.Format(CultureInfo.CurrentUICulture, SR.Exception_EmptyLicenseItemName, index);
33 | }
34 |
35 | public static string LicenseMustBeFrozenBeforeValidate
36 | {
37 | get { return SR.Exception_LicenseMustBeFrozenBeforeValidate; }
38 | }
39 |
40 | public static string FormatNullPublicKey(Assembly assembly)
41 | {
42 | return string.Format(CultureInfo.InvariantCulture, SR.Exception_NullPublicKey, AssemblyLicense.GetAssemblyName(assembly));
43 | }
44 |
45 | public static string FormatNullPrivateKey(string product)
46 | {
47 | return string.Format(CultureInfo.InvariantCulture, SR.Exception_NullPrivateKey, product);
48 | }
49 |
50 | public static string EmptyLicenseProviderResult
51 | {
52 | get { return SR.Exception_EmptyLicenseProviderResult; }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/FolderOption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DevZest.Licensing
4 | {
5 | /// Specifies enumerated constants used to retrieve directory paths together with a file name.
6 | public enum FolderOption
7 | {
8 | /// The file name specifies the full path.
9 | Absolute,
10 | /// The file name is relative to the assembly.
11 | Assembly,
12 | /// A system special folder is used together with the file name.
13 | EnvironmentSpecial
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Freezable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 |
5 | namespace DevZest.Licensing
6 | {
7 | /// Represents object that can be frozen for modification.
8 | /// Type of the freezer.
9 | public abstract class Freezable
10 | {
11 | internal abstract void Freeze(T freezer);
12 |
13 | /// Gets a value indicates whether this object is currently modifiable.
14 | /// if the object is frozen and cannot be modified; otherwise .
15 | /// Attempting to modify this object when its property is set to throws an
16 | /// . All derived classes should respect this property by calling
17 | /// VerifyFrozenAccess in all public methods and property setters that might modify this object.
18 | ///
19 | public abstract bool IsFrozen { get; }
20 |
21 | /// Enforces that this object is modifiable.
22 | /// This object is not modifiable.
23 | protected internal void VerifyFrozenAccess()
24 | {
25 | if (IsFrozen)
26 | throw new InvalidOperationException(ExceptionMessages.FrozenAccess);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is used by Code Analysis to maintain SuppressMessage
2 | // attributes that are applied to this project.
3 | // Project-level suppressions either have no target or are given
4 | // a specific target and scoped to a namespace, type, member, etc.
5 | //
6 | // To add a suppression to this file, right-click the message in the
7 | // Error List, point to "Suppress Message(s)", and click
8 | // "In Project Suppression File".
9 | // You do not need to add suppressions to this file manually.
10 |
11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Scope = "member", Target = "DevZest.Licensing.LicenseManager+RsaKey.#XmlStringFromAssembly(System.Reflection.Assembly)")]
12 |
--------------------------------------------------------------------------------
/src/IAssemblyLicenseLoader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace DevZest.Licensing
5 | {
6 | /// Defines a method to load assembly license.
7 | public interface IAssemblyLicenseLoader
8 | {
9 | /// Loads the assembly license for specified assembly.
10 | /// The specified assembly.
11 | /// The assembly license.
12 | string Load(Assembly assembly);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ILicensePublisher.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.ServiceModel;
3 |
4 | namespace DevZest.Licensing
5 | {
6 | /// Service contract between and .
7 | [ServiceContract(Namespace = "http://services.devzest.com/Licensing", Name = "LicensePublisher")]
8 | public interface ILicensePublisher
9 | {
10 | /// Publishes the requested license.
11 | /// The license client culture LCID.
12 | /// The product name.
13 | /// The product version.
14 | /// The encrypted license key.
15 | /// The license category.
16 | /// The user name.
17 | /// The user company.
18 | /// The user email address.
19 | /// The data to set for the license.
20 | /// The response sent to license client.
21 | [OperationContract]
22 | string Publish(int culture, string product, string version, string encryptedLicenseKey, string category, string name, string company, string email, string data);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/LicenseError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 |
5 | namespace DevZest.Licensing
6 | {
7 | /// Identifies the license validation error.
8 | public class LicenseError
9 | {
10 | private Assembly _assembly;
11 | private LicenseErrorReason _reason;
12 | private string _message;
13 | private License _license;
14 |
15 | /// Initializes a new instance of the class
16 | /// The assembly for the license validation.
17 | /// The reason for the license validation error.
18 | /// The message for the license validation error.
19 | /// The that fails the validation.
20 | public LicenseError(Assembly assembly, LicenseErrorReason reason, string message, License license)
21 | {
22 | if (assembly == null)
23 | throw new ArgumentNullException("assembly");
24 |
25 | if (string.IsNullOrEmpty(message))
26 | throw new ArgumentNullException("message");
27 |
28 | _assembly = assembly;
29 | _reason = reason;
30 | _message = message;
31 | _license = license;
32 | }
33 |
34 | /// Gets the assembly for the license validation.
35 | /// The assembly for the license validation.
36 | public Assembly Assembly
37 | {
38 | get { return _assembly; }
39 | }
40 |
41 | /// Gets the reason for the license validation error.
42 | /// The reason for the license validation error.
43 | public LicenseErrorReason Reason
44 | {
45 | get { return _reason; }
46 | }
47 |
48 | /// Gets the message for the license validation error.
49 | /// The message for the license validation error.
50 | public string Message
51 | {
52 | get { return _message; }
53 | }
54 |
55 | /// Gets the that fails the validation.
56 | /// The that fails the validation.
57 | public License License
58 | {
59 | get { return _license; }
60 | }
61 |
62 | /// Gets the message for the license validation exception.
63 | /// The message for the license validation exception.
64 | public string ExceptionMessage
65 | {
66 | get { return Messages.FormatLicenseError(this); }
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/LicenseErrorReason.cs:
--------------------------------------------------------------------------------
1 | namespace DevZest.Licensing
2 | {
3 | /// Specifies the reason that fails the license validation.
4 | public enum LicenseErrorReason
5 | {
6 | /// The assembly is not licensed.
7 | NullLicense,
8 | /// The license is invalid.
9 | InvalidLicense,
10 | /// The license is expired.
11 | ExpiredLicense
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/LicensePublicKeyAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reflection;
4 | using System.Security;
5 | using System.Security.Permissions;
6 |
7 | namespace DevZest.Licensing
8 | {
9 | /// Declares the public key used to verify the license.
10 | ///
11 | /// is required to get the public key of the assembly. If you plan to distribute your
12 | /// assembly running under partial trust, you need to declare the for your assembly:
13 | ///
14 | ///
17 | ///
18 | ///
19 | ///
21 | /// ]]>
22 | ///
23 | /// Use the command line sn.exe utility to get the public key string from an signed
24 | /// assembly:
25 | /// sn -Tp assemblyFile
26 | ///
27 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
28 | public sealed class LicensePublicKeyAttribute : Attribute
29 | {
30 | private string _publicKey;
31 |
32 | /// Initializes a new instance of class.
33 | ///
34 | /// The public key hex string. You may use the following command to get the public key hex string:
35 | /// sn -Tp assemblyFile
36 | ///
37 | public LicensePublicKeyAttribute(string publicKey)
38 | {
39 | _publicKey = publicKey;
40 | }
41 |
42 | /// Gets the public key hex string.
43 | /// The public key hex string.
44 | public string PublicKey
45 | {
46 | get { return _publicKey; }
47 | }
48 |
49 | private static byte[] StringToByteArray(String hex)
50 | {
51 | int NumberChars = hex.Length;
52 | byte[] bytes = new byte[NumberChars / 2];
53 |
54 | for (int i = 0; i < NumberChars; i += 2)
55 | bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);
56 | return bytes;
57 | }
58 |
59 | internal byte[] GetPublicKey()
60 | {
61 | AssemblyName assemblyName = new AssemblyName();
62 | assemblyName.SetPublicKey(StringToByteArray(_publicKey));
63 | return assemblyName.GetPublicKey();
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/LicensePublisherResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace DevZest.Licensing
5 | {
6 | /// Represents the response sent from license publisher to license client.
7 | public class LicensePublisherResponse
8 | {
9 | private object _obj;
10 |
11 | /// Initializes a new instance of object.
12 | /// Initializes a new instance of object encapsulates a
13 | /// object.
14 | /// The encapsulated object.
15 | /// The is .
16 | public LicensePublisherResponse(License license)
17 | {
18 | if (license == null)
19 | throw new ArgumentNullException("license");
20 |
21 | _obj = license;
22 | }
23 |
24 | /// Initializes a new instance of object encapsulates an error message.
25 | /// The encapsulated error message.
26 | /// The is or empty.
27 | public LicensePublisherResponse(string errorMessage)
28 | {
29 | if (string.IsNullOrEmpty(errorMessage))
30 | throw new ArgumentNullException("errorMessage");
31 |
32 | _obj = errorMessage;
33 | }
34 |
35 | /// Gets the encapsulated object.
36 | /// The encapsulated object.
37 | public License License
38 | {
39 | get { return _obj as License; }
40 | }
41 |
42 | /// Gets the encapsulated error message.
43 | /// The encapsulated error message.
44 | public string ErrorMessage
45 | {
46 | get { return _obj as string; }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/MachineLicense.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Diagnostics.CodeAnalysis;
4 | using System.Text;
5 | using System.Security.Cryptography;
6 | using System.Reflection;
7 | using System.Security.Permissions;
8 | using System.Runtime.CompilerServices;
9 |
10 | namespace DevZest.Licensing
11 | {
12 | /// Represents the license that can be validated against the local machine.
13 | /// When publishing an , the property should be set as the string
14 | /// value returned by MachineLicense.LocalMachineData, otherwise the validation will always fail.
15 | /// uses DPAPI to encrypt a known GUID as its property. The validation
16 | /// is to decrypt the property, compare it with the known GUID. It requires .
17 | /// If your application or component is target partial trust environment without , use
18 | /// instead.
19 | public sealed class MachineLicense : License
20 | {
21 | // {1F079CBE-96C8-46fd-8631-2C7D7E4DA8CA}
22 | private static readonly Guid Guid = new Guid(0x1f079cbe, 0x96c8, 0x46fd, 0x86, 0x31, 0x2c, 0x7d, 0x7e, 0x4d, 0xa8, 0xca);
23 |
24 | bool _verified;
25 | private LicenseError _error;
26 |
27 | ///
28 | [MethodImpl(MethodImplOptions.Synchronized)]
29 | protected sealed override LicenseError Validate()
30 | {
31 | if (_verified)
32 | {
33 | Byte[] encryptedBytes = LicenseManager.BytesFromString(Data);
34 | Byte[] bytes = ProtectedData.Unprotect(encryptedBytes, null, DataProtectionScope.LocalMachine);
35 | if (new Guid(bytes) != Guid)
36 | _error = new LicenseError(Assembly, LicenseErrorReason.InvalidLicense, Messages.InvalidMachineData, this);
37 | _verified = true;
38 | }
39 |
40 | return _error;
41 | }
42 |
43 | /// Gets the data for local machine.
44 | /// A value containing the data for local machine.
45 | /// When publishing an , the property should be set as the string
46 | /// value returned by MachineLicense.LocalMachineData, otherwise the validation will always fail.
47 | /// uses DPAPI to encrypt a known GUID as its property. The validation
48 | /// is to decrypt the property, compare it with the known GUID. It requires .
49 | /// If your application or component is target partial trust environment without , use
50 | /// instead.
51 | public static string LocalMachineData
52 | {
53 | get
54 | {
55 | byte[] protectedDataBytes = ProtectedData.Protect(Guid.ToByteArray(), null, DataProtectionScope.LocalMachine);
56 | return LicenseManager.BytesToString(protectedDataBytes);
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 | using System.Security;
6 | using DevZest.Licensing;
7 | using System.Windows.Markup;
8 |
9 | [assembly: XmlnsDefinition("http://schemas.devzest.com/licensing", "DevZest.Licensing")]
10 |
11 | // General Information about an assembly is controlled through the following
12 | // set of attributes. Change these attribute values to modify the information
13 | // associated with an assembly.
14 | [assembly: AssemblyTitle("DevZest .Net Licensing")]
15 | [assembly: AssemblyDescription("Protect .Net components/applications")]
16 | [assembly: AssemblyConfiguration("")]
17 | [assembly: AssemblyCompany("DevZest")]
18 | [assembly: AssemblyProduct(".Net Licensing")]
19 | [assembly: AssemblyCopyright("Copyright © DevZest, 2009 - 2016")]
20 | [assembly: AssemblyTrademark("")]
21 | [assembly: AssemblyCulture("")]
22 |
23 | [assembly: CLSCompliant(true)]
24 |
25 | // Setting ComVisible to false makes the types in this assembly not visible
26 | // to COM components. If you need to access a type in this assembly from
27 | // COM, set the ComVisible attribute to true on that type.
28 | [assembly: ComVisible(false)]
29 |
30 | // The following GUID is for the ID of the typelib if this project is exposed to COM
31 | [assembly: Guid("d057b901-ffe3-4431-a004-f37e3d4b7149")]
32 |
33 | [assembly: NeutralResourcesLanguageAttribute("en")]
34 |
35 | [assembly: AllowPartiallyTrustedCallers]
36 |
37 |
--------------------------------------------------------------------------------
/src/UserLicense.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Security.Principal;
4 | using System.Reflection;
5 | using System.Runtime.CompilerServices;
6 |
7 | namespace DevZest.Licensing
8 | {
9 | /// Represents the license that can be validated against the current user.
10 | /// When publishing an , the property should be set as the string
11 | /// value returned by UserLicense.CurrentUserData, otherwise the validation will always fail.
12 | public sealed class UserLicense : License
13 | {
14 | private bool _verified;
15 | private LicenseError _error;
16 |
17 | ///
18 | [MethodImpl(MethodImplOptions.Synchronized)]
19 | protected override LicenseError Validate()
20 | {
21 | if (_verified)
22 | {
23 | if (CurrentUserData != Data)
24 | _error = new LicenseError(Assembly, LicenseErrorReason.InvalidLicense, Messages.InvalidUserData, this);
25 | _verified = true;
26 | }
27 |
28 | return _error;
29 | }
30 |
31 | /// Gets the data for the current user.
32 | /// represents the current user.
33 | ///
34 | /// When publishing an , the property should be set as the string
35 | /// value returned by UserLicense.CurrentUserData,
36 | /// otherwise the validation will always fail.
37 | /// The returned data is formated as "[UserName];[SID]".
38 | ///
39 | public static string CurrentUserData
40 | {
41 | get
42 | {
43 | WindowsIdentity id = WindowsIdentity.GetCurrent();
44 | string sid = id.User.AccountDomainSid.ToString();
45 | return id.Name + ";" + sid;
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/XamlWriter.NamespaceCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Collections.Generic;
4 | using System.Windows.Markup;
5 | using System.Globalization;
6 | using System.Reflection;
7 |
8 | namespace DevZest.Licensing
9 | {
10 | partial class XamlWriter
11 | {
12 | private class NamespaceCache
13 | {
14 | public const string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml";
15 |
16 | private string _defaultNamespace;
17 | private Dictionary _prefixes = new Dictionary(); // Key: namespace, Value: prefix
18 | private Dictionary> _assemblyNamespaces = new Dictionary>();
19 |
20 | private string DefaultNamespace
21 | {
22 | get { return _defaultNamespace; }
23 | }
24 |
25 | public string GetPrefixForNamespace(string ns)
26 | {
27 | string ret = string.Empty;
28 | if (ns != DefaultNamespace && _prefixes.ContainsKey(ns))
29 | ret = _prefixes[ns];
30 | return ret;
31 | }
32 |
33 | public string GetXmlNamespace(Type type)
34 | {
35 | string uri = EnsureNamespaceMaps(type);
36 | if (_defaultNamespace == null)
37 | _defaultNamespace = uri;
38 |
39 | if (!_prefixes.ContainsKey(uri))
40 | {
41 | string prefix = "ns" + (_prefixes.Count + 1).ToString(CultureInfo.InvariantCulture);
42 | _prefixes[uri] = prefix;
43 | }
44 | return uri;
45 | }
46 |
47 | private string EnsureNamespaceMaps(Type type)
48 | {
49 | string assemblyFullName = type.Assembly.FullName;
50 | Dictionary namespaces;
51 | if (_assemblyNamespaces.ContainsKey(assemblyFullName))
52 | namespaces = _assemblyNamespaces[assemblyFullName];
53 | else
54 | {
55 | foreach (XmlnsPrefixAttribute prefixAttribute in type.Assembly.GetCustomAttributes(typeof(XmlnsPrefixAttribute), true))
56 | _prefixes[prefixAttribute.XmlNamespace] = prefixAttribute.Prefix;
57 |
58 | namespaces = new Dictionary();
59 | _assemblyNamespaces.Add(assemblyFullName, namespaces);
60 | foreach (XmlnsDefinitionAttribute definitionAttribute in type.Assembly.GetCustomAttributes(typeof(XmlnsDefinitionAttribute), true))
61 | {
62 | if (definitionAttribute.AssemblyName == null)
63 | namespaces[definitionAttribute.ClrNamespace] = definitionAttribute.XmlNamespace;
64 | }
65 | }
66 |
67 | if (!namespaces.ContainsKey(type.Namespace))
68 | {
69 | string uri = string.Format(CultureInfo.InvariantCulture, "clr-namespace:{0};assembly={1}", type.Namespace, GetAssemblyNameFromType(type));
70 | namespaces.Add(type.Namespace, uri);
71 | }
72 |
73 | return namespaces[type.Namespace];
74 | }
75 |
76 | public static string GetAssemblyNameFromType(Type type)
77 | {
78 | string[] names = type.Assembly.FullName.Split(',');
79 | return names.Length > 0 ? names[0] : string.Empty;
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/XamlWriter.NamespaceMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace DevZest.Licensing
5 | {
6 | partial class XamlWriter
7 | {
8 | private struct NamespaceMap
9 | {
10 | private string _prefix;
11 | private string _xmlNamespace;
12 |
13 | public NamespaceMap(string prefix, string xmlNamespace)
14 | {
15 | _prefix = prefix;
16 | _xmlNamespace = xmlNamespace;
17 | }
18 |
19 | public string Prefix
20 | {
21 | get { return _prefix; }
22 | }
23 |
24 | public string XmlNamespace
25 | {
26 | get { return _xmlNamespace; }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------