Hidistro.Core/CopyrightLicenser.cs

(开头部分) 2KB

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

namespace Hidistro.Core
{
    using Hidistro.Core.Entities;
    using System;
    using System.Globalization;
    using System.IO;
    using System.Security.Cryptography;
    using System.Text;
    using System.Web;
    using System.Web.Caching;
    using System.Xml;

    public sealed class CopyrightLicenser
    {
        public const string CacheCopyrightKey = "Hishop_SiteLicense";

        private CopyrightLicenser()
        {
        }

        public static bool CheckCopyright()
        {
            XmlDocument document = HiCache.Get("Hishop_SiteLicense") as XmlDocument;
            HttpContext current = HttpContext.Current;
            if (document == null)
            {
                string path = null;
                if (current != null)
                {
                    path = current.Request.MapPath("~/config/Hishop.lic");
                }
                else
                {
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Hishop.lic");
                }
                if (!File.Exists(path))
                {
                    return false;
                }
                document = new XmlDocument();
                document.LoadXml(File.ReadAllText(path));
                HiCache.Max("Hishop_SiteLicense", document, new CacheDependency(path));
            }
            XmlNode node = document.DocumentElement.SelectSingleNode("//Host");
            XmlNode node2 = document.DocumentElement.SelectSingleNode("//LicenseDate");
            XmlNode node3 = document.DocumentElement.SelectSingleNode("//ExpiresDate");
            XmlNode node4 = document.DocumentElement.SelectSingleNode("//Signature");
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            if (string.Compare(node.InnerText, masterSettings.SiteUrl, true, CultureInfo.InvariantCulture) != 0)
            {
                return false;
            }
            string s = string.Format(CultureInfo.InvariantCulture, "Host={0}&LicenseDate={1}&ExpiresDate={2}&Key={3}", new object[] { masterSettings.SiteUrl, node2.InnerText, node3.InnerText, masterSettings.CheckCode });
            bool flag = false;
            using (RSACryptoServiceProvider provider = new RSACryptoServiceProvider())
            {
                provider.FromXmlString(LicenseHelper.GetPublicKey());
                RSAPKCS1SignatureDeformatter deformatter = new RSAPKCS1SignatureDeformatter(provider);
                deformatter.SetHashAlgorithm("SHA1");
                byte[] rgbSignature = Convert.FromBase64String(node4.InnerText);
后面还有 8 行代码,购买后查看完整代码

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

AI 解读 AI

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

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