Show / Hide Table of Contents

Class AssemblyLicenseLoaderAttribute

Specifies the assembly license loader.

Inheritance
System.Object
System.Attribute
AssemblyLicenseLoaderAttribute
Implements
System.Runtime.InteropServices._Attribute
Inherited Members
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.Equals(System.Object)
System.Attribute.GetHashCode()
System.Attribute.Match(System.Object)
System.Attribute.IsDefaultAttribute()
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Attribute.TypeId
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: DevZest.Licensing
Assembly: DevZest.Licensing.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class AssemblyLicenseLoaderAttribute : Attribute, _Attribute
Remarks

If AssemblyLicenseLoaderAttribute does not exist for the caller assembly, the assembly license is retrieved from the embedded resource of the caller assembly. The name of the embedded resource must end with the value returned by GetAssemblyLicenseFileName(AssemblyName)

If AssemblyLicenseLoaderAttribute exists for the caller assembly, a IAssemblyLicenseLoader instance of LoaderType will be created to retrieve the assembly license. This allows the caller assembly to customize the storage of the assembly license.

The following example loads the assembly file from the application root directory:

[assembly: DevZest.Licensing.EmbeddedAssemblyLicense(typeof(LicenseLoader))]

class LicenseLoader : IAssemblyLicenseLoader { public string Load(System.Reflection.Assembly assembly) { string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyLicenseProviderAttribute.GetAssemblyLicenseFileName(assembly.GetName())); if (!File.Exists(filePath)) return null;

   return File.ReadAllText(filePath);

} }

<Assembly: DevZest.Licensing.EmbeddedAssemblyLicense(GetType(MyAssemblyLic.Class1))>

Class LicenseLoader
    Implements IAssemblyLicenseLoader

    Public Function Load(ByVal assembly As System.Reflection.Assembly) As String
        Dim filePath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyLicenseProviderAttribute.GetAssemblyLicenseFileName(assembly.GetName))
        If Not File.Exists(filePath) Then
            Return Nothing
        End If
        Return File.ReadAllText(filePath)
    End Function
End Class

Constructors

Name Description
AssemblyLicenseLoaderAttribute(Type)

Initializes a new instance of AssemblyLicenseLoaderAttribute.

Properties

Name Description
LoaderType

Gets the type that implements IAssemblyLicenseLoader.

  • Improve this Doc
  • View Source
Back to top Copyright © Weifen Luo | DevZest