private void MainForm_Shown(object sender, EventArgs e) { string[] args = System.Environment.GetCommandLineArgs(); if (args.Length >= 3 && args[1] == "-file") { // open file string ext = Path.GetExtension(args[2]); switch (ext) { case ".w3o": case ".wtg": case ".wct": g_replacer = new BinaryReplacer(); break; case ".txt": isText = true; g_replacer = new TextReplacer(); break; case ".j": case ".ai": isText = true; g_replacer = new TextReplacer(); g_replacer.SetPrefix("'"); break; } g_replacer.OpenFile(args[2]); // replace ReplaceAll(); // save Directory.CreateDirectory("Output"); g_replacer.SaveFile("Output\\" + Path.GetFileName(args[2])); //exit Application.Exit(); } }
private void OpenBtn_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string ext = Path.GetExtension(openFileDialog1.FileName); switch (ext) { case ".w3o": case ".wtg": case ".wct": g_replacer = new BinaryReplacer(); break; case ".txt": isText = true; g_replacer = new TextReplacer(); break; case ".j": case ".ai": isText = true; g_replacer = new TextReplacer(); g_replacer.SetPrefix("'"); break; } g_replacer.OpenFile(openFileDialog1.FileName); } }