From fc703faaa6326e28e146e00615db01c48ded0ece Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 16 Nov 2017 18:07:34 +0200 Subject: Implemented PMR for CCS! First test working. Parsed and returned Calculate Stub! Implemented custom proto C compiling to achieve shorter struct names! --- .../Visual_Studio/Tango.Core/Helpers/PathHelper.cs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'Software/Visual_Studio/Tango.Core') diff --git a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs index fa52eb42b..dd613ac5e 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs @@ -28,5 +28,44 @@ namespace Tango.Core.Helpers return false; } } + + + public static void CopyDirectory(string sourceDirName, string destDirName, bool copySubDirs) + { + // Get the subdirectories for the specified directory. + DirectoryInfo dir = new DirectoryInfo(sourceDirName); + + if (!dir.Exists) + { + throw new DirectoryNotFoundException( + "Source directory does not exist or could not be found: " + + sourceDirName); + } + + DirectoryInfo[] dirs = dir.GetDirectories(); + // If the destination directory doesn't exist, create it. + if (!Directory.Exists(destDirName)) + { + Directory.CreateDirectory(destDirName); + } + + // Get the files in the directory and copy them to the new location. + FileInfo[] files = dir.GetFiles(); + foreach (FileInfo file in files) + { + string temppath = Path.Combine(destDirName, file.Name); + file.CopyTo(temppath, false); + } + + // If copying subdirectories, copy them and their contents to new location. + if (copySubDirs) + { + foreach (DirectoryInfo subdir in dirs) + { + string temppath = Path.Combine(destDirName, subdir.Name); + CopyDirectory(subdir.FullName, temppath, copySubDirs); + } + } + } } } -- cgit v1.3.1