Exemplo n.º 1
0
        public int Compare(object x, object y)
        {
            FileSystemEntryNode fileSystemEntryNode1 = (FileSystemEntryNode)x;
            FileSystemEntryNode fileSystemEntryNode2 = (FileSystemEntryNode)y;

            if (fileSystemEntryNode1 is ScriptDirectoryNode)
            {
                if (fileSystemEntryNode2 is ScriptDirectoryNode)
                {
                    return(string.Compare(fileSystemEntryNode1.Text, fileSystemEntryNode2.Text));
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                if (!(fileSystemEntryNode1 is ScriptFileNode))
                {
                    return(0);
                }
                if (fileSystemEntryNode2 is ScriptFileNode)
                {
                    return(string.Compare(fileSystemEntryNode1.Text, fileSystemEntryNode2.Text));
                }
                else
                {
                    return(1);
                }
            }
        }
Exemplo n.º 2
0
 private void watcher_Created(object sender, FileSystemEventArgs e)
 {
     if (this.InvokeRequired)
     {
         this.Invoke((Delegate) new FileSystemEventHandler(this.watcher_Created), sender, (object)e);
     }
     else
     {
         List <string> list = new List <string>((IEnumerable <string>) this.SplitName(e.Name));
         string        name = Enumerable.Last <string>((IEnumerable <string>)list);
         list.RemoveAt(list.Count - 1);
         FileSystemEntryNode entryNode = this.FindEntryNode(list.ToArray());
         if (entryNode == null)
         {
             return;
         }
         FileSystemEntryNode fileSystemEntryNode = (FileSystemEntryNode)null;
         if (Directory.Exists(e.FullPath))
         {
             fileSystemEntryNode = (FileSystemEntryNode) new ScriptDirectoryNode(name);
             fileSystemEntryNode.ContextMenuStrip = this.ctxDirectoryNode;
         }
         if (File.Exists(e.FullPath) && !e.FullPath.ToLower().EndsWith(".settings"))
         {
             fileSystemEntryNode = (FileSystemEntryNode) new ScriptFileNode(name);
             (fileSystemEntryNode as ScriptFileNode).File = new FileInfo(e.FullPath);
             fileSystemEntryNode.ContextMenuStrip         = this.ctxFileNode;
         }
         if (fileSystemEntryNode == null)
         {
             return;
         }
         entryNode.Nodes.Add((TreeNode)fileSystemEntryNode);
     }
 }
Exemplo n.º 3
0
 private void watcher_Renamed(object sender, RenamedEventArgs e)
 {
     if (this.InvokeRequired)
     {
         this.Invoke((Delegate) new RenamedEventHandler(this.watcher_Renamed), sender, (object)e);
     }
     else
     {
         FileSystemEntryNode entryNode = this.FindEntryNode(e.OldName);
         if (entryNode == null)
         {
             return;
         }
         ScriptFileNode[] scriptFileNodeArray = (ScriptFileNode[])null;
         if (entryNode is ScriptDirectoryNode)
         {
             scriptFileNodeArray = this.GetFileSubNodes((ScriptDirectoryNode)entryNode);
         }
         if (entryNode is ScriptFileNode)
         {
             scriptFileNodeArray = new ScriptFileNode[1]
             {
                 (ScriptFileNode)entryNode
             }
         }
         ;
         foreach (TreeNode node in scriptFileNodeArray)
         {
             Global.EditorManager.Close(this.GetFullPath(node));
         }
         List <string> list = new List <string>((IEnumerable <string>) this.SplitName(e.Name));
         entryNode.RenameTo(Enumerable.Last <string>((IEnumerable <string>)list));
         this.treeView.Sort();
     }
 }
Exemplo n.º 4
0
        private FileSystemEntryNode FindEntryNode(string[] items)
        {
            FileSystemEntryNode fileSystemEntryNode = (FileSystemEntryNode)this.treeView.Nodes[0];

            foreach (string index in items)
            {
                fileSystemEntryNode = (FileSystemEntryNode)fileSystemEntryNode.Nodes[index];
                if (fileSystemEntryNode == null)
                {
                    break;
                }
            }
            return(fileSystemEntryNode);
        }
Exemplo n.º 5
0
 private void watcher_Deleted(object sender, FileSystemEventArgs e)
 {
     if (this.InvokeRequired)
     {
         this.Invoke((Delegate) new FileSystemEventHandler(this.watcher_Deleted), sender, (object)e);
     }
     else
     {
         Global.EditorManager.Close(e.FullPath);
         FileSystemEntryNode entryNode = this.FindEntryNode(e.Name);
         if (entryNode == null)
         {
             return;
         }
         entryNode.Remove();
     }
 }