本文整理汇总了C#中MonoIOError类的典型用法代码示例。如果您正苦于以下问题:C# MonoIOError类的具体用法?C# MonoIOError怎么用?C# MonoIOError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonoIOError类属于命名空间,在下文中一共展示了MonoIOError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplaceFile
public static bool ReplaceFile (string sourceFileName,
string destinationFileName,
string destinationBackupFileName,
bool ignoreMetadataErrors,
out MonoIOError error)
{
throw new System.NotImplementedException();
}
示例2: GetException
// error methods
public static Exception GetException (MonoIOError error)
{
/* This overload is currently only called from
* File.MoveFile(), Directory.Move() and
* Directory.GetCurrentDirectory() -
* everywhere else supplies a path to format
* with the error text.
*/
switch(error) {
case MonoIOError.ERROR_ACCESS_DENIED:
return new UnauthorizedAccessException ("Access to the path is denied.");
case MonoIOError.ERROR_FILE_EXISTS:
string message = "Cannot create a file that already exist.";
return new IOException (message, FileAlreadyExistsHResult);
default:
/* Add more mappings here if other
* errors trigger the named but empty
* path bug (see bug 82141.) For
* everything else, fall through to
* the other overload
*/
return GetException (String.Empty, error);
}
}
示例3: ReplaceFile
public extern static bool ReplaceFile (string sourceFileName,
string destinationFileName,
string destinationBackupFileName,
bool ignoreMetadataErrors,
out MonoIOError error);
示例4: Close
public extern static bool Close (IntPtr handle,
out MonoIOError error);
示例5: OpenMutex_internal
private static extern IntPtr OpenMutex_internal (string name, MutexRights rights, out MonoIOError error);
示例6: SetFileTime
public static bool SetFileTime (string path,
int type,
long creation_time,
long last_access_time,
long last_write_time,
DateTime dateTime,
out MonoIOError error)
{
IntPtr handle;
bool result;
handle = Open (path, FileMode.Open,
FileAccess.ReadWrite,
FileShare.ReadWrite, FileOptions.None, out error);
if (handle == MonoIO.InvalidHandle)
return false;
switch (type) {
case 1:
creation_time = dateTime.ToFileTime ();
break;
case 2:
last_access_time = dateTime.ToFileTime ();
break;
case 3:
last_write_time = dateTime.ToFileTime ();
break;
}
result = SetFileTime (handle, creation_time,
last_access_time,
last_write_time, out error);
MonoIOError ignore_error;
Close (handle, out ignore_error);
return result;
}
示例7: SetCreationTime
public static bool SetCreationTime (string path,
DateTime dateTime,
out MonoIOError error)
{
return SetFileTime (path, 1, -1, -1, -1, dateTime, out error);
}
示例8: ExistsDirectory
public static bool ExistsDirectory (string path,
out MonoIOError error)
{
FileAttributes attrs = GetFileAttributes (path,
out error);
// Actually, we are looking for a directory, not a file
if (error == MonoIOError.ERROR_FILE_NOT_FOUND)
error = MonoIOError.ERROR_PATH_NOT_FOUND;
if (attrs == InvalidFileAttributes)
return false;
if ((attrs & FileAttributes.Directory) == 0)
return false;
return true;
}
示例9: ExistsFile
public static bool ExistsFile (string path,
out MonoIOError error)
{
FileAttributes attrs = GetFileAttributes (path,
out error);
if (attrs == InvalidFileAttributes)
return false;
if ((attrs & FileAttributes.Directory) != 0)
return false;
return true;
}
示例10: FindNext
public extern static string FindNext (IntPtr handle, out FileAttributes result_attr, out MonoIOError error);
示例11: FindFirst
public extern static string FindFirst (string path, string pattern, out FileAttributes result_attr, out MonoIOError error, out IntPtr handle);
示例12: GetFileType
public extern static MonoFileType GetFileType (IntPtr handle, out MonoIOError error);
示例13: SetFileAttributes
public extern static bool SetFileAttributes (string path, FileAttributes attrs, out MonoIOError error);
示例14: GetFileAttributes
public extern static FileAttributes GetFileAttributes (string path, out MonoIOError error);
示例15: GetLength
public extern static long GetLength (IntPtr handle,
out MonoIOError error);