private ulong displayValue(FolderSize folderSize) { switch (sizeValue) { case SizeValue.PHYSICAL: return(folderSize.physicalSize); case SizeValue.LOGICAL: return(folderSize.logicalSize); case SizeValue.ALLOCATED: return(folderSize.diskSize); case SizeValue.WASTED: return(folderSize.diskSize - folderSize.physicalSize); case SizeValue.FILECOUNT: return((ulong)folderSize.fileCount); case SizeValue.FOLDERCOUNT: return((ulong)folderSize.folderCount); case SizeValue.ALLCOUNT: return((ulong)(folderSize.fileCount + folderSize.folderCount)); default: throw new Exception(); } }
internal void Subtract(FolderSize other) { this.fileCount -= other.fileCount; this.folderCount -= other.folderCount; this.logicalSize -= other.logicalSize; this.physicalSize -= other.physicalSize; this.diskSize -= other.diskSize; }
internal void Add(FolderSize other) { this.fileCount += other.fileCount; this.folderCount += other.folderCount; this.logicalSize += other.logicalSize; this.physicalSize += other.physicalSize; this.diskSize += other.diskSize; }
public SizeNode(string displayName, string iconName, ScanState state, FolderSize size, Icon icon, string path) { this.displayName = displayName; this.iconName = iconName; this.state = state; this.size = size; this.icon = icon; this.path = path; if (icon == null) { throw new ArgumentNullException(); } }
public void Update() { if (folderInfo == null) { return; } this.size = folderInfo.Size; this.state = folderInfo.State; if (fileSummaries.Count == 0 && (folderInfo.State == ScanState.SCANNING || folderInfo.State == ScanState.DONE)) { FillInFiles(); // If there are no files or directories below, load "them" immediately // to remove the dummy node. if (folderInfo.Children.Count == 0 && folderInfo.AllFilesSize.fileCount == 0) { LoadChildren(); } } }
/* Implementierung der Add-Methode */ public void Add(FolderSize fs) { this.List.Add(fs); }
private string SizeString(SizeNode sn, SizeNode sizeParent, SizeNode sizeRoot) { FolderSize size = sn.Size; ScanState ss = sn.State; if (ss == ScanState.QUEUED) { return("QUEUED"); } if (ss == ScanState.SCANNING) { return("SCAN"); } if (size.fileCount == 0 && size.folderCount == 0 && size.childrenDenied) { return("DENIED"); } string den = size.childrenDenied ? "?" : ""; ulong dsize = displayValue(size); if (sizeValue >= SizeValue.ALLCOUNT) { if (displayMode != DisplayMode.PERCENT && displayMode != DisplayMode.PERCENTPARENT) { return(dsize.ToString(FORMAT) + den); } } switch (displayMode) { case DisplayMode.KB: return(RoundDiv(dsize, 1024).ToString(FORMAT) + " kb" + den); case DisplayMode.MB: return(RoundDiv(dsize, 1024 * 1024).ToString(FORMAT) + " MB" + den); case DisplayMode.GB: return(RoundDiv(dsize, 1024 * 1024 * 1024).ToString(FORMAT) + " GB" + den); case DisplayMode.MIXED: { ulong kb = RoundDiv(dsize, 1024); if (kb < 100 * 1024) { return(kb.ToString(FORMAT) + " kb" + den); } else { return((kb / 1024).ToString(FORMAT) + " MB" + den); } } case DisplayMode.PERCENT: return(MakePercent(dsize, sizeRoot) + den); case DisplayMode.PERCENTPARENT: return(MakePercent(dsize, sizeParent) + den); default: throw new Exception(); } }