diff --git a/CAS.CodeProtect/CAS.CodeProtect.csproj b/CAS.CodeProtect/CAS.CodeProtect.csproj index 461bc053..1e541e0f 100644 --- a/CAS.CodeProtect/CAS.CodeProtect.csproj +++ b/CAS.CodeProtect/CAS.CodeProtect.csproj @@ -19,8 +19,7 @@ 4096 4 false - - + Logo.ico 3.5 @@ -137,12 +136,6 @@ - - True - True - Settings.settings - - True True @@ -189,10 +182,6 @@ TextTemplatingFileGenerator AssemblyInfo.cs - - SettingsSingleFileGenerator - Settings.Designer.cs - @@ -201,6 +190,10 @@ Designer CAS.CodeProtect.nuspec + + + Always + Designer diff --git a/CAS.CodeProtect/CAS.CodeProtect.nuspec b/CAS.CodeProtect/CAS.CodeProtect.nuspec index dc55f5d7..a63a5e30 100644 --- a/CAS.CodeProtect/CAS.CodeProtect.nuspec +++ b/CAS.CodeProtect/CAS.CodeProtect.nuspec @@ -2,14 +2,16 @@ CAS.CodeProtect - 7.0.0-Alpha + 7.0.0-Alpha Licenses creation and validation library Mariusz Postol Mariusz Postol - https://github.com/mpostol/RealTime - http://www.commsvr.com/DownloadCenter/ProductSoftware/LicenseAgreement.aspx false - false + MIT + content\Logo64.PNG + https://github.com/mpostol/CodeProtect + + false Helper library supporting licenses creation and validation. @@ -23,12 +25,9 @@ CAS Software, CAS Framework, CAS Library, Licensing. + - - - - diff --git a/CAS.CodeProtect/CAS.CodeProtect.tt b/CAS.CodeProtect/CAS.CodeProtect.tt index 6e67e48f..70a8bf1f 100644 --- a/CAS.CodeProtect/CAS.CodeProtect.tt +++ b/CAS.CodeProtect/CAS.CodeProtect.tt @@ -4,14 +4,16 @@ <#=Id#> - <#= CASCodeProtectProductVersion #><#= CASCodeProtectProductPreRelease #> + <#= CASCodeProtectProductVersion #><#= CASCodeProtectProductPreRelease #> <#= Title #> <#=AssemblyCompany#> <#=Owner#> - <#= repositoryUrl #> - http://www.commsvr.com/DownloadCenter/ProductSoftware/LicenseAgreement.aspx false - false + MIT + content\Logo64.PNG + <#=Url#> + + false <#= Description #> @@ -25,12 +27,9 @@ CAS Software, CAS Framework, CAS Library, Licensing. + - - - - diff --git a/CAS.CodeProtect/EnvironmentAccess/LicenseTraceSource.cs b/CAS.CodeProtect/EnvironmentAccess/LicenseTraceSource.cs index 6ffee66e..4801cc41 100644 --- a/CAS.CodeProtect/EnvironmentAccess/LicenseTraceSource.cs +++ b/CAS.CodeProtect/EnvironmentAccess/LicenseTraceSource.cs @@ -1,19 +1,11 @@ -// -// Title : CAS.Lib.CodeProtect.EnvironmentAccess.LicenseTraceSource - local trace source -// System : Microsoft Visual C# .NET 2008 -// $LastChangedDate$ -// $Rev$ -// $LastChangedBy$ -// $URL$ -// $Id$ +//___________________________________________________________________________________ // -// Copyright (C)2011, CAS LODZ POLAND. -// TEL: +48 (42) 686 25 47 -// mailto://techsupp@cas.eu -// http://www.cas.eu -// +// Copyright (C) 2020, Mariusz Postol LODZ POLAND. +// +// To be in touch join the community at GITTER: https://gitter.im/mpostol/OPC-UA-OOI +//___________________________________________________________________________________ + -using CAS.Lib.CodeProtect.Properties; using System; using System.Diagnostics; @@ -24,6 +16,7 @@ namespace CAS.Lib.CodeProtect.EnvironmentAccess /// internal class LicenseTraceSource : TraceSource { + #region internal /// /// trace message. @@ -70,7 +63,7 @@ internal static void TraceError(int id, string message) #region private private LicenseTraceSource() - : base(Settings.Default.TraceSourceName) { } + : base(Properties.Resources.TraceSourceName) { } private static void PrivateTrace(TraceEventType type, int id, string message) { try diff --git a/CAS.CodeProtect/LicenseDsc/Constraints/FunctionConstraint.cs b/CAS.CodeProtect/LicenseDsc/Constraints/FunctionConstraint.cs index 1ad755f3..fc57aece 100644 --- a/CAS.CodeProtect/LicenseDsc/Constraints/FunctionConstraint.cs +++ b/CAS.CodeProtect/LicenseDsc/Constraints/FunctionConstraint.cs @@ -1,23 +1,15 @@ -// -// Title : FunctionConstraint -// System : Microsoft Visual C# .NET 2008 -// $LastChangedDate$ -// $Rev$ -// $LastChangedBy$ -// $URL$ -// $Id$ +//___________________________________________________________________________________ // -// Copyright (C)2009, CAS LODZ POLAND. -// TEL: +48 (42) 686 25 47 -// mailto://techsupp@cas.eu -// http://www.cas.eu -// +// Copyright (C) 2020, Mariusz Postol LODZ POLAND. +// +// To be in touch join the community at GITTER: https://gitter.im/mpostol/OPC-UA-OOI +//___________________________________________________________________________________ +using CAS.Lib.CodeProtect.Properties; using System; using System.ComponentModel; using System.Text; using System.Xml; -using CAS.Lib.CodeProtect.Properties; namespace CAS.Lib.CodeProtect.LicenseDsc.Constraints { @@ -29,11 +21,11 @@ namespace CAS.Lib.CodeProtect.LicenseDsc.Constraints /// AbstractConstraint /// IConstraint /// LicenseFile - public class FunctionConstraint: AbstractConstraint + public class FunctionConstraint : AbstractConstraint { #region private private bool m_Allows = true; - private String updateUrl = String.Empty; + private string updateUrl = string.Empty; #endregion #region public constructors @@ -41,7 +33,7 @@ public class FunctionConstraint: AbstractConstraint /// This is the constructor for the . The constructor /// is used to create the object with a valid license to attach it to. /// - public FunctionConstraint() : this( null ) { } + public FunctionConstraint() : this(null) { } /// /// This is the constructor for the . The constructor /// is used to create the object and assign it to the proper license. @@ -50,7 +42,7 @@ public FunctionConstraint() : this( null ) { } /// The LicenseFile this constraint /// belongs to. /// - public FunctionConstraint( LicenseFile license ) + public FunctionConstraint(LicenseFile license) { base.License = license; base.Name = Resources.FunctionConstraintName; @@ -64,15 +56,15 @@ public FunctionConstraint( LicenseFile license ) /// The stringBuilder class where information should be stored /// The additional information. /// The depth (Indentation level). - protected internal override void PrepareTextInformationAboutConstraint( StringBuilder cStr, string additionalInformation, int depth ) + protected internal override void PrepareTextInformationAboutConstraint(StringBuilder cStr, string additionalInformation, int depth) { StringBuilder sb_addtionalInfo = new StringBuilder(); - DoIndent( sb_addtionalInfo, depth ); - if ( Allow ) - sb_addtionalInfo.AppendLine( Resources.FunctionConstraint_Allowed ); + DoIndent(sb_addtionalInfo, depth); + if (Allow) + sb_addtionalInfo.AppendLine(Resources.FunctionConstraint_Allowed); else - sb_addtionalInfo.AppendLine( Resources.FunctionConstraint_NOTAllowed ); - base.PrepareTextInformationAboutConstraint( cStr, sb_addtionalInfo.ToString(), depth ); + sb_addtionalInfo.AppendLine(Resources.FunctionConstraint_NOTAllowed); + base.PrepareTextInformationAboutConstraint(cStr, sb_addtionalInfo.ToString(), depth); } /// ///

