Beispiel #1
0
 /// <param name="st_dev">device number</param>
 /// <param name="st_ino">inode number</param>
 /// <param name="st_mode">inode protection mode</param>
 /// <param name="st_nlink">number of links</param>
 /// <param name="st_uid">userid of owner</param>
 /// <param name="st_gid">groupid of owner</param>
 /// <param name="st_rdev">device type, if inode device -1</param>
 /// <param name="st_size">size in bytes</param>
 /// <param name="st_atime">time of last access (unix timestamp)</param>
 /// <param name="st_mtime">time of last modification (unix timestamp)</param>
 /// <param name="st_ctime">time of last change (unix timestamp)</param>
 public StatStruct(
     uint st_dev           = 0,
     ushort st_ino         = 0,
     FileModeFlags st_mode = default,
     short st_nlink        = 1,
     short st_uid          = 0,
     short st_gid          = 0,
     uint st_rdev          = 0,
     long st_size          = 0,
     long st_atime         = 0,
     long st_mtime         = 0,
     long st_ctime         = 0)
 {
     this.st_dev   = st_dev;
     this.st_ino   = st_ino;
     this.st_mode  = st_mode;
     this.st_nlink = st_nlink;
     this.st_uid   = st_uid;
     this.st_gid   = st_gid;
     this.st_rdev  = st_rdev;
     this.st_size  = st_size;
     this.st_atime = st_atime;
     this.st_mtime = st_mtime;
     this.st_ctime = st_ctime;
 }
Beispiel #2
0
 public SftpOpen(uint channel, uint requestId, string path, FileModeFlags fileMode, string permissions = "")
     : base(channel, SftpMessageCode.SSH_FXP_OPEN)
 {
     this.RequestId  = requestId;
     this.Path       = path;
     this.FileMode   = fileMode;
     this.Attributes = SftpFileAttributes.ParsePermissions(permissions);
 }
Beispiel #3
0
 internal StatStruct(Mono.Unix.Native.Stat stat)
 {
     st_dev   = (uint)stat.st_dev;
     st_ctime = stat.st_ctime;
     st_mtime = stat.st_mtime;
     st_atime = stat.st_atime;
     //st_ctime = stat.st_ctime_nsec; // nano secs
     //st_mtime = stat.st_mtime_nsec; // nano secs
     //st_atime = stat.st_atime_nsec; // nano secs
     //stat.st_blocks;
     //stat.st_blksize;
     st_rdev  = (uint)stat.st_rdev;
     st_gid   = (short)stat.st_gid;
     st_uid   = (short)stat.st_uid;
     st_nlink = (short)stat.st_nlink;
     st_mode  = (FileModeFlags)stat.st_mode;
     st_ino   = (ushort)stat.st_ino;
     st_size  = stat.st_size;
 }
Beispiel #4
0
        public static string GetType(string path)
        {
            bool ok = StatInternal(path, false);

            if (!ok)
            {
                return(null);
            }
            FileModeFlags mode = (FileModeFlags)statCache.st_mode & FileModeFlags.FileTypeMask;

            switch (mode)
            {
            case FileModeFlags.Directory:
                return("dir");

            case FileModeFlags.File:
                return("file");

            default:
                PhpException.Throw(PhpError.Notice, LibResources.GetString("unknown_file_type"));
                return("unknown");
            }
        }
Beispiel #5
0
        /// <summary>
        /// A wrapper function for <see cref="FileOpenUnmanaged"/>.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="mode">The mode.</param>
        /// <returns>A file handle.</returns>
        /// <exception cref="System.IO.IOException">When the file fails to open.</exception>
        public static UIntPtr FileOpen(string filePath, FileModeFlags mode)
        {
            var result = BoardException.ValidateResult(FileOpenUnmanaged(filePath, (uint)mode));

            return(new UIntPtr((uint)result));
        }