Beispiel #1
0
        private void btn_desDecrypt_Click(object sender, EventArgs e)
        {
            this.resultText.BeginInvoke((Action) delegate
            {
                if (this.inputText.Text == null)
                {
                    this.resultText.Text = string.Empty;
                }
                else
                {
                    string res = this.inputText.Text.ToString();

                    if (this.inputText.Text != null)
                    {
                        try
                        {
                            this.resultText.Text = DBQuery.AesDecrypt(res);
                        }
                        catch (Exception ex)
                        {
                            this.resultText.Text = ex.Message.ToString();
                        }
                    }
                    else
                    {
                        this.resultText.Text = string.Empty;
                    }
                }
            }, null);
        }
Beispiel #2
0
        public static void Des()
        {
            Regex  r        = new Regex("<mw>.*</mw>");
            string filePath = @"C:\Julius_J_Zhu\09DataLayer\MainTest\documents\log.txt";
            string str      = ReadFile(filePath);

            var collection = r.Matches(str);

            StringBuilder ret = new StringBuilder();

            var index = 1;

            foreach (var mat in collection)
            {
                string value = mat.ToString();

                if (value != null)
                {
                    string realValue = value.Replace("<mw>", string.Empty).Replace("</mw>", string.Empty);

                    string resultValue = DBQuery.AesDecrypt(realValue);

                    str = str.Replace(value, "<mw>" + resultValue + "</mw>");
                }

                index++;
            }

            r          = new Regex("<json>.*</json>");
            collection = r.Matches(str);

            foreach (var mat in collection)
            {
                string value = mat.ToString();

                if (value != null)
                {
                    string realValue = value.Replace("<json>", string.Empty).Replace("</json>", string.Empty);

                    string resultValue = DBQuery.AesDecrypt(realValue);

                    str = str.Replace(value, "<json>" + resultValue + "</json>");
                }
            }

            string fileName = "log" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt";

            SaveFile(str, fileName);

            // 写入文件
        }
Beispiel #3
0
        public void Des(string fileName)
        {
            Regex  r        = new Regex("<mw>.*</mw>");
            string filePath = @"./responseData/log.txt";
            string str      = ReadFile(filePath);

            var collection = r.Matches(str);

            StringBuilder ret = new StringBuilder();

            var index = 1;

            foreach (var mat in collection)
            {
                string value = mat.ToString();

                if (value != null)
                {
                    string realValue   = value.Replace("<mw>", string.Empty).Replace("</mw>", string.Empty);
                    string resultValue = DBQuery.AesDecrypt(realValue);
                    str = str.Replace(value, "<mw>" + resultValue + "</mw>");
                }

                index++;
            }

            r          = new Regex("<json>.*</json>");
            collection = r.Matches(str);

            foreach (var mat in collection)
            {
                string value = mat.ToString();

                if (value != null)
                {
                    string realValue = value.Replace("<json>", string.Empty).Replace("</json>", string.Empty);

                    string resultValue = DBQuery.AesDecrypt(realValue);

                    str = str.Replace(value, "<json>" + resultValue + "</json>");
                }
            }

            SaveFile(str, fileName);
            // 写入文件
        }
Beispiel #4
0
        private void BWDecrypt_Click(object sender, EventArgs e)
        {
            this.resultText.BeginInvoke((Action) delegate
            {
                string filePath = "./responseData/result01.txt";
                string res      = ReadFile(filePath);

                if (this.inputText.Text != null)
                {
                    try
                    {
                        this.resultText.Text = DBQuery.AesDecrypt(res);
                    }
                    catch (Exception ex)
                    {
                        this.resultText.Text = ex.Message.ToString();
                    }
                }
                else
                {
                    this.resultText.Text = string.Empty;
                }
            }, null);
        }
Beispiel #5
0
        /// <summary>
        /// 解密之后再base64解密备注
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_desAndRemark_Click(object sender, EventArgs e)
        {
            this.resultText.BeginInvoke((Action) delegate
            {
                string filePath = @"./responseData/result01.txt";
                string res      = ReadFile(filePath);

                try
                {
                    var resDes = DBQuery.AesDecrypt(res);


                    List <OutputInvoiceTaxControlQueryDto> result = this.DeserializeTaxControlQueryInfo <OutputInvoiceTaxControlQueryDto>(resDes);


                    if (result != null && result.Count > 0)
                    {
                        foreach (var item in result)
                        {
                            if (!string.IsNullOrEmpty(item.BZ))
                            {
                                item.BZ = this.DecodeBase64(Encoding.GetEncoding("gb2312"), item.BZ);
                            }
                        }
                    }

                    var newResultStr = JsonConvert.SerializeObject(result);

                    this.resultText.Text = newResultStr;
                }
                catch (Exception ex)
                {
                    this.resultText.Text = ex.Message.ToString();
                }
            }, null);
        }