This verifies the license meets its desired validation criteria. This includes @@ -94,16 +86,16 @@ protected internal override void PrepareTextInformationAboutConstraint( StringBu /// \t{UpdateURL} /// /// - public override bool Validate( Type typeToValidate, ref int vc, ref int rtc ) + public override bool Validate(Type typeToValidate, ref int vc, ref int rtc) { - if ( !base.Validate( typeToValidate, ref vc, ref rtc ) ) + if (!base.Validate(typeToValidate, ref vc, ref rtc)) return false; - if ( m_Allows ) + if (m_Allows) return true; StringBuilder errStr = new StringBuilder(); - errStr.Append( String.Format( Resources.LicMessageFunctionNotAllowed, this.Name, this.UpdateURL ) ); + errStr.Append($"{Resources.LicMessageFunctionNotAllowed} {this.Name}; {Resources.GetUpgrade} {this.UpdateURL}"); errStr.AppendLine(); - AddFailureReasonText( errStr.ToString() ); + AddFailureReasonText(errStr.ToString()); return false; } ///

@@ -115,15 +107,15 @@ public override bool Validate( Type typeToValidate, ref int vc, ref int rtc ) /// /// Thrown if the XmlNode is null. /// - public override void FromXml( XmlNode itemsNode ) + public override void FromXml(XmlNode itemsNode) { - base.FromXml( itemsNode ); - XmlNode updateURLTextNode = itemsNode.SelectSingleNode( "UpdateUrl/text()" ); - if ( updateURLTextNode != null ) + base.FromXml(itemsNode); + XmlNode updateURLTextNode = itemsNode.SelectSingleNode("UpdateUrl/text()"); + if (updateURLTextNode != null) UpdateURL = updateURLTextNode.Value; - XmlNode allowed = itemsNode.SelectSingleNode( "Allow/text()" ); - if ( allowed != null ) - Allow = Convert.ToBoolean( allowed.Value ); + XmlNode allowed = itemsNode.SelectSingleNode("Allow/text()"); + if (allowed != null) + Allow = Convert.ToBoolean(allowed.Value); } #endregion AbstractConstraint implementation #region AbstractLicenseData implementation @@ -133,10 +125,10 @@ public override void FromXml( XmlNode itemsNode ) /// /// A String representing the FunctionConstraint as Xml data. /// - protected override void ToXmlString( XmlTextWriter xmlWriter ) + protected override void ToXmlString(XmlTextWriter xmlWriter) { - xmlWriter.WriteElementString( "UpdateUrl", this.UpdateURL ); - xmlWriter.WriteElementString( "Allow", Convert.ToString( Allow ) ); + xmlWriter.WriteElementString("UpdateUrl", this.UpdateURL); + xmlWriter.WriteElementString("Allow", Convert.ToString(Allow)); } #endregion AbstractLicenseData implementation #region Properties @@ -150,22 +142,19 @@ protected override void ToXmlString( XmlTextWriter xmlWriter ) /// Gets the end date/time for this FunctionConstraint. /// [ - Bindable( false ), - Browsable( true ), - Category( "Constraints" ), - DefaultValue( null ), - Description( "Gets or sets the allow property. If the value is false the constrain is not valid" ), - DesignerSerializationVisibility( DesignerSerializationVisibility.Visible ) + Bindable(false), + Browsable(true), + Category("Constraints"), + DefaultValue(null), + Description("Gets or sets the allow property. If the value is false the constrain is not valid"), + DesignerSerializationVisibility(DesignerSerializationVisibility.Visible) ] public bool Allow { - get - { - return this.m_Allows; - } + get => this.m_Allows; set { - if ( !this.m_Allows.Equals( value ) ) + if (!this.m_Allows.Equals(value)) { this.m_Allows = value; this.IsModified = true; @@ -178,25 +167,22 @@ public bool Allow /// /// The new URL. /// - /// Returns the URL, as a , which points to where an update can be obtained. + /// Returns the URL, as a , which points to where an update can be obtained. /// [ - Bindable( false ), - Browsable( true ), - Category( "Data" ), - DefaultValue( "" ), - Description( "Gets or Sets the URL, as a String, which points to where an update can be obtained." ), - DesignerSerializationVisibility( DesignerSerializationVisibility.Visible ) + Bindable(false), + Browsable(true), + Category("Data"), + DefaultValue(""), + Description("Gets or Sets the URL, as a String, which points to where an update can be obtained."), + DesignerSerializationVisibility(DesignerSerializationVisibility.Visible) ] public string UpdateURL { - get - { - return this.updateUrl; - } + get => this.updateUrl; set { - if ( !this.UpdateURL.Equals( value ) ) + if (!this.UpdateURL.Equals(value)) { this.updateUrl = value; this.IsModified = true; diff --git a/CAS.CodeProtect/Logo.ico b/CAS.CodeProtect/Logo.ico new file mode 100644 index 00000000..9b8dcfce Binary files /dev/null and b/CAS.CodeProtect/Logo.ico differ diff --git a/CAS.CodeProtect/Logo64.PNG b/CAS.CodeProtect/Logo64.PNG new file mode 100644 index 00000000..0a7bb96f Binary files /dev/null and b/CAS.CodeProtect/Logo64.PNG differ diff --git a/CAS.CodeProtect/Properties/Resources.resx b/CAS.CodeProtect/Properties/Resources.resx index 17b95863..4800ea9f 100644 --- a/CAS.CodeProtect/Properties/Resources.resx +++ b/CAS.CodeProtect/Properties/Resources.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 the license signature is wrong. @@ -182,9 +182,7 @@ CAS.Lib.CodeProtect.CodeProtectLP.CodeProtectLP() - This license does not allow you to execute the functionality: -{0}. -You may get an upgrade at: {1} + This license does not allow you to execute the functionality: CAS.Lib.CodeProtect.LicenseDsc.Constraints.FunctionConstraint @@ -281,7 +279,7 @@ Restart the application to activate it. Hi, I am interested in a new licence, below are my current licensing details: - + keys.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1250 @@ -296,10 +294,6 @@ I am interested in a new licence, below are my current licensing details:Shows the dialog Unlock key to enter the key and unlock the software. - - ..\Resources\SecurityUnlock.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - Icone used by the user dialog - CAS.CommonResources CAS.Lib.CodeProtect.Controls.UlockKeyDialog @@ -399,4 +393,10 @@ Please navigate to: {0} manually. It is impossible for this environment to get source assembly and install license. CAS.Lib.CodeProtect.LibInstaller + + CAS.CodeProtect.TraceSource + + + You may get an upgrade at: + \ No newline at end of file diff --git a/CAS.CodeProtect/Properties/Resources1.Designer.cs b/CAS.CodeProtect/Properties/Resources1.Designer.cs index 0a3e6363..e022acaa 100644 --- a/CAS.CodeProtect/Properties/Resources1.Designer.cs +++ b/CAS.CodeProtect/Properties/Resources1.Designer.cs @@ -19,7 +19,7 @@ namespace CAS.Lib.CodeProtect.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -321,6 +321,15 @@ public static string FunctionConstraintName { } } + /// + /// Looks up a localized string similar to You may get an upgrade at: . + /// + public static string GetUpgrade { + get { + return ResourceManager.GetString("GetUpgrade", resourceCulture); + } + } + /// /// Looks up a localized string similar to {\rtf1\ansi\ansicpg1250\uc1 \deff0\deflang1045\deflangfe1045{\fonttbl{\f0\froman\fcharset238\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fmodern\fcharset238\fprq1{\*\panose 02070309020205020404}Courier New;} ///{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f27\fswiss\fcharset238\fprq2{\*\panose 020b0604030504040204}Tahoma;} @@ -452,8 +461,7 @@ public static string LicMessageFunctionNoReason { } /// - /// Looks up a localized string similar to This license does not allow you to execute the functionality: {0}. - /// You may get an upgrade at: {1}. + /// Looks up a localized string similar to This license does not allow you to execute the functionality:. /// public static string LicMessageFunctionNotAllowed { get { @@ -489,16 +497,6 @@ public static string ProductUnlockCodeStringToRemove { } } - /// - /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). - /// - public static System.Drawing.Icon SecurityUnlock { - get { - object obj = ResourceManager.GetObject("SecurityUnlock", resourceCulture); - return ((System.Drawing.Icon)(obj)); - } - } - /// /// Looks up a localized string similar to It is impossible for this environment to get source assembly and install license.. /// @@ -557,6 +555,15 @@ public static string SplashScreenWaitMessage { } } + /// + /// Looks up a localized string similar to CAS.CodeProtect.TraceSource. + /// + public static string TraceSourceName { + get { + return ResourceManager.GetString("TraceSourceName", resourceCulture); + } + } + /// /// Looks up a localized string similar to License failure. /// diff --git a/CAS.CodeProtect/Properties/Settings.Designer.cs b/CAS.CodeProtect/Properties/Settings.Designer.cs deleted file mode 100644 index 88758b39..00000000 --- a/CAS.CodeProtect/Properties/Settings.Designer.cs +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace CAS.Lib.CodeProtect.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("CAS.CodeProtect.TraceSource")] - public string TraceSourceName { - get { - return ((string)(this["TraceSourceName"])); - } - } - } -} diff --git a/CAS.CodeProtect/Properties/Settings.settings b/CAS.CodeProtect/Properties/Settings.settings deleted file mode 100644 index 59b72077..00000000 --- a/CAS.CodeProtect/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - CAS.CodeProtect.TraceSource - - - \ No newline at end of file diff --git a/CAS.CodeProtect/app.config b/CAS.CodeProtect/app.config deleted file mode 100644 index f048df12..00000000 --- a/CAS.CodeProtect/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - -
- - - - - - CAS.CodeProtect.TraceSource - - - - \ No newline at end of file diff --git a/CAS.CodeProtect/security.ico b/CAS.CodeProtect/security.ico deleted file mode 100644 index 718212d3..00000000 Binary files a/CAS.CodeProtect/security.ico and /dev/null differ