Esempio n. 1
0
 /// <summary>
 /// Generates the menu for the selected sci control
 /// </summary>
 public void GenerateSnippets(ScintillaNet.ScintillaControl sci)
 {
     String path;
     String content;
     PathWalker walker;
     List<String> files;
     items = new List<String>();
     String surroundFolder = "surround";
     path = Path.Combine(PathHelper.SnippetDir, surroundFolder);
     if (Directory.Exists(path))
     {
         walker = new PathWalker(PathHelper.SnippetDir + surroundFolder, "*.fds", false);
         files = walker.GetFiles();
         foreach (String file in files)
         {
             items.Add(file);
         }
     }
     path = Path.Combine(PathHelper.SnippetDir, sci.ConfigurationLanguage);
     path = Path.Combine(path, surroundFolder);
     if (Directory.Exists(path))
     {
         walker = new PathWalker(path, "*.fds", false);
         files = walker.GetFiles();
         foreach (String file in files)
         {
             items.Add(file);
         }
     }
     if (items.Count > 0) items.Sort();
     this.DropDownItems.Clear();
     foreach (String itm in items)
     {
         content = File.ReadAllText(itm);
         if (content.IndexOf("{0}") > -1)
         {
             this.DropDownItems.Insert(this.DropDownItems.Count, new ToolStripMenuItem(Path.GetFileNameWithoutExtension(itm)));
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Gets the files
        /// </summary>
        public List<String> GetFiles()
        {
            switch (type)
            {
                case OperationType.FindInRange:
                    return this.files;

                case OperationType.FindInSource:
                    if (this.files == null)
                    {
                        this.files = new List<String>();
                        this.files.Add(path);
                    }
                    return files;

                case OperationType.FindInFile:
                    if (this.files == null)
                    {
                        this.files = new List<String>();
                        this.files.Add(path);
                    }
                    return this.files;

                case OperationType.FindInPath:
                    if (this.files == null)
                    {
                        PathWalker walker = new PathWalker(this.path, this.mask, this.recursive);
                        this.files = walker.GetFiles();
                    }
                    return this.files;
            }
            return null;
        }
Esempio n. 3
0
 /// <summary>
 /// Gets search config for find and replace
 /// </summary>
 private FRConfiguration GetFRConfig(String path, String mask, Boolean recursive)
 {
     if (path.Trim() == "<Project>")
     {
         if (PluginBase.CurrentProject != null)
         {
             PathWalker walker;
             List<String> allFiles = new List<String>();
             IProject project = PluginBase.CurrentProject;
             String projPath = Path.GetDirectoryName(project.ProjectPath);
             walker = new PathWalker(projPath, mask, recursive);
             List<String> projFiles = walker.GetFiles();
             foreach (String file in projFiles)
             {
                 if (!IsFileHidden(file, project)) allFiles.Add(file);
             }
             for (var i = 0; i < project.SourcePaths.Length; i++)
             {
                 String sourcePath = project.GetAbsolutePath(project.SourcePaths[i]);
                 if (Directory.Exists(sourcePath) && !sourcePath.StartsWith(projPath))
                 {
                     walker = new PathWalker(sourcePath, mask, recursive);
                     allFiles.AddRange(walker.GetFiles());
                 }
             }
             return new FRConfiguration(allFiles, this.GetFRSearch());
         }
         else return null;
     }
     else return new FRConfiguration(path, mask, recursive, this.GetFRSearch());
 }