private void PatchFile_Unpatched_Browse_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.Filter = "All files (*.*)|*.*"; fd.ShowDialog(); if (fd.FileName != "") { PatchFile_Unpatched.Text = fd.FileName; PatchFile_Unpatched.SelectionLength = 0; PatchFile_Unpatched.SelectionStart = PatchFile_Unpatched.Text.Length; PatchFile_Unpatched.ScrollToCaret(); string ptn0 = fd.FileName; string ptn1 = ptn0.Substring(0, ptn0.LastIndexOf(".")); string ptn2 = ptn0.Substring(ptn0.LastIndexOf(".") + 1); PatchFile_Patched.Text = ptn1 + "_p." + ptn2; PatchFile_Patched.SelectionLength = 0; PatchFile_Patched.SelectionStart = PatchFile_Patched.Text.Length; PatchFile_Patched.ScrollToCaret(); string ptn = fd.FileName; ptn = ptn.Substring(0, ptn.LastIndexOf(".")); PatchFile_Patch.Text = ptn + ".ptp"; PatchFile_Patch.SelectionLength = 0; PatchFile_Patch.SelectionStart = PatchFile_Patch.Text.Length; PatchFile_Patch.ScrollToCaret(); } }
private void PatchFile_Patched_Browse_Click(object sender, EventArgs e) { string srctyp = PatchFile_Unpatched.Text; srctyp = srctyp.Substring(srctyp.LastIndexOf(".") + 1); SaveFileDialog fd = new SaveFileDialog(); fd.Filter = "All files (*.*)|*.*|" + srctyp + "-file (*." + srctyp + ")|*." + srctyp; fd.FilterIndex = 2; fd.ShowDialog(); if (fd.FileName != "") { PatchFile_Patched.Text = fd.FileName; PatchFile_Patched.SelectionLength = 0; PatchFile_Patched.SelectionStart = PatchFile_Patched.Text.Length; PatchFile_Patched.ScrollToCaret(); } }