Beispiel #1
0
        void Visit(DirStat dir)
        {
            Dictionary<string, CalcData> temp = new Dictionary<string, CalcData>();

            Visit2(temp, dir);

            foreach (var item in temp)
            {
                ListModelData data = new ListModelData(item.Key, 0, string.Empty, item.Value.Bytes, 1.0 * item.Value.Bytes / dir.Length, item.Value.FileCount);

                items.Add(data);
            }
        }
Beispiel #2
0
        void Visit2(Dictionary<string, CalcData> temp, DirStat dir)
        {
            foreach (var file in dir.Files)
            {
                string ext = Path.GetExtension(file.Name);
                CalcData data;
                if (!temp.TryGetValue(ext, out data))
                {
                    data = new CalcData();
                    temp.Add(ext, data);
                }

                data.Bytes += file.Length;
                data.FileCount++;
            }

            foreach (var subDir in dir.Directories)
            {
                Visit2(temp, subDir);
            }
        }
Beispiel #3
0
 public DirStatModel(DirStat root)
 {
     this.root = root;
 }
Beispiel #4
0
 internal DirectoryTreeModelData(DirStat dir)
 {
     this.dir = dir;
 }