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))); }
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); }
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; } }
private void AddFoundElement(DirectoryElement foundElement) { FoundDataForTreeView.Enqueue(foundElement); FoundDataForXml.Enqueue(foundElement); }