Ejemplo n.º 1
0
 private void showList(IDirItem node)
 {
     listView1.BeginUpdate();
     listView1.Items.Clear();
     LItems.Clear();
     if (node.IsDir())
     {
         foreach (IDirItem di in node.Childs())
         {
             var item = new ListViewItem();
             LItems.Add(item, di);
             item.Name = di.Name();
             item.Text = di.Name();
             var itemSize  = new ListViewItem.ListViewSubItem();
             var itemType  = new ListViewItem.ListViewSubItem();
             var itemCount = new ListViewItem.ListViewSubItem();
             itemSize.Name  = di.Name();
             itemSize.Text  = "";
             itemType.Name  = di.Name();
             itemType.Text  = "";
             itemCount.Name = di.Name();
             itemCount.Text = "1";
             if (di is ISize)
             {
                 itemSize.Text = SizeStr(((ISize)di).Size());
             }
             if (di is ICount)
             {
                 itemCount.Text = ((ICount)di).Count().ToString();
             }
             var group = GroupFile;
             if (di is PointFile)
             {
                 itemType.Text = "Файл";
                 group         = GroupFile;
             }
             else if (di is PointTree)
             {
                 itemType.Text = "Точка востановления";
                 group         = GroupDir;
             }
             else if (di.IsDir())
             {
                 itemType.Text = "Папка";
                 group         = GroupDir;
             }
             item.Group = group;
             item.SubItems.Add(itemSize);
             item.SubItems.Add(itemType);
             item.SubItems.Add(itemCount);
             listView1.Items.Add(item);
         }
     }
     listView1.EndUpdate();
 }
Ejemplo n.º 2
0
 public bool RestoreAll(IDirItem item, string path, StatRestore stat = null)
 {
     if (!Restore(item, path, stat))
     {
         return(false);
     }
     if (item.IsDir())
     {
         foreach (IDirItem subitem in item.Childs())
         {
             if (!RestoreAll(subitem, Path.Combine(path, subitem.Name()), stat))
             {
                 return(false);
             }
         }
     }
     return(true);
 }