public override string Convert(string source, EncodeType encode, bool check) { int i, count; string result = ""; string cod; count = source.Length; if (check) { for (i = 0; i < count; i++) { if (encode.Check(source[i])) { cod = encode.Encode.GetString(Encoding.Default.GetBytes(new char[] { source[i] })); result += cod; } else { result += source[i]; } } } else { for (i = 0; i < count; i++) { cod = encode.Encode.GetString(Encoding.Default.GetBytes(new char[] { source[i] })); result += cod; } } return(result); }
private void initMenu() { typelist = EncodeType.GetKnownTypeList(); ToolStripItem tempItem; foreach (var item in typelist) { tempItem = new ToolStripMenuItem(item.Name + "->" + "中文"); tempItem.Tag = item; tempItem.Click += this.btnEncodeConvert_Click; menuTool.DropDownItems.Insert(0, tempItem); } this.comboMode.Items.AddRange(EncodeConvertMode.GetKnownModeList()); this.comboMode.SelectedIndex = 0; }
public override string Convert(string source, EncodeType encode, bool check) { string result = ""; if (check) { if (encode.Check(source)) { result = encode.Encode.GetString(Encoding.Default.GetBytes(source)); } else { result = source; } } else { result = encode.Encode.GetString(Encoding.Default.GetBytes(source)); } return(result); }
public override string Convert(string source, EncodeType encode, bool check) { int i, count; string result = ""; string cod; var ps = source.Split('"'); count = ps.Length; if (check) { for (i = 0; i < count - 1; i++) { if (encode.Check(ps[i])) { cod = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i])); ps[i] = cod; } result += ps[i] + "\""; } if (encode.Check(ps[i])) { cod = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i])); ps[i] = cod; } result += ps[i]; } else { for (i = 0; i < count - 1; i++) { cod = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i])); ps[i] = cod; result += ps[i] + "\""; } cod = encode.Encode.GetString(Encoding.Default.GetBytes(ps[i])); ps[i] = cod; result += ps[i]; } return(result); }
public abstract string Convert(string source, EncodeType encode, bool check);