本文整理匯總了C#中System.IO.File.Rename方法的典型用法代碼示例。如果您正苦於以下問題:C# File.Rename方法的具體用法?C# File.Rename怎麽用?C# File.Rename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.File
的用法示例。
在下文中一共展示了File.Rename方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Init
//.........這裏部分代碼省略.........
}
catch (IsolatedStorageException e)
{
MoSync.Util.Log(e);
return MoSync.Constants.MA_FERR_GENERIC;
}
return 0;
};
ioctls.maFileSize = delegate(int _file)
{
File file = mFileHandles[_file];
return file.Size();
};
ioctls.maFileAvailableSpace = delegate(int _file)
{
File file = mFileHandles[_file];
return file.AvailableSpace();
};
ioctls.maFileTotalSpace = delegate(int _file)
{
File file = mFileHandles[_file];
return file.TotalSpace();
};
ioctls.maFileDate = delegate(int _file)
{
File file = mFileHandles[_file];
return Util.ToUnixTimeUtc(file.Date().ToFileTime());
};
ioctls.maFileRename = delegate(int _file, int _newName)
{
File file = mFileHandles[_file];
String newName = core.GetDataMemory().ReadStringAtAddress(_newName);
newName = ConvertPath(newName);
if (newName.Contains("\\"))
{
if (newName[0] != '\\')
throw new Exception("Invalid newName");
}
else
{ // add directory of old file.
newName = Path.GetDirectoryName(file.Path) + "\\" + newName;
}
file.Rename(newName);
return 0;
};
ioctls.maFileTruncate = delegate(int _file, int _offset)
{
File file = mFileHandles[_file];
file.Truncate(_offset);
return 0;
};
ioctls.maFileListStart = delegate(int _path, int _filter, int _sorting)
{
// todo: respect _sorting.
String path = core.GetDataMemory().ReadStringAtAddress(_path);
path = ConvertPath(path);
String filter = core.GetDataMemory().ReadStringAtAddress(_filter);
String pattern = path + filter;
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();