Esempio n. 1
0
 /* Metoda dodająca tekst do nowego pliku */
 public static void addTextToNewFile(String fileName, String Text)
 {
     if (checkIfFileExist(fileName) && isEnoughFreeBlocks(Text))
     {
         FolderSystem.FileClass tempFile = returnAllFileAttributes(fileName);
         Disc.addTextToExistingFile(fileName, Text, tempFile.getLastFileBlock());
     }
 }
Esempio n. 2
0
 /* Wyświetla tekst pliku */
 public static String printFile(String fileName)
 {
     if (checkIfFileExist(fileName))
     {
         FolderSystem.FileClass tempFile = returnAllFileAttributes(fileName);
         String Text = Disc.getFileText(tempFile.getFirstFileBlock());
         return(Text);
     }
     return("");
 }
Esempio n. 3
0
        /* Wyświetla wszystkie dane pliku */
        public static String printAllFileData(String fileName)
        {
            if (checkIfFileExist(fileName))
            {
                FolderSystem.FileClass tempFile = returnAllFileAttributes(fileName);

                String Text = folder.getAllFileParameters(fileName);
                Text += "\nDane...\n" + Disc.printFileBlocks(tempFile.getFirstFileBlock());
                return(Text);
            }
            return("");
        }
Esempio n. 4
0
        /* Zwraca atrybuty pliku */
        public FileClass getAllFileAttributes(String fileName)
        {
            var tempFile = new FileClass();

            foreach (FileClass iterator in FolderList)
            {
                if (iterator.getFileName() == fileName)
                {
                    tempFile = iterator;
                }
            }
            return(tempFile);
        }
Esempio n. 5
0
        /* Usuwanie pliku */
        public static void deleteFile(String fileName)
        {
            if (checkIfFileExist(fileName))
            {
                int[] index;

                FolderSystem.FileClass tempFile = new FolderSystem.FileClass();
                tempFile = returnAllFileAttributes(fileName);
                index    = Disc.getAllFileBlocksNumbers(tempFile.getFirstFileBlock(), tempFile.getFileSize());
                freeBlocks.deleteBlocksPointers(index);
                folder.deleteFile(fileName);
            }
        }
Esempio n. 6
0
 /* Zwraca atrybuty pliku */
 public static FolderSystem.FileClass returnAllFileAttributes(String fileName)
 {
     FolderSystem.FileClass tempFile = folder.getAllFileAttributes(fileName);
     return(tempFile);
 }