Source/DevCoLicenseProvider.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Windows.Forms;
namespace DevComponents.DotNetBar
{
	[System.ComponentModel.ToolboxItem(false),System.ComponentModel.DesignTimeVisible(false)]
	public class DevCoLicenseProvider:LicenseProvider
	{
		const string DOTNETBAR="dotnetbar";
		public DevCoLicenseProvider()
		{
		}
		public override License GetLicense(LicenseContext context,Type type,object instance,bool allowExceptions)
		{
			DevCoLicense lic = null;
			Debug.Assert(context!=null, "No context provided!");
			#if !TRIAL
			//if no context is provided, do nothing
			if (context != null) 
			{
				//if this control is in runtime mode
				if (context.UsageMode == LicenseUsageMode.Runtime) 
				{
					//retreive the stored license key
					string key = context.GetSavedLicenseKey(type, null);
					//check if the stored license key is null
					// and call IsKeyValid to make sure its valid
					if (key != null && IsKeyValid2(key, type)) 
					{
						//if the key is valid create a new license
						lic = new DevCoLicense(key);
					}
					else
					{
						try
						{
							System.Reflection.Assembly[] assemblies=System.AppDomain.CurrentDomain.GetAssemblies();
							foreach(System.Reflection.Assembly a in assemblies)
							{
								string codeBase = a.CodeBase;
								codeBase = codeBase.Substring(codeBase.LastIndexOf("/") + 1)+".licenses";
								System.IO.Stream stream=this.GetManifestResourceStream(a,codeBase);
								if(stream==null)
									codeBase=codeBase.Replace(".DLL.",".dll.");
								stream=this.GetManifestResourceStream(a,codeBase);
								if(stream!=null)
								{
									key=DeserializeLicenseKey(stream);
									if (key != null && key!="") //IsKeyValid2(key, type)) 
									{
										lic = new DevCoLicense(key);
										break;
									}
								}
							}
						}
						catch
						{
后面还有 161 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。