public void CopyFolder(string sourceFolder, string destFolder, ProductBuildInstance buildInstance, Range progressRange, IEnumerable <string> excludePaths = null)
        {
            if (!Directory.Exists(sourceFolder))
            {
                return;
            }

            Directory.CreateDirectory(destFolder);

            IEnumerable <FileInfo> allFiles = new DirectoryInfo(sourceFolder).GetFiles("*.*", SearchOption.AllDirectories).ToList();
            IEnumerable <string>   allDirs  = Directory.GetDirectories(sourceFolder, "*", SearchOption.AllDirectories).ToList();

            // filter if needed.
            if (excludePaths != null)
            {
                allFiles = allFiles.Where(file => excludePaths.All(p => !file.FullName.Contains(p)));
                allDirs  = allDirs.Where(dir => excludePaths.All(p => !dir.Contains(p)));
            }

            long totalLength = 0;

            foreach (var fileInfo in allFiles)
            {
                totalLength += fileInfo.Length;
            }

            foreach (string dirPath in allDirs)
            {
                if (Directory.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath.Replace(sourceFolder, destFolder));
                }
            }

            long processedLength = 0;

            foreach (var fileInfo in allFiles)
            {
                if (File.Exists(fileInfo.FullName))
                {
                    File.Copy(fileInfo.FullName, fileInfo.FullName.Replace(sourceFolder, destFolder), true);
                }

                if (buildInstance.RequestCancel)
                {
                    buildInstance.State = ProductBuildInstance.StateEnum.Cancelled;
                    return;
                }

                processedLength += fileInfo.Length;
                buildInstance.SetProgressWithRange((double)processedLength / (double)totalLength, progressRange);
            }
        }
        //[Browsable( false )]
        //public string SourcePlatformFolder
        //{
        //	get { return Path.Combine( VirtualFileSystem.Directories.Binaries, "NeoAxis.Internal\\Platforms", Platform.ToString() ); }
        //}

        public void CopyFiles(string sourceFolder, string destFolder, ProductBuildInstance buildInstance, Range progressRange, string searchPattern)
        {
            Directory.CreateDirectory(destFolder);

            var allFiles = new DirectoryInfo(sourceFolder).GetFiles(searchPattern, SearchOption.TopDirectoryOnly);

            long totalLength = allFiles.Sum(f => f.Length);

            long processedLength = 0;

            foreach (var fileInfo in allFiles)
            {
                if (File.Exists(fileInfo.FullName))
                {
                    File.Copy(fileInfo.FullName, fileInfo.FullName.Replace(sourceFolder, destFolder), true);
                }

                if (buildInstance.RequestCancel)
                {
                    buildInstance.State = ProductBuildInstance.StateEnum.Cancelled;
                    return;
                }

                processedLength += fileInfo.Length;
                buildInstance.SetProgressWithRange((double)processedLength / (double)totalLength, progressRange);
            }
        }