mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-11 16:20:26 +08:00
28 lines
944 B
C#
28 lines
944 B
C#
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.Threading.Tasks;
|
|
using Windows.Storage;
|
|
using Windows.Storage.Streams;
|
|
|
|
namespace ReactNative.CodePush
|
|
{
|
|
class FileUtils
|
|
{
|
|
public async static Task MergeDirectories(StorageFolder source, StorageFolder target)
|
|
{
|
|
foreach (StorageFile sourceFile in await source.GetFilesAsync())
|
|
{
|
|
await sourceFile.CopyAndReplaceAsync(await target.CreateFileAsync(sourceFile.Name, CreationCollisionOption.OpenIfExists));
|
|
}
|
|
|
|
foreach (StorageFolder sourceDirectory in await source.GetFoldersAsync())
|
|
{
|
|
StorageFolder nextTargetSubDir = await target.CreateFolderAsync(sourceDirectory.Name, CreationCollisionOption.OpenIfExists);
|
|
await MergeDirectories(sourceDirectory, nextTargetSubDir);
|
|
}
|
|
}
|
|
}
|
|
}
|