예제 #1
0
 private XElement CreateXmlElement(DirectoryElement directoryElement)
 {
     return
         (new XElement(directoryElement.Kind.ToString(),
                       new XAttribute("Name", directoryElement.Name),
                       new XAttribute("CreationTime", directoryElement.CreationTime.ToString("yyyy-MM-dd")),
                       new XAttribute("ModificationTime", directoryElement.ModificationTime.ToString("yyyy-MM-dd")),
                       new XAttribute("LastAccessTime", directoryElement.LastAccessTime.ToString("yyyy-MM-dd")),
                       new XAttribute("Attributes", directoryElement.Attributes),
                       new XAttribute("Owner", directoryElement.Owner),
                       new XAttribute("Size", directoryElement.Size)));
 }
예제 #2
0
        private void AddDirectoryToCache(DirectoryElement directoryElement, XElement xmlElement)
        {
            if (directoryElement.Kind != DirectoryElementKind.Directory && directoryElement.Kind != DirectoryElementKind.Root)
            {
                return;
            }

            _cachedLastXmlElements.TryGetValue(directoryElement.Level, out var cacheItem);
            SetDirectorySize(cacheItem);

            _cachedLastXmlElements[directoryElement.Level] = new XmlDirectoryItem(xmlElement);
        }
예제 #3
0
        private void UpdateDirectoriesSize(DirectoryElement directoryElement)
        {
            if (directoryElement.Kind != DirectoryElementKind.File)
            {
                return;
            }

            foreach (var lastXmlElement in _cachedLastXmlElements)
            {
                if (lastXmlElement.Key >= directoryElement.Level)
                {
                    continue;
                }

                lastXmlElement.Value.Size += directoryElement.Size;
            }
        }
예제 #4
0
 private void AddFoundElement(DirectoryElement foundElement)
 {
     FoundDataForTreeView.Enqueue(foundElement);
     FoundDataForXml.Enqueue(foundElement);
 }