From c40232fabf81c36a8bc2260fc39bc1385b6aeb8f Mon Sep 17 00:00:00 2001 From: alcexhim Date: Fri, 17 Apr 2015 17:30:30 -0400 Subject: [PATCH] Implemented Folder.GetSize() --- .../ObjectModels/FileSystem/Folder.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/Folder.cs b/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/Folder.cs index 1af6eb44..6175c34f 100644 --- a/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/Folder.cs +++ b/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/Folder.cs @@ -109,5 +109,23 @@ namespace UniversalEditor.ObjectModels.FileSystem clone.Name = mvarName; return clone; } + + /// + /// Recursively gets the size of this and all the contained files. + /// + /// + public long GetSize() + { + long size = 0; + foreach (File file in mvarFiles) + { + size += file.Size; + } + foreach (Folder folder in mvarFolders) + { + size += folder.GetSize(); + } + return size; + } } }