コード例 #1
0
ファイル: ToolsPage.xaml.cs プロジェクト: neuraclewzh/Epx017
        public static string GetTranslate(string input, string cmd)
        {
            switch (cmd)
            {
            case "TextToAsc": return(BasicEncoding.TextToAsc(input));

            case "ChrToText": return(BasicEncoding.asciiToText(input));

            case "MsMyToCHR": return(BasicEncoding.MsMyToCHR(input));

            case "OracleToCHR": return(BasicEncoding.OracleToCHR(input));

            case "TextToUnicode": return(BasicEncoding.TextToUnicode(input));

            case "UnicodeToText": return(BasicEncoding.UnicodeToText(input));

            case "EncodeBase64": return(BasicEncoding.EncodeBase64("windows-1252", input));

            case "DecodeBase64": return(BasicEncoding.DecodeBase64("windows-1252", input));

            case "HexStringToString": return(BasicEncoding.HexStringToString(input.Substring(2), Encoding.Default));

            case "UrlEncode": return(HttpUtility.UrlEncode(input, Encoding.GetEncoding("GB2312")));

            case "UrlDecode": return(HttpUtility.UrlDecode(input, Encoding.GetEncoding("GB2312")));

            default: return("");
            }
        }
コード例 #2
0
ファイル: ToolsPage.xaml.cs プロジェクト: neuraclewzh/Epx017
        private void Func_Click(object sender, RoutedEventArgs e)
        {
            string cmd = (sender as Button).CommandParameter.ToString();

            switch (cmd)
            {
            case "UTC":
            {
                ResultTextBox.Text = BasicEncoding.UnicodeToChinese(SourceTextBox.Text);
            }
            break;

            case "CTU":
            {
                ResultTextBox.Text = BasicEncoding.ChineseToUnicode(SourceTextBox.Text);
            }
            break;

            case "ATU":
            {
                ResultTextBox.Text = BasicEncoding.asciiToText(SourceTextBox.Text);
            }
            break;

            case "UTA":
            {
                ResultTextBox.Text = BasicEncoding.TextToAsc(SourceTextBox.Text);
            }
            break;

            case "CTUTF8":
            {
                ResultTextBox.Text = BasicEncoding.GB2312ToUtf8(SourceTextBox.Text);
            }
            break;

            case "UTF8TC":
            {
                ResultTextBox.Text = BasicEncoding.Utf8ToGB2312(SourceTextBox.Text);
            }
            break;

            case "Encode":
            {
                ResultTextBox.Text = HttpUtility.UrlEncode(SourceTextBox.Text, getEncoding(selectedValue));
            }
            break;

            case "Decode":
            {
                ResultTextBox.Text = HttpUtility.UrlDecode(SourceTextBox.Text, getEncoding(selectedValue));
            }
            break;

            case "ATN":
            {
                //ResultTextBox.Text = BasicEncoding.UnicodeToASCII(SourceTextBox.Text);
            }
            break;

            case "NTA":
            {
                ResultTextBox.Text = BasicEncoding.nativeToascii(SourceTextBox.Text);
            }
            break;

            default: break;
            }
        }