コード例 #1
0
        private void ProcessSelectedItem()
        {
            AutoreplaceEntry selectedEntry = (AutoreplaceEntry)listReplaces.SelectedItem;

            if (selectedEntry != null)
            {
                callingPlugin.DoReplace(selectedEntry);
            }
        }
コード例 #2
0
        public void DoReplace(AutoreplaceEntry entry)
        {
            bool isTemplate = entry.Value.EndsWith(".tpl", StringComparison.OrdinalIgnoreCase);

            if (isTemplate)
            {
                me.ExecuteTemplate(entry.Value);
            }
            else
            {
                me.InsertText(entry.Value);
            }
        }
コード例 #3
0
        private void DeleteMismatchingReplaces(string searchString)
        {
            AutoreplaceEntry entry = null;
            int i = 0;

            while (i < listReplaces.Items.Count)
            {
                entry = (AutoreplaceEntry)listReplaces.Items[i];
                if (entry.ContainsText(searchString, StringComparison.OrdinalIgnoreCase))
                {
                    i++;
                }
                else
                {
                    listReplaces.Items.RemoveAt(i);
                }
            }
        }
コード例 #4
0
        /// <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);
        }