ComponentFactory.Krypton.Ribbon.EncryptedLicenseProvider.GetLicenseDirectory C# (CSharp) Method

GetLicenseDirectory() protected method

Return the directory used to store license files
protected GetLicenseDirectory ( System.ComponentModel.LicenseContext context, Type type ) : string
context System.ComponentModel.LicenseContext The licence context
type System.Type The type being licensed
return string
        protected virtual string GetLicenseDirectory(LicenseContext context, Type type)
        {
            string result = null;

            // try to use the type resolver service if available
            //
            if (context != null)
            {
                ITypeResolutionService resolver = (ITypeResolutionService)context.GetService(typeof(ITypeResolutionService));
                if (resolver != null)
                    result = resolver.GetPathOfAssembly(type.Assembly.GetName());
            }

            if (result == null)
            {
                // use the code base if possible - because this works properly under ASP.NET
                // where as the Module.FullyQualifiedName points to a temporary file
                //
                result = type.Assembly.CodeBase;
                if (result.StartsWith(@"file:///"))
                {
                    result = result.Replace(@"file:///", "");
                }
                else
                {
                    result = type.Module.FullyQualifiedName;
                }
            }
            return Path.GetDirectoryName(result);
        }