-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.cpp
More file actions
68 lines (55 loc) · 1.26 KB
/
Directory.cpp
File metadata and controls
68 lines (55 loc) · 1.26 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
// Directory.cpp : implementation file
//
#include "pch.h"
#include "CdBurnApp.h"
#include "Directory.h"
// Directory
IMPLEMENT_DYNAMIC(Directory, Base)
Directory::Directory(const CString& path) : Base(path)
{
CFileFind fileFind;
BOOL work = fileFind.FindFile(path + _T("\\*.*"));
while (work)
{
work = fileFind.FindNextFileW();
if (fileFind.IsDots())
{
continue;
}
if (fileFind.IsDirectory())
{
Directory* pDirectory = new Directory(fileFind.GetFilePath());
}
else {
Directory* pDirectory = new Directory(fileFind.GetFilePath());
}
}
}
Directory::~Directory()
{
INT_PTR directoryCount = m_directoryArray.GetCount();
for (INT_PTR i = 0; i < directoryCount; i++)
{
delete m_directoryArray.GetAt(i);
}
INT_PTR fileCount = m_fileArray.GetCount();
for (INT_PTR j = 0; j < fileCount; j++)
{
delete m_fileArray.GetAt(j);
}
}
// Directory message handlers
ULONGLONG Directory::GetSize() {
ULONGLONG sizeOnDisc=0;
INT_PTR directoryCount = m_directoryArray.GetCount();
for (INT_PTR i = 0; i < directoryCount; i++)
{
sizeOnDisc += m_directoryArray.GetAt(i)->GetSize();
}
INT_PTR fileCount = m_fileArray.GetCount();
for (INT_PTR j = 0; j < fileCount; j++)
{
sizeOnDisc += m_fileArray.GetAt(j)->GetSize();
}
return sizeOnDisc;
}