-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileSystem.py
More file actions
65 lines (55 loc) · 2.02 KB
/
FileSystem.py
File metadata and controls
65 lines (55 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from ImageTools import FatProcessor
from enums import TypeOfFAT
from service_classes import InfoAboutImage
class FileSystem:
"""
Абстаркция описания файловой системы
"""
def __init__(self, info: InfoAboutImage, fr_proc: FatProcessor, indexed_fat_table: dict,
error_detector):
self._type_of_fat = info.fat_type
self._info = info
self._ft_proc = fr_proc
self._indexed_fat_table = indexed_fat_table
self._error_detector = error_detector
self._file_tree_printer = None
def set_file_tree_printer(self, file_tree_printer):
self._file_tree_printer = file_tree_printer
def print_file_tree(self):
if self._file_tree_printer is not None:
self._file_tree_printer.print_tree()
else:
raise ValueError("File Tree Printer isn't initialize")
def get_type_of_fat(self):
"""
Возвращает тип FAT текущей файловой системы
:return: TypeOfFAT
"""
return self._type_of_fat
def get_name_type_of_fat(self):
"""
Возвращает название FAT текущей файловой системы
:return: string
"""
return TypeOfFAT.get_name_by_type[self._type_of_fat]
def get_fat_processor(self):
"""
:return: FatProcessor
"""
return self._ft_proc
def get_indexed_fat_table(self):
"""
:return: dict {int: IndexedEntryInfo}
"""
return self._indexed_fat_table
def get_a_set_all_dir_entries_info(self):
"""
Получение набора всех данных о записях в деректориях без повторений
:return: set {DirectoryEntryInfo}
"""
return set(map(lambda x: x.dir_entry_info, self._indexed_fat_table.values()))
def get_error_detector(self):
"""
:return: ErrorDetector
"""
return self._error_detector