public void Show(AutoreplaceList list, AutoreplacePlugin plugin) { callingPlugin = plugin; allReplaces = list; FormBorderStyle = FormBorderStyle.SizableToolWindow; PopulateAllReplaces(); CenterToScreen(); Show(); }
private void ShowAutoreplaceList() { if (autoReplaces == null) { autoReplaces = AutoreplaceList.LoadFromFile(AutoreplaceFilePath); cachedLastModifyDate = File.GetLastWriteTime(AutoreplaceFilePath); } else { DateTime lastModifyDate = File.GetLastWriteTime(AutoreplaceFilePath); if (DateTime.Compare(lastModifyDate, cachedLastModifyDate) > 0) { cachedLastModifyDate = lastModifyDate; autoReplaces = AutoreplaceList.LoadFromFile(AutoreplaceFilePath); } } AutoreplaceForm form = new AutoreplaceForm(); form.Show(autoReplaces, me); }
/// <summary> /// Creates and populates an instance of <see cref="AutoreplaceList"/> from the specified PL/SQL Developer autoreplaces text file. /// </summary> /// <param name="filePath">Absolute path to the autoreplaces file.</param> /// <returns></returns> public static AutoreplaceList LoadFromFile(string filePath) { string line = null; string[] tokens; AutoreplaceList result = new AutoreplaceList(); StreamReader reader = new StreamReader(filePath); AutoreplaceEntry e = null; while ((line = reader.ReadLine()) != null) { tokens = line.Split('='); e = new AutoreplaceEntry(tokens[0], tokens[1]); result.Entries.AddLast(e); } reader.Close(); return(result); }