private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && lastFile != null) { if (lastFile.Contains(".sec")) { SecFile S = new SecFile(FileManager.GetFile(lastFile)); string s = toolStripTextBox1.Text; if (!s.EndsWith(".lrent")) s = s + ".lrent"; LrentFile L = null; if (FileManager.GetFile(s).IsOpenable) L = new LrentFile(FileManager.GetFile(s), P.Device); else L = LrentFile.CreateNew(s, P.Device); S.AddLrent(L); S.SaveFile(); contextMenuStrip3.Close(); } else if (lastFile.Contains(".wrl")) { WrlFile W = new WrlFile(FileManager.GetFile(lastFile)); string s = toolStripTextBox1.Text; if (!s.EndsWith(".sec")) s = s + ".sec"; SecFile S = null; if (FileManager.GetFile(s).IsOpenable) S = new SecFile(FileManager.GetFile(s)); else S = SecFile.CreateNew(s); W.AddSec(S); W.SaveFile(); contextMenuStrip3.Close(); } } }
private void BTN_CLICK_NL(object sender, EventArgs e) { NewLrentWindow l = new NewLrentWindow(); DialogResult dR = l.ShowDialog(this); if (dR == System.Windows.Forms.DialogResult.Yes) { LrentFile LN = LrentFile.CreateNew(l.newLrentName, Device); LN.SaveFile(); RisenWorld.AddLrents(new List<LrentFile>() { LN }); if (!FileManager.GetFile(l.newSecName).IsOpenable) { SecFile SC = SecFile.CreateNew(l.newSecName); SC.AddLrent(LN); SC.SaveFile(); if (l.AddToWRL) { WrlFile _W = new WrlFile(FileManager.GetFile("world.wrl")); _W.AddSec(l.newSecName); } } else { SecFile SC = new SecFile(FileManager.GetFile(l.newSecName)); SC.AddLrent(LN); SC.SaveFile(); } } }