Skip to content
This repository was archived by the owner on Jun 9, 2019. It is now read-only.

Commit d53b044

Browse files
committed
Initial commit.
This is an initial commit for the ResourceKit project. It lays the groundwork for everything that will be added to the project in the future, and currently enables users to read data from resources.
0 parents  commit d53b044

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3495
-0
lines changed

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## Build generated
6+
build/
7+
DerivedData/
8+
9+
## Various settings
10+
*.pbxuser
11+
!default.pbxuser
12+
*.mode1v3
13+
!default.mode1v3
14+
*.mode2v3
15+
!default.mode2v3
16+
*.perspectivev3
17+
!default.perspectivev3
18+
xcuserdata/
19+
20+
## Other
21+
*.moved-aside
22+
*.xccheckout
23+
*.xcscmblueprint
24+
25+
## Obj-C/Swift specific
26+
*.hmap
27+
*.ipa
28+
*.dSYM.zip
29+
*.dSYM
30+
31+
Pods/

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Tom Hancocks
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ResourceKit
2+
ResourceKit is a framework for reading and handling the legacy ResourceFork/ResourceFile format. This is not intended as a mechanism for storing new data in modern projects, but rather as a way for modern projects to access and utilise data in old files.
3+
4+
The ResourceFork (commonly used under Classic Mac OS) was used to store data and assets for applications, and during the transistion to Mac OS X a flattened version, the `.rsrc` file was created. Both of these are now in a state of deprecation and all of their functionality is contained with the "Carbon" umbrella of frameworks. It is a shame that access to these files will eventually be lost on newer machines.
5+
6+
This framework aims to lessen that loss by ensuring access to those files is still possible.

ResourceKit.podspec

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Pod::Spec.new do |s|
2+
s.name = "ResourceKit"
3+
s.version = "0.5.0"
4+
s.summary = "A framework for reading and handling legacy resource files."
5+
s.description = <<-DESC
6+
ResourceKit is a framework for reading and handling the legacy ResourceFork/ResourceFile
7+
format. This is not intended as a mechanism for storing new data in modern projects, but
8+
rather as a way for modern projects to access and utilise data in old files.
9+
DESC
10+
11+
s.homepage = "https://github.com/tjhancocks/ResourceKit"
12+
s.license = { :type => "MIT", :file => "LICENSE" }
13+
s.author = { "Tom Hancocks" => "[email protected]" }
14+
s.ios.deployment_target = "10.0"
15+
s.osx.deployment_target = "10.12"
16+
s.source = { :git => "https://github.com/tjhancocks/ResourceKit.git", :tag => "#{s.version}" }
17+
s.source_files = "Classes", "ResourceKit/**/*.{h,m}"
18+
s.public_header_files = "ResourceKit/*.h", "ResourceKit/Categories/*.h", "ResourceKit/Model/*.h", "ResourceKit/Protocols/*.h"
19+
20+
end

ResourceKit.xcodeproj/project.pbxproj

Lines changed: 671 additions & 0 deletions
Large diffs are not rendered by default.

ResourceKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>classNames</key>
6+
<dict>
7+
<key>RKResourceFileTests</key>
8+
<dict>
9+
<key>testResourceFile_parseComplexResourceFilePerformance</key>
10+
<dict>
11+
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
12+
<dict>
13+
<key>baselineAverage</key>
14+
<real>0.0056963</real>
15+
<key>baselineIntegrationDisplayName</key>
16+
<string>Local Baseline</string>
17+
</dict>
18+
</dict>
19+
<key>testResourceFile_parseSimpleResourceFilePerformance</key>
20+
<dict>
21+
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
22+
<dict>
23+
<key>baselineAverage</key>
24+
<real>0.00041135</real>
25+
<key>baselineIntegrationDisplayName</key>
26+
<string>Local Baseline</string>
27+
</dict>
28+
</dict>
29+
</dict>
30+
</dict>
31+
</dict>
32+
</plist>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>runDestinationsByUUID</key>
6+
<dict>
7+
<key>C314DD5D-D5C5-4772-865A-43E774B8D15D</key>
8+
<dict>
9+
<key>localComputer</key>
10+
<dict>
11+
<key>busSpeedInMHz</key>
12+
<integer>100</integer>
13+
<key>cpuCount</key>
14+
<integer>1</integer>
15+
<key>cpuKind</key>
16+
<string>Intel Core i5</string>
17+
<key>cpuSpeedInMHz</key>
18+
<integer>2900</integer>
19+
<key>logicalCPUCoresPerPackage</key>
20+
<integer>4</integer>
21+
<key>modelCode</key>
22+
<string>MacBookPro12,1</string>
23+
<key>physicalCPUCoresPerPackage</key>
24+
<integer>2</integer>
25+
<key>platformIdentifier</key>
26+
<string>com.apple.platform.macosx</string>
27+
</dict>
28+
<key>targetArchitecture</key>
29+
<string>x86_64</string>
30+
</dict>
31+
</dict>
32+
</dict>
33+
</plist>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// MIT License
3+
//
4+
// Copyright (c) 2017 Tom Hancocks
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
//
24+
25+
#import <ResourceKit/ResourceKit.h>
26+
#import "RKPODBuilder.h"
27+
28+
@interface RKResourceBuilder : NSObject <RKPODBuilder>
29+
30+
@end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// MIT License
3+
//
4+
// Copyright (c) 2017 Tom Hancocks
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
//
24+
25+
#import "RKResourceBuilder.h"
26+
#import "RKResourcePOD.h"
27+
28+
@implementation RKResourceBuilder
29+
30+
+ (nullable RKResource *)buildFromPOD:(nullable RKResourcePOD *)pod
31+
{
32+
if (!pod) {
33+
return nil;
34+
}
35+
36+
RKResource *resource = [RKResource ofType:[RKType withCode:pod.typeCode] withId:pod.id];
37+
resource.name = pod.name;
38+
resource.data = pod.data;
39+
return resource;
40+
}
41+
42+
+ (NSArray *)buildFromArrayOfPODs:(NSArray *)pods
43+
{
44+
NSMutableArray <RKResource *> *resources = NSMutableArray.new;
45+
for (RKResourcePOD *pod in pods) {
46+
[resources addObject:[self buildFromPOD:pod]];
47+
}
48+
return resources.copy;
49+
}
50+
51+
@end

ResourceKit/Builders/RKTypeBuilder.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// MIT License
3+
//
4+
// Copyright (c) 2017 Tom Hancocks
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
//
24+
25+
#import <ResourceKit/ResourceKit.h>
26+
#import "RKPODBuilder.h"
27+
28+
@interface RKTypeBuilder : NSObject <RKPODBuilder>
29+
30+
@end

ResourceKit/Builders/RKTypeBuilder.m

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// MIT License
3+
//
4+
// Copyright (c) 2017 Tom Hancocks
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
//
24+
25+
#import "RKTypeBuilder.h"
26+
#import "RKTypePOD.h"
27+
28+
@implementation RKTypeBuilder
29+
30+
+ (nullable RKType *)buildFromPOD:(nullable RKTypePOD *)pod
31+
{
32+
if (!pod) {
33+
return nil;
34+
}
35+
36+
return [RKType withCode:pod.code];
37+
}
38+
39+
+ (NSArray <RKType *> *)buildFromArrayOfPODs:(NSArray <RKTypePOD *> *)pods
40+
{
41+
NSMutableArray <RKType *> *types = NSMutableArray.new;
42+
for (RKTypePOD *pod in pods) {
43+
[types addObject:[self buildFromPOD:pod]];
44+
}
45+
return types.copy;
46+
}
47+
48+
@end
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// MIT License
3+
//
4+
// Copyright (c) 2017 Tom Hancocks
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
//
24+
25+
#import <ResourceKit/RKDataParserProtocol.h>
26+
27+
@interface NSData (RKDataParser) <RKDataParserProtocol>
28+
29+
@end

0 commit comments

Comments
 (0)