Example #1
0
        private static bool CopyFolderContents(string SourcePath, string DestinationPath, ModManifest manifest = null)
        {
            SourcePath      = SourcePath.EndsWith(@"\") ? SourcePath : SourcePath + @"\";
            DestinationPath = DestinationPath.EndsWith(@"\") ? DestinationPath : DestinationPath + @"\";

            try
            {
                if (Directory.Exists(SourcePath))
                {
                    if (Directory.Exists(DestinationPath) == false)
                    {
                        Directory.CreateDirectory(DestinationPath);
                    }

                    foreach (string files in Directory.GetFiles(SourcePath))
                    {
                        FileInfo fileInfo = new FileInfo(files);

                        if (manifest != null)
                        {
                            // if (!ShouldIgnoreFile(fileInfo.Name, manifest))
                            //{
                            //    fileInfo.CopyTo(string.Format(@"{0}\{1}", DestinationPath, fileInfo.Name), true);
                            //}
                        }
                        else
                        {
                            fileInfo.CopyTo(string.Format(@"{0}\{1}", DestinationPath, fileInfo.Name), true);
                        }
                    }

                    foreach (string drs in Directory.GetDirectories(SourcePath))
                    {
                        DirectoryInfo directoryInfo = new DirectoryInfo(drs);
                        if (CopyFolderContents(drs, DestinationPath + directoryInfo.Name) == false)
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #2
0
 public static string ToJson(this ModManifest self) => JsonConvert.SerializeObject(self, Converter.Settings);