// Copies a directory and all it's subdirectories
        // From https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
        public static void DirectoryCopy(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.
            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, true);
            }

            // 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);
                    Filesystem.DirectoryCopy(subdir.FullName, tempPath, copySubDirs);
                }
            }
        }
Example #2
0
        static void CompressPlugin(UE4InstallInfo Install, string PluginDirectory, string PluginVersion)
        {
            Filesystem.SafeCreateDirectory("tmp");
            Filesystem.DirectoryCopy(PluginDirectory, "tmp/modio", true);

            ZipFile.CreateFromDirectory("tmp/modio", string.Format("PluginStaging_ALL/modio-{0}-{1}.zip",
                                                                   PluginVersion,
                                                                   Install.GetCleanAppName())
                                        );

            Directory.Delete("tmp", true);
            // We have no need of the plugin directory after this
            Directory.Delete(PluginDirectory, true);
        }
Example #3
0
 /** Add the config to the plugin as we has redistrubuted this config directory with each plugin */
 static void AddConfigFiles(string PluginDirectory)
 {
     Filesystem.DirectoryCopy(@"../Config/", PluginDirectory + @"/Config/", true);
 }