本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile.CopyFile方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile.CopyFile方法的具体用法?C# IsolatedStorageFile.CopyFile怎么用?C# IsolatedStorageFile.CopyFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.IsolatedStorage.IsolatedStorageFile
的用法示例。
在下文中一共展示了IsolatedStorageFile.CopyFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyDirectory
public void CopyDirectory(string sourcePath, string destinationPath, IsolatedStorageFile iso)
{
if (!iso.DirectoryExists(sourcePath))
return;
var folders = iso.GetDirectoryNames(sourcePath + "/" + "*.*");
foreach (var folder in folders)
{
string sourceFolderPath = sourcePath + "/" + folder;
string destinationFolderPath = destinationPath + "/" + folder;
iso.CreateDirectory(destinationFolderPath);
CopyDirectory(sourceFolderPath, destinationFolderPath, iso);
}
foreach (var file in iso.GetFileNames(sourcePath + "/" + "*.*"))
{
string sourceFilePath = sourcePath + "/" + file;
string destinationFilePath = destinationPath + "/" + file;
iso.CopyFile(sourceFilePath, destinationFilePath);
}
}
示例2: CopyDirectory
private void CopyDirectory(string sourceDir, string destDir, IsolatedStorageFile isoFile)
{
string path = File.AddSlashToDirectory(sourceDir);
bool bExists = isoFile.DirectoryExists(destDir);
if (!bExists)
{
isoFile.CreateDirectory(destDir);
}
destDir = File.AddSlashToDirectory(destDir);
string[] files = isoFile.GetFileNames(path + "*");
if (files.Length > 0)
{
foreach (string file in files)
{
isoFile.CopyFile(path + file, destDir + file, true);
}
}
string[] dirs = isoFile.GetDirectoryNames(path + "*");
if (dirs.Length > 0)
{
foreach (string dir in dirs)
{
CopyDirectory(path + dir, destDir + dir, isoFile);
}
}
}
示例3: CacheForMerge
private void CacheForMerge(IsolatedStorageFile appStorage)
{
if (appStorage.FileExists("MergeCache"))
{
appStorage.DeleteFile("MergeCache");
}
appStorage.CopyFile(GetFileName(), "MergeCache");
}
示例4: CopyDirectory
private static void CopyDirectory(string sourceDir, string destDir, IsolatedStorageFile isoFile)
{
string path;
if (sourceDir.EndsWith("\\"))
{
path = sourceDir;
}
else
{
path = sourceDir + "\\";
}
bool bExists = isoFile.DirectoryExists(destDir);
if (!bExists)
{
isoFile.CreateDirectory(destDir);
}
if (!destDir.EndsWith("\\"))
{
destDir += "\\";
}
string[] files = isoFile.GetFileNames(path + "*");
if (files.Length > 0)
{
foreach (string file in files)
{
isoFile.CopyFile(path + file, destDir + file, true);
}
}
string[] dirs = isoFile.GetDirectoryNames(path + "*");
if (dirs.Length > 0)
{
foreach (string dir in dirs)
{
CopyDirectory(path + dir, destDir + dir, isoFile);
}
}
}