• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

swfから画像を抽出するコマンドラインアプリケーション


Commit MetaInfo

Révisionc6c66cb1da8c4760f0319a5da8a43111a88beefe (tree)
l'heure2018-05-22 22:24:44
Auteurmasakih <masakih@user...>
Commitermasakih

Message de Log

Informationクラスが行うべき処理をInformationクラスに移動した

Change Summary

Modification

--- a/KanColleGraphicDivider/Information.h
+++ b/KanColleGraphicDivider/Information.h
@@ -9,11 +9,14 @@
99 #import <Foundation/Foundation.h>
1010
1111 @interface Information: NSObject
12-@property (copy) NSString *originalName;
12+
13+@property (readonly) NSURL *originalURL;
14+@property (copy, nonatomic, readonly) NSString *originalName;
15+
1316 @property (copy) NSString *outputDir;
1417 @property (copy) NSString *filename;
1518 @property (copy) NSArray *charctorIds;
1619
17-- (bool)skipCharactorID:(UInt16) chractorid;
20+- (BOOL)skipCharactorID:(UInt16) chractorid;
1821
1922 @end
--- a/KanColleGraphicDivider/Information.m
+++ b/KanColleGraphicDivider/Information.m
@@ -8,8 +8,21 @@
88
99 #import "Information.h"
1010
11+
12+@interface Information()
13+
14+@property (readwrite) NSURL *originalURL;
15+
16+@property (copy, nonatomic, readwrite) NSString *originalName;
17+
18+@end
19+
1120 @implementation Information
12-- (bool)skipCharactorID:(UInt16) chractorid {
21+
22+@synthesize filename = _filename;
23+
24+- (BOOL)skipCharactorID:(UInt16) chractorid {
25+
1326 if(self.charctorIds.count == 0) return false;
1427
1528 for(NSString *charID in self.charctorIds) {
@@ -17,4 +30,26 @@
1730 }
1831 return true;
1932 }
33+
34+- (void)setFilename:(NSString *)filename {
35+
36+ _filename = [filename copy];
37+
38+ NSString *filePath = [filename copy];
39+
40+ if(![filePath hasPrefix:@"/"]) {
41+ NSFileManager *fm = [NSFileManager defaultManager];
42+ filePath = [fm.currentDirectoryPath stringByAppendingPathComponent:filePath];
43+ }
44+
45+ self.originalURL = [NSURL fileURLWithPath:filePath];
46+
47+ NSString *oName = [filename lastPathComponent];
48+ self.originalName = [oName stringByDeletingPathExtension];
49+}
50+
51+- (NSString *)filename {
52+
53+ return _filename;
54+}
2055 @end
--- a/KanColleGraphicDivider/main.m
+++ b/KanColleGraphicDivider/main.m
@@ -65,22 +65,13 @@ static void version()
6565 }
6666
6767 void extractImagesFromSWFFile(Information *info) {
68- NSString *filePath = info.filename;
69- if(![filePath hasPrefix:@"/"]) {
70- NSFileManager *fm = [NSFileManager defaultManager];
71- filePath = [fm.currentDirectoryPath stringByAppendingPathComponent:filePath];
72- }
7368
74- NSURL *url = [NSURL fileURLWithPath:filePath];
75- NSData *data = [NSData dataWithContentsOfURL:url];
69+ NSData *data = [NSData dataWithContentsOfURL:info.originalURL];
7670 if(!data) {
7771 fprintf(stderr, "Can not open %s.\n", info.filename.UTF8String);
7872 return;
7973 }
8074
81- info.originalName = [filePath lastPathComponent];
82- info.originalName = [info.originalName stringByDeletingPathExtension];
83-
8475 SwfData *swf = [SwfData dataWithData:data];
8576 SwfContent *content = swf.firstContent;
8677