• SQLDBCompare2.4 序列号代码


     private void button1_Click(object sender, EventArgs e)
            
    {
                textBox1.Text 
    = GenerateNewKey("$BE$T$"102false500);
            }

            
    public static string GenerateNewKey(string strSecurityCode, int nProductCode, bool bTrial, int nTrialDays)
            
    {
                
    if (!strSecurityCode.Equals("$BE$T$"))
                
    {
                    
    return "";
                }

                
    string str = Guid.NewGuid().ToString().Replace("-""");
                
    string str2 = "";
                
    if (bTrial)
                
    {
                    str2 
    = "2" + nTrialDays.ToString("D3"+ "00000000" + nProductCode.ToString("D3");
                }

                
    else
                
    {
                    str2 
    = "1123ABCDEFGH" + nProductCode.ToString("D3");
                }

                
    char[] chArray = (str + "$" + str2).ToCharArray();
                
    byte[] inArray = new byte[chArray.Length];
                
    for (int i = 0; i < chArray.Length; i++)
                
    {
                    inArray[i] 
    = (byte)chArray[i];
                }

                
    string strKey = Convert.ToBase64String(inArray);
                
    string str4 = GetStringCheckSumValue(strKey).ToString("D3");
                
    return (strKey + str4);
            }


     

            
    public static int GetStringCheckSumValue(string strKey)
            
    {
                
    int i1 = 0;
                
    byte b2 = 1;
                
    for (int i2 = 0; i2 < strKey.Length; i2++)
                
    {
                    
    byte b1 = (byte)strKey[i2];
                    
    for (int i3 = 0; i3 < 8; i3++)
                    
    {
                        
    if ((b1 & (b2 << (i3 & 31))) == 0)
                            i1
    ++;
                    }

                }

                
    return i1;
            }


  • 相关阅读:
    #ifndef 、 #define 、#endif使用解释
    基于小熊派Hi3861鸿蒙开发的IoT物联网学习【六】--智慧农业MQTT数据上传华为云
    C语言学习(三)
    c语言学习篇二【基础语法】
    简单图解OSI七层网络模型
    基于小熊派Hi3861鸿蒙开发的IoT物联网学习【五】
    使用Doxygen生成html/chm范例,方便源码阅读
    李宏毅《深度学习》P1----机器学习介绍
    keras实现Alexnet (cifar10数据集)
    cmake条件编译
  • 原文地址:https://www.cnblogs.com/lovebanyi/p/927869.html
Copyright © 2020-2023  润新知