private void SPTEditWindow_Load(object sender, EventArgs e) { this.Text = titles[(new Random()).Next(titles.Length)]; status(""); TranslationMemory.LoadFromFile(); if (File.Exists("last_spt.txt")) { StreamReader r = new StreamReader(File.OpenRead("last_spt.txt")); string f = r.ReadToEnd(); r.Close(); if (File.Exists(f)) { openSPTFile(f); } } }
private void UpdateMemory() { for (int cind = panel1.Controls.Count - 1; cind >= 0; cind--) { Translatable t = panel1.Controls[cind] as Translatable; if (t == null) { continue; } List <KeyValuePair <string, string> > entries = t.GetMemoryEntries(); if (entries == null) { continue; } foreach (KeyValuePair <string, string> e in entries) { TranslationMemory.AddEntry(e.Key, e.Value); } } UpdateFromMemory(); }
private void SPTEditWindow_FormClosing(object sender, FormClosingEventArgs e) { if (sptFile == null) { return; } switch (doSaveConfirmation()) { case DialogResult.Cancel: e.Cancel = true; return; case DialogResult.No: break; case DialogResult.Yes: saveFile(); break; } sptFile.Close(); TranslationMemory.WriteToFile(); writeLastSPT(txtSPTPath.Text); }