Exemple #1
0
        public static int GetUseTick(string info, string key, bool isdate)
        {
            int count = 0, error = 0;

            if (key.Length > 50)
            {
                string mw16   = MyEncrypt.GetMd5_16(info, true);
                string mw32   = MyEncrypt.GetMD5(info);
                string qian8  = key.Substring(0, 8);
                string num    = MyEncrypt.FanZhuan(key.Substring(8, 4));
                string zhong8 = key.Substring(12, 8);
                string date   = MyEncrypt.DecryptB(MyEncrypt.FanZhuan(key.Substring(20, key.Length - 28)));
                mw16 = MyEncrypt.getRjCode(NumerStrToList(qian8), MyEncrypt.split(mw16));
                mw32 = MyEncrypt.getRjCode(NumerStrToList(zhong8), MyEncrypt.split(mw32));
                string str1  = mw16 + mw32;
                string str2  = key.Substring(key.Length - 8, 8);
                string today = DateTime.Now.Year + bu0(DateTime.Now.Month) + bu0(DateTime.Now.Day);
                Regex  r     = new Regex(@"^[0-9]*$");
                int    d1    = int.Parse(date);
                int    d2    = int.Parse(today);
                if (!r.IsMatch(qian8))
                {
                    error++;
                }
                if (!r.IsMatch(zhong8))
                {
                    error++;
                }
                if (!r.IsMatch(date))
                {
                    error++;
                }
                if (!str1.Equals(str2))
                {
                    error++;
                }
                if (d1 > d2)
                {
                    error++;
                }
                if (isdate && (d2 - d1) > 1)
                {
                    error++;
                }
                if (error == 0)
                {
                    num   = MyEncrypt.CharToNumerStr(num);
                    count = int.Parse(num);
                }
                else
                {
                    count = count - error;
                }
            }
            return(count);
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string code = textBox1.Text;

            if (String.IsNullOrEmpty(code))
            {
                label1.Text = "请输入兑换码!";
            }
            else
            {
                // 先判断是否存在
                List <String> list = TickCute.readHistoryStr();
                String        key = "", codeKey = "";// MyEncrypt.EncryptA(code);
                int           count = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    key     = list[i];
                    codeKey = MyEncrypt.DecryptB(key);
                    if (code.Equals(codeKey))
                    {
                        count++;
                    }
                }
                if (count == 0)
                {
                    count = TickCute.GetUseTick(Form1.MachineCode, code, true);
                    if (count <= 0 && count > 50)
                    {
                        label1.Text = "您输入的兑换码无效!";
                    }
                    else
                    {
                        TickCute.ChangeTickCount(count);
                        TickCute.WriteHistoryToFile(code);
                        this.Dispose();
                    }
                }
                else
                {
                    label1.Text = "您输入的兑换码无效!";
                }
            }
        }
Exemple #3
0
        public static string GetRegeditInfo(string info)
        {
            string key  = "";
            String logs = readFileStr();

            if (logs != null)
            {
                key = MyEncrypt.DecryptB(logs);
            }
            else
            {
                key = CreateKey(info, "0001");
                WriteLogsToFile(key);
                ThreadPool.QueueUserWorkItem((a) => {
                    String s = "我的机器码:" + info + "\n"
                               + CommonUtil.GetWindowInfo();
                    //CommonUtil.SendEMail("*****@*****.**", info, "*****@*****.**", "隐心", "隐心抢票安装报告", s, "", "smtp.163.com", "*****@*****.**", "");
                });
            }
            return(key);
        }
Exemple #4
0
        public static void loadConfig()
        {
            Program.mainForm.ShowMessage("加载系统配置...", false);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xmlPath);
            //查找<users>
            XmlNode root = xmlDoc.SelectSingleNode("config");
            //获取到所有<users>的子节点
            XmlNodeList nodeList = root.ChildNodes;
            //遍历所有子节点
            XmlElement  xe = null, ce = null;
            Libaray     lib = null;
            XmlNodeList xnl = null;

            foreach (XmlNode xn in nodeList)
            {
                xe = (XmlElement)xn;
                if (xe.Name.Equals("library"))
                {
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce         = (XmlElement)cn;
                        lib        = new Libaray();
                        lib.status = Convert.ToInt32(ce.GetAttribute("status"));
                        lib.id     = ce.GetAttribute("id");
                        if (lib.status != 999)
                        {
                            lib.name = ce.InnerText;
                            libarays.Add(lib);
                        }
                        else
                        {
                            try
                            {
                                CommonUtil.DeleteDir(ConfigStore.appDir + "\\data\\" + lib.id);
                            }
                            catch {}
                        }
                    }
                }
                else if (xe.Name.Equals("users"))
                {
                    User user = null;
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce          = (XmlElement)cn;
                        user        = new User();
                        user.Acc    = ce.GetAttribute("acc");
                        user.Pwd    = MyEncrypt.DecryptB(ce.GetAttribute("pwd"));
                        user.Status = Convert.ToInt32(ce.GetAttribute("status"));
                        user.Name   = ce.InnerText;
                        userTable.Add(user.Acc, user);
                    }
                }
                else if (xe.Name.Equals("skin"))
                {
                    skin = xe.InnerText;
                }
                else if (xe.Name.Equals("start"))
                {
                    startType = xe.InnerText;
                }
                else if (xe.Name.Equals("update"))
                {
                    updateType = xe.InnerText;
                }
                else if (xe.Name.Equals("algorithm"))
                {
                    algorithm = xe.InnerText;
                }
                else if (xe.Name.Equals("islocalhost"))
                {
                    islocalhost = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoBaojing"))
                {
                    isAutoBaojing = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoWriterVerify"))
                {
                    isAutoWriterVerify = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("failedTimes"))
                {
                    failedTimes = Convert.ToInt32(xe.InnerText);
                }
                else if (xe.Name.Equals("fromCity"))
                {
                    fromCity = xe.InnerText;
                }
                else if (xe.Name.Equals("toCity"))
                {
                    toCity = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsUser"))
                {
                    bbsUser = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsPwd"))
                {
                    bbsPwd = MyEncrypt.DecryptB(xe.InnerText);
                }
            }
            Program.mainForm.ShowMessage("完成");
            SaveConfig();
        }