コード例 #1
0
ファイル: ShortcutProjectItem.cs プロジェクト: ikvm/webmatrix
 protected override void CreateChildItems()
 {
     DirectoryInfo info = new DirectoryInfo(this.Path);
     try
     {
         int num;
         DirectoryInfo[] directories = info.GetDirectories();
         int length = directories.Length;
         FileInfo[] files = info.GetFiles();
         int num3 = files.Length;
         ArrayList list = new ArrayList(length + num3);
         for (num = 0; num < length; num++)
         {
             if ((directories[num].Attributes & (FileAttributes.System | FileAttributes.Hidden)) == 0)
             {
                 ProjectItem item = new DirectoryProjectItem(directories[num].Name);
                 list.Add(item);
             }
         }
         for (num = 0; num < num3; num++)
         {
             if ((files[num].Attributes & (FileAttributes.System | FileAttributes.Hidden)) == 0)
             {
                 ProjectItem item2 = new FileProjectItem(files[num].Name);
                 list.Add(item2);
             }
         }
         list.Sort(this.Project.ProjectItemComparer);
         foreach (ProjectItem item3 in list)
         {
             base.AddChildItem(item3);
         }
     }
     catch
     {
     }
     base.CreateChildItems();
 }
コード例 #2
0
 protected override void CreateChildItems()
 {
     string[] logicalDrives = Environment.GetLogicalDrives();
     int length = logicalDrives.Length;
     for (int i = 0; i < length; i++)
     {
         switch (Interop.GetDriveType(logicalDrives[i]))
         {
             case 3:
             {
                 ProjectItem item = new DirectoryProjectItem(logicalDrives[i], true, false);
                 base.AddChildItem(item);
                 break;
             }
             case 4:
             {
                 ProjectItem item2 = new DirectoryProjectItem(logicalDrives[i], false, true);
                 base.AddChildItem(item2);
                 break;
             }
         }
     }
     base.CreateChildItems();
 }