void buildInfo(string path, _info info) { if (WFContext.BreakExecution) throw new Exception("Workflow cancelled. "); var files = WAFRuntime.FileSystem.GetFiles(path); var dirs = WAFRuntime.FileSystem.GetDirectories(path); if (files.Length == 0 && dirs.Length == 0) info.EmptyFolderCount++; foreach (string file in files) { var fi = WAFRuntime.FileSystem.GetFileInfo(file); info.TotalFileCount++; info.Bytes += fi.Length; if (file.Contains("_cached_")) { info.CachedFileCount++; info.CachedFileSize += fi.Length; } } foreach (string child in dirs) { info.FolderCount++; buildInfo(child, info); } WFContext.Info.Description = info.FolderCount.ToString("### ### ##0") + " folders and " + info.TotalFileCount.ToString("### ### ##0") + " files..."; }
set => SetProperty(ref _info, value);
public override NextCall Invoke(WorkflowMethod invoker) { WFContext.Info.Caption = "Examining file system..."; WFContext.Info.InBackgroundMode = false; WFContext.Info.Description = "Please wait..."; _info info = new _info(); WFContext.Info.Description = "Examining temp files and folders..."; getDirInfo(WAFRuntime.Engine.FileTempPath, ref info.FileSizeTempFolder, ref info.FileCountTempFolder, ref info.FolderCountTempFolder); WFContext.Info.Description = "Examining uploaded files and folders..."; getDirInfo(WAFContext.PathFromRootToFolderUpload, ref info.FileSizeUploadFolder, ref info.FileCountUploadFolder, ref info.FolderCountUploadFolder); buildInfo(WAFContext.PathFromRootToAppFolder, info); StringBuilder sb = new StringBuilder(); sb.AppendLine("Total size: " + Utils.GetByteSizeString(info.Bytes)); sb.AppendLine(); sb.AppendLine("Total file count: " + info.TotalFileCount.ToString("### ### ##0")); sb.AppendLine("Total folder count: " + info.FolderCount.ToString("### ### ##0")); sb.AppendLine("Empty folder count: " + info.EmptyFolderCount.ToString("### ### ##0")); sb.AppendLine(); sb.AppendLine("Cached file count: " + info.CachedFileCount.ToString("### ### ##0")); sb.AppendLine("Cached filesize: " + Utils.GetByteSizeString(info.CachedFileSize)); sb.AppendLine(); sb.AppendLine("Temp filesize: " + Utils.GetByteSizeString(info.FileSizeTempFolder)); sb.AppendLine("Temp file count: " + info.FileCountTempFolder.ToString("### ### ##0")); sb.AppendLine("Temp folder count: " + info.FolderCountTempFolder.ToString("### ### ##0")); sb.AppendLine(); sb.AppendLine("Upload filesize: " + Utils.GetByteSizeString(info.FileSizeUploadFolder)); sb.AppendLine("Upload file count: " + info.FileCountUploadFolder.ToString("### ### ##0")); sb.AppendLine("Upload folder count: " + info.FolderCountUploadFolder.ToString("### ### ##0")); WFContext.Notify(Session.UserId, sb.ToString(), "Filesystem statistics:"); return null; }