예제 #1
0
 public static byte GetArrayInodeDirTable(int index)
 {
     byte[] buffer = new byte[1];
     HardDisk.Read(ref buffer, SuperBlock.InodeDirTableStart + index);
     arrayInodeDirTable[index] = buffer[0];
     return(arrayInodeDirTable[index]);
 }
예제 #2
0
        public static byte GetArrayBlock(int index)
        {
            byte[] buffer = new byte[1];
            HardDisk.Read(ref buffer, SuperBlock.FSMStart + index);

            arrayBlock[index] = buffer[0];
            return(arrayBlock[index]);
        }
예제 #3
0
        public int GetArrayBlock(int index)
        {
            byte[] buffer = new byte[4];
            HardDisk.Read(ref buffer, SuperBlock.InodeStart + fileID * SuperBlock.InodeSize + 4 * index);
            arrayBlocks[index] = BitConverter.ToInt32(buffer, 0);

            return(arrayBlocks[index]);
        }
예제 #4
0
        public int GetArrayDir(int index)
        {
            byte[] buffer = new byte[4];
            HardDisk.Read(ref buffer, SuperBlock.InodeDirStart + dirID * SuperBlock.InodeDirSize + 4 * SuperBlock.InodeMaxCountInDir + 4 * index);

            arrayDir[index] = BitConverter.ToInt32(buffer, 0);

            return(arrayDir[index]);
        }
예제 #5
0
        public static int GetInodeID(string name)
        {
            for (int i = 0; i < nameInode.Length; i++)
            {
                byte[] buffer = new byte[SuperBlock.InodeNameLength];
                HardDisk.Read(ref buffer, SuperBlock.InodeNameAndIDTableStart + i * SuperBlock.InodeNameLength);

                nameInode[i] = System.Text.Encoding.ASCII.GetString(buffer);

                if (name == nameInode[i])
                {
                    return(i);
                }
            }
            return(-1); // or return 0;
        }