Example #1
0
 /// <summary>
 /// Get .NET-compatible file access value.
 /// </summary>
 /// <param name="oflag"></param>
 /// <param name="pmode"></param>
 /// <returns></returns>
 public static FileAccess FileAccessFromDos(Rtl.OFLAG oflag, Rtl.PMODE pmode)
 {
     if (0 != (oflag & Rtl.OFLAG._O_RDONLY))
     {
         return(FileAccess.Read);
     }
     else if (0 == (pmode & Rtl.PMODE._S_IWRITE))
     {
         return(FileAccess.Read);
     }
     else
     {
         return(FileAccess.ReadWrite);
     }
 }
Example #2
0
 /// <summary>
 /// Get .NET-compatible file mode value.
 /// </summary>
 /// <param name="oflag"></param>
 /// <returns></returns>
 public static FileMode FileModeFromDos(Rtl.OFLAG oflag)
 {
     if (0 != (oflag & Rtl.OFLAG._O_TRUNC))
     {
         return(FileMode.Create);
     }
     else if (0 != (oflag & Rtl.OFLAG._O_CREAT))
     {
         return(FileMode.OpenOrCreate);
     }
     else if (0 != (oflag & Rtl.OFLAG._O_APPEND))
     {
         return(FileMode.Append);
     }
     else
     {
         return(FileMode.Open);
     }
 }