From ab36940eafb5946c550102cb2dbc7baca4c6a122 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Fri, 28 Apr 2017 23:59:54 +0200 Subject: [PATCH] Added DictionaryFile, ListFile, LogFile --- Gaia/Files.cs | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Gaia/Files.cs b/Gaia/Files.cs index 75c3239..996df61 100644 --- a/Gaia/Files.cs +++ b/Gaia/Files.cs @@ -8,7 +8,7 @@ using System.Xml; namespace GAIA { - public class Files + namespace Files { //A File to save dictionaries public class DictionaryFile @@ -426,5 +426,39 @@ namespace GAIA save(); } } + + public class IOAdditions + { + public IOAdditions() + { + + } + + public bool copyDirectory(string sourcepath, string targetpath) + { + return copy(new DirectoryInfo(sourcepath), targetpath); + } + + private bool copy(DirectoryInfo di, string target) + { + + try + { + target += "/"+di.Name; + + foreach(var file in di.GetFiles()) + { + file.CopyTo(target + "/" + file.Name); + } + + foreach(var dir in di.GetDirectories()) + { + copy(dir, target); + } + return true; + } + catch { return false; } + } + } } }