Example #1
0
        private string generetedCode(string errors, string controlSum)
        {
            ClassMd5 i = new ClassMd5();

            return(i.CreateMD5Hash2(errors + this.OU + controlSum));
        }
Example #2
0
        private void send_Click(object sender, System.EventArgs e)
        {
            XmlDocument save = new XmlDocument();

            save.Load(this.savePath);
            try
            {
                XmlNode header      = save.SelectSingleNode("/save/header");
                XmlNode step        = save.SelectSingleNode("/save/step1");
                XmlNode step2       = save.SelectSingleNode("/save/step2");
                XmlNode step3       = save.SelectSingleNode("/save/step3");
                XmlNode hardWarning = save.SelectSingleNode("/save/hardWarning");
                string  xml         = save.InnerXml;
                string  controlSum  = "";
                if (header != null)
                {
                    controlSum += header.OuterXml;
                }
                if (step != null)
                {
                    controlSum += step.OuterXml;
                }
                if (step2 != null)
                {
                    controlSum += step2.OuterXml;
                }
                if (step3 != null)
                {
                    controlSum += step3.OuterXml;
                }
                ClassMd5 i      = new ClassMd5();
                string   hash   = i.CreateMD5Hash2(controlSum);
                string   errors = "";
                if (hardWarning != null)
                {
                    errors = hardWarning.OuterXml;
                }
                string   post = "controlSum=" + HttpUtility.UrlEncode(hash) + "&errors=" + HttpUtility.UrlEncode(errors);
                string[] name = this.savePath.Split(new char[]
                {
                    '\\'
                });
                string[] param = name[name.Length - 1].Split(new char[]
                {
                    '-'
                });
                string   post2 = "&fileName=" + HttpUtility.UrlEncode(name[name.Length - 1]) + "&jns=" + HttpUtility.UrlEncode(param[1]);
                CodeSend ws    = new CodeSend(post, xml, post2, this.licensePath, this);
                ws.ShowDialog();
                bool corect = this.check(this.codeField.Text, errors, hash);
                if (corect)
                {
                    string xml2 = save.InnerXml;
                    string code = "<hardWarningCode>" + this.codeField.Text + "</hardWarningCode>";
                    xml2.Replace("</save>", code + "</save>");
                    System.IO.StreamWriter sw = new System.IO.StreamWriter(this.savePath, false);
                    sw.Write(xml2);
                    sw.Close();
                    this.f.goodcertificate = true;
                    base.Close();
                }
            }
            catch (XmlException)
            {
            }
            catch (System.NullReferenceException)
            {
            }
        }
Example #3
0
        private string checkPhone()
        {
            XmlDocument save = new XmlDocument();

            save.Load(this.savePath);
            string result;

            try
            {
                int     day   = System.DateTime.Now.Day;
                int     month = System.DateTime.Now.Month;
                int     year  = System.DateTime.Now.Year;
                XmlNode obw   = save.SelectSingleNode("/save/header/nrObwodu");
                System.Collections.Generic.List <string> errors = new System.Collections.Generic.List <string>();
                XmlNode hardWarning = save.SelectSingleNode("/save/hardWarning");
                if (hardWarning != null)
                {
                    foreach (XmlNode field in hardWarning)
                    {
                        for (int i = 0; i < field.ChildNodes.Count; i++)
                        {
                            bool can = true;
                            for (int j = 0; j < errors.Count; j++)
                            {
                                if (field.ChildNodes[i].InnerText == errors[j])
                                {
                                    can = false;
                                    break;
                                }
                            }
                            if (can)
                            {
                                errors.Add(field.ChildNodes[i].InnerText);
                            }
                        }
                    }
                }
                errors.Sort();
                string text = "";
                for (int j = 0; j < errors.Count; j++)
                {
                    text += errors[j];
                }
                if (obw != null)
                {
                    text += obw.InnerText;
                }
                text += day.ToString();
                text += month.ToString();
                text += year.ToString();
                ClassMd5 k    = new ClassMd5();
                string   hash = k.CreateMD5Hash2(text);
                result = hash.Substring(0, 10);
                return(result);
            }
            catch (XmlException)
            {
            }
            catch (System.NullReferenceException)
            {
            }
            result = "";
            return(result);
        }