Beispiel #1
0
        protected virtual bool IsKeyValid(Type type_0, string string_0)
        {
            bool flag;

            string[] str  = string_0.Split(new char[] { ',' });
            object   item = AELicenseProviderEx.m_hash[type_0.FullName];

            if (item == null)
            {
                item = type_0.FullName;
            }
            string str1 = "";

            if ((int)str.Length <= 1)
            {
                str1 = string.Concat(type_0.FullName, ",");
            }
            else
            {
                if (str[0].Trim().Length > 0 && str[0].Trim().ToLower() != "none")
                {
                    try
                    {
                        DateTime dateTime = DateTime.Parse(str[0]);
                        if (DateTime.Now <= dateTime)
                        {
                            str[0] = dateTime.ToString("yyyyddMM");
                        }
                        else
                        {
                            MessageBox.Show(string.Concat(item.ToString(), "的使用许可过期,请更新使用许可文件!"), "许可",
                                            MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            flag = false;
                            return(flag);
                        }
                    }
                    catch
                    {
                        MessageBox.Show(string.Concat("无法验证", item.ToString(), "的使用许可!"), "许可", MessageBoxButtons.OK,
                                        MessageBoxIcon.Asterisk);
                        flag = false;
                        return(flag);
                    }
                }
                str1 = string.Concat(type_0.FullName, ",", str[0].Trim().ToLower(), ",");
            }
            if ((Regedit.IsValid(str1, str[3], str[1]) ? false : !Regedit.IsValidEx(str1, str[1], str[3])))
            {
                MessageBox.Show(string.Concat("无法验证", item.ToString(), "的使用许可!"), "许可", MessageBoxButtons.OK,
                                MessageBoxIcon.Asterisk);
                flag = false;
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
Beispiel #2
0
        protected virtual bool IsKeyValid(Type type_0, string string_0)
        {
            bool flag;

            string[] str  = string_0.Split(new char[] { ',' });
            string   str1 = "";

            if ((int)str.Length <= 1)
            {
                str1 = string.Concat(type_0.FullName, ",");
            }
            else
            {
                if (str[0].Trim().Length > 0 && str[0].Trim().ToLower() != "none")
                {
                    try
                    {
                        DateTime dateTime = DateTime.Parse(str[0]);
                        if (DateTime.Now <= dateTime)
                        {
                            str[0] = dateTime.ToString("yyyyddMM");
                        }
                        else
                        {
                            MessageBox.Show("使用许可过期,请和软件供应商联系获取新的使用许可文件!", "许可", MessageBoxButtons.OK,
                                            MessageBoxIcon.Asterisk);
                            flag = false;
                            return(flag);
                        }
                    }
                    catch
                    {
                        MessageBox.Show("无法验证使用许可,请和软件供应商联系获取使用许可文件!", "许可", MessageBoxButtons.OK,
                                        MessageBoxIcon.Asterisk);
                        flag = false;
                        return(flag);
                    }
                }
                str1     = string.Concat(type_0.FullName, ",", str[0].Trim().ToLower(), ",");
                string_0 = str[1];
            }
            if (!Regedit.IsValidEx(str1, str[1], str[3]))
            {
                MessageBox.Show("无法验证使用许可,请和软件供应商联系获取使用许可文件!", "许可", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                flag = false;
            }
            else
            {
                flag = true;
            }
            return(flag);
        }