コード例 #1
0
ファイル: Project.cs プロジェクト: 123marvin123/PawnPlus
        private void event_ItemDeleted(object sender, ItemEventArgs e)
        {
            if (this.Directories.Contains(e.Path) == true)
            {
                // Let's update directories path.
                foreach (string directoryPath in this.Directories.ToList())
                {
                    if (directoryPath.Length > e.Path.Length && directoryPath.Substring(0, e.Path.Length) == e.Path)
                    {
                        this.Directories.Remove(directoryPath);
                    }
                }

                // Let's update files path.
                foreach (string fileName in this.Files.ToList())
                {
                    if (fileName.Length > e.Path.Length && fileName.Substring(0, e.Path.Length) == e.Path)
                    {
                        this.Files.Remove(fileName);
                    }
                }

                this.Directories.Remove(e.Path);
            }
            else if (this.Files.Contains(e.Path) == true)
            {
                this.Files.Remove(e.Path);
            }
        }
コード例 #2
0
ファイル: Project.cs プロジェクト: 123marvin123/PawnPlus
 private void event_ItemAdded(object sender, ItemEventArgs e)
 {
     if (this.Directories.Contains(e.Path) == false && this.Files.Contains(e.Path) == false)
     {
         // If extension is null then it is a directory.
         if (string.IsNullOrEmpty(Path.GetExtension(e.Path)) == true)
         {
             this.Directories.Add(e.Path);
         }
         else
         {
             this.Files.Add(e.Path);
         }
     }
 }