Example #1
0
        private file_Mode getFileMode(ref byte[] rawPermissions)
        {
            file_Mode result = new file_Mode();

            ushort fm = dataOperations.convToLE(BitConverter.ToUInt16(rawPermissions, 10));

            rwx other = new rwx();
            rwx group = new rwx();
            rwx owner = new rwx();

            other.read    = Is((filemodeFlags)fm, filemodeFlags.otherRead);
            other.write   = Is((filemodeFlags)fm, filemodeFlags.otherWrite);
            other.execute = Is((filemodeFlags)fm, filemodeFlags.otherExecute);
            group.read    = Is((filemodeFlags)fm, filemodeFlags.groupRead);
            group.write   = Is((filemodeFlags)fm, filemodeFlags.groupWrite);
            group.execute = Is((filemodeFlags)fm, filemodeFlags.groupExecute);
            owner.read    = Is((filemodeFlags)fm, filemodeFlags.ownerRead);
            owner.write   = Is((filemodeFlags)fm, filemodeFlags.ownerWrite);
            owner.execute = Is((filemodeFlags)fm, filemodeFlags.ownerExecute);

            result.other            = other;
            result.group            = group;
            result.owner            = owner;
            result.userIDOnExecute  = Is((filemodeFlags)fm, filemodeFlags.userIDOnExecute);
            result.groupIDOnExecute = Is((filemodeFlags)fm, filemodeFlags.groupIDOnExecute);
            result.stickyBit        = Is((filemodeFlags)fm, filemodeFlags.stickyBit);
            result.namedPipe        = Is((filemodeFlags)fm, filemodeFlags.namedPipe);
            result.charSpecial      = Is((filemodeFlags)fm, filemodeFlags.charSpecial);
            result.directory        = Is((filemodeFlags)fm, filemodeFlags.directory);
            result.blockSpecial     = Is((filemodeFlags)fm, filemodeFlags.blockSpecial);
            result.regular          = Is((filemodeFlags)fm, filemodeFlags.regular);
            result.symbolicLink     = Is((filemodeFlags)fm, filemodeFlags.symbolicLink);
            result.whiteout         = Is((filemodeFlags)fm, filemodeFlags.whiteout);

            return(result);
        }
        private file_Mode getFileMode(ref byte[] rawPermissions)
        {
            file_Mode result = new file_Mode();

            ushort fm = dataOperations.convToLE(BitConverter.ToUInt16(rawPermissions, 10));

            rwx other = new rwx();
            rwx group = new rwx();
            rwx owner = new rwx();

            other.read = Is((filemodeFlags)fm, filemodeFlags.otherRead);
            other.write = Is((filemodeFlags)fm, filemodeFlags.otherWrite);
            other.execute = Is((filemodeFlags)fm, filemodeFlags.otherExecute);
            group.read = Is((filemodeFlags)fm, filemodeFlags.groupRead);
            group.write = Is((filemodeFlags)fm, filemodeFlags.groupWrite);
            group.execute = Is((filemodeFlags)fm, filemodeFlags.groupExecute);
            owner.read = Is((filemodeFlags)fm, filemodeFlags.ownerRead);
            owner.write = Is((filemodeFlags)fm, filemodeFlags.ownerWrite);
            owner.execute = Is((filemodeFlags)fm, filemodeFlags.ownerExecute);

            result.other = other;
            result.group = group;
            result.owner = owner;
            result.userIDOnExecute = Is((filemodeFlags)fm, filemodeFlags.userIDOnExecute);
            result.groupIDOnExecute = Is((filemodeFlags)fm, filemodeFlags.groupIDOnExecute);
            result.stickyBit = Is((filemodeFlags)fm, filemodeFlags.stickyBit);
            result.namedPipe = Is((filemodeFlags)fm, filemodeFlags.namedPipe);
            result.charSpecial = Is((filemodeFlags)fm, filemodeFlags.charSpecial);
            result.directory = Is((filemodeFlags)fm, filemodeFlags.directory);
            result.blockSpecial = Is((filemodeFlags)fm, filemodeFlags.blockSpecial);
            result.regular = Is((filemodeFlags)fm, filemodeFlags.regular);
            result.symbolicLink = Is((filemodeFlags)fm, filemodeFlags.symbolicLink);
            result.whiteout = Is((filemodeFlags)fm, filemodeFlags.whiteout);

            return result;
        }