-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFileManager.m
More file actions
45 lines (33 loc) · 1.07 KB
/
FileManager.m
File metadata and controls
45 lines (33 loc) · 1.07 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
//
// FileManager.m
// RMi
//
// Created by Marcelo da Mata on 27/03/2013.
//
//
#import "FileManager.h"
@implementation FileManager
@synthesize filePath = filePath;
@synthesize fileName = fileName;
@synthesize decoder = decoder;
- (id)init:(NSString*)name : (NSString*)path
{
self.fileName = name;
self.filePath = path;
if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", filePath, fileName]]) {
NSException *ex = [NSException exceptionWithName:[NSString stringWithFormat:@"%@", FILE_EXCEPTION] reason:@"O arquivo solicitado nao existe." userInfo:nil];
@throw ex;
}
return self;
}
-(FileInfo*)getFileInfo: (int) fileType {
if (fileType == DICOM) {
decoder = [[DicomDecoder alloc] init: filePath: fileName];
} else {
NSException *ex = [NSException exceptionWithName:[NSString stringWithFormat:@"%@", FILE_UNKNOW_EXCEPTION] reason:@"Tipo de arquivo desconhecido." userInfo:nil];
@throw ex;
}
[decoder decode];
return [decoder getFileInfo];
}
@end