public void ReadDictFile(string file) { string[] lines = File.ReadAllLines(file); dict = new CipherDictionary(lines.Length); foreach (string line in lines) { if (line.Length == 10) { char c = line[0]; if (c == 'C') { c = '\r'; } else if (c == 'L') { c = '\n'; } else if (c == 'E') { c = (char)26; } string hex = line.Substring(4, 6); dict.Add(0xFF << 24 | Convert.ToInt32(hex, 16), c); } } if (data != null) { dict.AddMissingValues(data); } charsetView.DataSource = dict.BindingList; }
public CipherDictionary MostLikely() { var ret = new CipherDictionary(this.Count); foreach (CipherPossibilities poss in this) { CipherPair ml = poss.MostLikely(); if (ml != null) { ret.Add(ml); } } return(ret); }
private void openMessageToolStripMenuItem_Click(object sender, EventArgs e) { if (openImageDialog.ShowDialog() == DialogResult.OK) { data = ReadImage(openImageDialog.FileName); if (dict == null) { BestGuess(); } else { for (int i = 0; i < data.Length; i++) { if (!dict.ContainsKey(data[i])) { dict.Add(new CipherPair(data[i])); } } } UpdateOutput(); dict.BindingList.ResetBindings(); this.Text = "Rodina Decryptor - " + Path.GetFileNameWithoutExtension(openImageDialog.FileName); } }