private void buttonLoad_Click(object sender, EventArgs e) { string timelineTxtFilePath = (string)listTimelines.SelectedItem; try { plugin.Controller.TimelineTxtFilePath = String.Format("{0}/{1}.txt", Globals.TimelineTxtsRoot, timelineTxtFilePath); trackBar.Enabled = true; buttonRewind.Enabled = true; buttonPlay.Enabled = true; plugin.updateAllVisibility(true); } catch { // pass } }
void timer_CheckCurrentZone(object sender, EventArgs e) { if (!ActGlobals.oFormActMain.InitActDone) { return; } if (!Autoload) { return; } var zonename = ActGlobals.oFormActMain.CurrentZone; if (zonename.Length == 0) { return; } if (m_currentzone != zonename) { List <string> findList = new List <string>(); List <char> replacementList = new List <char>(); replacementList.Add('_'); replacementList.Add('-'); foreach (char replacement in replacementList) { var safeFileName = zonename; foreach (char c in System.IO.Path.GetInvalidFileNameChars()) { safeFileName = safeFileName.Replace(c, replacement); } findList.Add(String.Format("{0}/{1}.txt", Globals.TimelineTxtsRoot, safeFileName)); findList.Add(String.Format("{0}/{1}.txt", Globals.TimelineTxtsRoot, safeFileName.Replace($"{replacement} ", $" {replacement} "))); } bool timelineLoaded = false; foreach (string findName in findList) { if (System.IO.File.Exists(findName)) { plugin.Controller.Paused = true; plugin.Controller.TimelineTxtFilePath = findName; plugin.updateAllVisibility(plugin.checkBoxShowView.Checked); timelineLoaded = true; break; } } if (!timelineLoaded) { plugin.TabPageControl?.buttonUnload?.PerformClick(); } m_currentzone = zonename; } }