本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile.MoveFile方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile.MoveFile方法的具体用法?C# IsolatedStorageFile.MoveFile怎么用?C# IsolatedStorageFile.MoveFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.IsolatedStorage.IsolatedStorageFile
的用法示例。
在下文中一共展示了IsolatedStorageFile.MoveFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rename
/// <summary>
/// Changes the name of this savegame.
/// </summary>
/// <param name="tag"></param>
/// <param name="name"></param>
public void Rename(CartridgeTag tag, string name, IsolatedStorageFile isf)
{
string oldGwsFile = SavegameFile;
string oldMdFile = MetadataFile;
// Changes the properties.
Name = name;
SetFileProperties(tag);
// Renames the files.
if (isf.FileExists(oldGwsFile))
{
isf.MoveFile(oldGwsFile, SavegameFile);
}
if (isf.FileExists(oldMdFile))
{
isf.MoveFile(oldMdFile, MetadataFile);
}
}
示例2: recoverAccountItems
private void recoverAccountItems(IsolatedStorageFile isolatedStorage, Dictionary<string, List<AccountItem>> transactionItems, List<string> fileMessages, List<Guid> accountIds, List<Guid> categoryIds = null)
{
var sum = 0;
foreach (var pair in transactionItems)
{
var file = pair.Key;
int num2 = 0;
try
{
var allTasks = this.dataContext.TallyScheduleTable.Where(p => p.ProfileRecordType == ScheduleRecordType.ScheduledRecord)
.ToList();
var taskId = Guid.Empty;
TallySchedule taskInfo = allTasks.Count > 0 ? allTasks[0] : null;
foreach (var item in pair.Value)
{
if (accountIds.Count(p => p == item.AccountId) > 0 && categoryIds.Count(p => p == item.CategoryId) > 0)
{
if (taskInfo != null && taskInfo.Id != item.AutoTokenId)
{
taskInfo = allTasks.FirstOrDefault(p => p.Id == item
.AutoTokenId);
}
ExpenseOrIncomeScheduleHanlder.RecoverItemProcessor(item, taskInfo);
sum++;
}
else
{
fileMessages.Add("Failed to add item: {0}, cause of account or category mismatched.".FormatWith(new object[] { item.Id }));
}
}
}
catch (System.Exception exception2)
{
num2++;
string destinationFileName = pair.Key.Replace(".xml", ".err.xml");
fileMessages.Add("Failed to add items in file: {0}, cause of account or category mismatched. Have Renamed data file to {1}. details:\r\n{2}".FormatWith(new object[] { pair.Key, destinationFileName, exception2.Message }));
isolatedStorage.MoveFile(file, destinationFileName);
}
if (num2 > 0)
{
this.SaveErrorsTo("recoveryDataError.log", new string[] { "Some items can't add to database.\r\n" + fileMessages.ToStringLine<string>("\r\n") });
}
else
{
isolatedStorage.DeleteFile(file);
}
}
this.dataContext.SubmitChanges();
}
示例3: MoveOldCrashlogsIfNeeded
public void MoveOldCrashlogsIfNeeded(IsolatedStorageFile store)
{
try
{
if (store.DirectoryExists(Constants.OldCrashDirectoryName))
{
var files = store.GetFileNames(Path.Combine(Constants.OldCrashDirectoryName, Constants.CrashFilePrefix + "*.log"));
if (files.Length > 0)
{
if (!store.DirectoryExists(Constants.CrashDirectoryName))
{
store.CreateDirectory(Constants.CrashDirectoryName);
}
foreach (var fileName in files)
{
store.MoveFile(Path.Combine(Constants.OldCrashDirectoryName, Path.GetFileName(fileName)), Path.Combine(Constants.CrashDirectoryName, Path.GetFileName(fileName)));
}
if (store.GetFileNames(Path.Combine(Constants.OldCrashDirectoryName, Constants.CrashFilePrefix + "*.*")).Length == 0)
{
store.DeleteDirectory(Constants.OldCrashDirectoryName);
}
}
}
}
catch (Exception e)
{
HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e);
}
}
示例4: recoverTransferingItems
private void recoverTransferingItems(IsolatedStorageFile isolatedStorage, Dictionary<string, List<TransferingItem>> transferingItems, List<string> fileMessages, List<Guid> accountIds)
{
var sum = 0;
foreach (var pair in transferingItems)
{
var file = pair.Key;
int num2 = 0;
try
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
foreach (var item in pair.Value)
{
if ((accountIds.Count(p => p == item.FromAccountId) > 0)
&& (accountIds.Count(p => p == item.ToAccountId) > 0))
{
sum++;
TransferingItemTaskHandler.RecoverItemProcessor(item);
}
else
{
fileMessages.Add("Failed to add item: {0}, cause of account missed.".FormatWith(new object[] { item.Id }));
}
}
});
}
catch (System.Exception exception2)
{
num2++;
string destinationFileName = pair.Key.Replace(".xml", ".err.xml");
fileMessages.Add("Failed to add items in file: {0}, cause of account or category mismatched. Have Renamed data file to {1}. details:\r\n{2}".FormatWith(new object[] { pair.Key, destinationFileName, exception2.Message }));
isolatedStorage.MoveFile(file, destinationFileName);
}
if (num2 > 0)
{
this.SaveErrorsTo("recoveryDataError.log", new string[] { "Some items can't add to database.\r\n" + fileMessages.ToStringLine<string>("\r\n") });
}
else
{
isolatedStorage.DeleteFile(file);
}
}
this.dataContext.SubmitChanges();
}
示例5: RenameNote
public static void RenameNote(string orig, string change, IsolatedStorageFile iStorage)
{
iStorage.MoveFile(orig + ".scribble", change + ".scribble");
}