Repository navigation
Expand file tree
/
Copy pathAFSdialog.cs
More file actions
83 lines (70 loc) · 2.4 KB
/
Copy pathAFSdialog.cs
File metadata and controls
83 lines (70 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using netCommander.FileSystemEx;
using System.IO;
namespace netCommander
{
public partial class AFSdialog : Form
{
public AFSdialog()
{
InitializeComponent();
}
public AFSdialog(string file_name)
{
InitializeComponent();
internal_file_name = file_name;
if (!check_volume(file_name))
{
Messages.ShowMessage("File system not support named streams.");
return;
}
Text = string.Format("File streams [{0}]", file_name);
fill_listview(file_name);
}
private string internal_file_name;
private bool check_volume(string file_name)
{
string root_path = Path.GetPathRoot(file_name);
VolumeInfo vi = new VolumeInfo(root_path);
return ((vi.FileSystemFlags & VolumeCaps.NamedStreams) == VolumeCaps.NamedStreams);
}
private void fill_listview(string file_name)
{
List<Wrapper.FileStreamInfo> stream_list = Wrapper.GetFileStreamInfo_fromBackup(file_name, true);
foreach (Wrapper.FileStreamInfo data in stream_list)
{
InternalListViewItem new_item = new InternalListViewItem(data);
listViewResult.Items.Add(new_item);
}
if (listViewResult.Items.Count > 0)
{
listViewResult.Items[0].Selected = true;
}
}
private class InternalListViewItem : ListViewItem
{
public Wrapper.FileStreamInfo InternalData { get; private set; }
public InternalListViewItem(Wrapper.FileStreamInfo data)
{
InternalData = data;
if (data.Name == string.Empty)
{
Text = "<Default stream>";
}
else
{
Text = data.Name;
}
SubItems.Add(data.Size.ToString("#,##0"));
SubItems.Add(data.ID.ToString());
SubItems.Add(data.Attributes.ToString());
}
}
}
}