private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { saveFileDialog1.FileName = openFileDialog1.FileName.Substring(0, openFileDialog1.FileName.Length - 4) + ".ikb"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { KeyboardLanguage.Parser par = new KeyboardLanguage.Parser(openFileDialog1.FileName, "98761197agde5d2g13asdh8wjktwa6f5"); ArrayList ENI = par.getENI(); ArrayList ENM = par.getENM(); ArrayList ENO = par.getENO(); FileStream fs = new FileStream(saveFileDialog1.FileName, FileMode.Create); System.IO.Compression.DeflateStream df = new DeflateStream(fs, CompressionMode.Compress); StreamWriter sw = new StreamWriter(df, Encoding.Unicode); for (int i = 0; i < ENI.Count; i++) { foreach (char c in ((string)ENI[i]).ToCharArray()) { int y = ((int)c) - 317; sw.Write((char)y); } sw.Write((char)5); foreach (char c in ((string)ENM[i]).ToCharArray()) { int y = ((int)c) - 317; sw.Write((char)y); } sw.Write((char)5); foreach (char c in ((string)ENO[i]).ToCharArray()) { int y = ((int)c) - 317; sw.Write((char)y); } sw.Write((char)5); } df.Close(); //sw.Close(); fs.Close(); } } }
public KeyProcessor(string Script) { if (Script == "NULL") { LeftContext = new ArrayList(); Keys = new ArrayList(); Output = new ArrayList(); } else { string file = Directory.GetCurrentDirectory() + "\\Scripts\\" + Script; if (File.Exists(file + ".ikl")) { KeyboardLanguage.Parser par = new KeyboardLanguage.Parser(file + ".ikl", "98761197agde5d2g13asdh8wjktwa6f5"); if (par.RES != "OK") { MessageBox.Show("Error in Input Script: " + file + ".ikl\r\n" + par.RES + "\r\nOn Line:" + par.line); Application.Exit(); } LeftContext = par.getENI(); Keys = par.getENM(); Output = par.getENO(); } else if (File.Exists(file + ".ikb")) { Keyboard_Language.Decryptor par = new Decryptor(file + ".ikb", "98761197agde5d2g13asdh8wjktwa6f5"); LeftContext = par.getENI(); Keys = par.getENM(); Output = par.getENO(); } else { MessageBox.Show(@"MyInput cannot read the keyboard script. It may be locked or corrupted, or not exists anymore"); Application.Exit(); } } buffer = new Buffer(); sname = Script; }