as3corelib 0.1.0 → 0.85.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -4
- data/Gemfile.lock +7 -4
- data/README.textile +20 -10
- data/Rakefile +32 -2
- data/as3corelib.gemspec +13 -11
- data/lib/as3corelib.rb +10 -4
- data/lib/as3corelib/version.rb +4 -0
- metadata +31 -121
- data/build/build.properties +0 -48
- data/build/build.xml +0 -104
- data/examples/JSONExample/JSONExample.mxml +0 -73
- data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +0 -313
- data/src/com/adobe/air/filesystem/FileMonitor.as +0 -245
- data/src/com/adobe/air/filesystem/FileUtil.as +0 -63
- data/src/com/adobe/air/filesystem/VolumeMonitor.as +0 -184
- data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +0 -61
- data/src/com/adobe/air/logging/FileTarget.as +0 -95
- data/src/com/adobe/air/net/ResourceCache.as +0 -165
- data/src/com/adobe/air/net/events/ResourceCacheEvent.as +0 -70
- data/src/com/adobe/crypto/HMAC.as +0 -127
- data/src/com/adobe/crypto/MD5.as +0 -281
- data/src/com/adobe/crypto/MD5Stream.as +0 -402
- data/src/com/adobe/crypto/SHA1.as +0 -289
- data/src/com/adobe/crypto/SHA224.as +0 -257
- data/src/com/adobe/crypto/SHA256.as +0 -261
- data/src/com/adobe/crypto/WSSEUsernameToken.as +0 -114
- data/src/com/adobe/errors/IllegalStateError.as +0 -63
- data/src/com/adobe/fileformats/vcard/Address.as +0 -47
- data/src/com/adobe/fileformats/vcard/Email.as +0 -39
- data/src/com/adobe/fileformats/vcard/Phone.as +0 -39
- data/src/com/adobe/fileformats/vcard/VCard.as +0 -54
- data/src/com/adobe/fileformats/vcard/VCardParser.as +0 -246
- data/src/com/adobe/images/BitString.as +0 -39
- data/src/com/adobe/images/JPGEncoder.as +0 -648
- data/src/com/adobe/images/PNGEncoder.as +0 -141
- data/src/com/adobe/net/DynamicURLLoader.as +0 -55
- data/src/com/adobe/net/IURIResolver.as +0 -76
- data/src/com/adobe/net/MimeTypeMap.as +0 -200
- data/src/com/adobe/net/URI.as +0 -2466
- data/src/com/adobe/net/URIEncodingBitmap.as +0 -139
- data/src/com/adobe/net/proxies/RFC2817Socket.as +0 -198
- data/src/com/adobe/protocols/dict/Database.as +0 -66
- data/src/com/adobe/protocols/dict/Definition.as +0 -71
- data/src/com/adobe/protocols/dict/Dict.as +0 -360
- data/src/com/adobe/protocols/dict/DictionaryServer.as +0 -60
- data/src/com/adobe/protocols/dict/MatchStrategy.as +0 -66
- data/src/com/adobe/protocols/dict/Response.as +0 -71
- data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +0 -53
- data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +0 -67
- data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +0 -70
- data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +0 -69
- data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +0 -69
- data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +0 -55
- data/src/com/adobe/protocols/dict/events/ErrorEvent.as +0 -80
- data/src/com/adobe/protocols/dict/events/MatchEvent.as +0 -67
- data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +0 -70
- data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +0 -54
- data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +0 -68
- data/src/com/adobe/protocols/dict/util/SocketHelper.as +0 -81
- data/src/com/adobe/serialization/json/JSON.as +0 -86
- data/src/com/adobe/serialization/json/JSONDecoder.as +0 -327
- data/src/com/adobe/serialization/json/JSONEncoder.as +0 -312
- data/src/com/adobe/serialization/json/JSONParseError.as +0 -87
- data/src/com/adobe/serialization/json/JSONToken.as +0 -104
- data/src/com/adobe/serialization/json/JSONTokenType.as +0 -69
- data/src/com/adobe/serialization/json/JSONTokenizer.as +0 -702
- data/src/com/adobe/utils/ArrayUtil.as +0 -187
- data/src/com/adobe/utils/DateUtil.as +0 -701
- data/src/com/adobe/utils/DictionaryUtil.as +0 -87
- data/src/com/adobe/utils/IntUtil.as +0 -99
- data/src/com/adobe/utils/NumberFormatter.as +0 -74
- data/src/com/adobe/utils/StringUtil.as +0 -239
- data/src/com/adobe/utils/XMLUtil.as +0 -168
- data/src/com/adobe/webapis/ServiceBase.as +0 -48
- data/src/com/adobe/webapis/URLLoaderBase.as +0 -108
- data/src/com/adobe/webapis/events/ServiceEvent.as +0 -82
- data/tests/src/CoreLibTestRunner-app.xml +0 -135
- data/tests/src/CoreLibTestRunner.as +0 -138
- data/tests/src/CoreLibTestRunner.mxml +0 -46
- data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +0 -176
- data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +0 -63
- data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +0 -57
- data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +0 -59
- data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +0 -72
- data/tests/src/com/adobe/crypto/HMACMD5Test.as +0 -134
- data/tests/src/com/adobe/crypto/HMACSHA1Test.as +0 -138
- data/tests/src/com/adobe/crypto/MD5Test.as +0 -82
- data/tests/src/com/adobe/crypto/SHA1Test.as +0 -151
- data/tests/src/com/adobe/crypto/SHA224Test.as +0 -104
- data/tests/src/com/adobe/crypto/SHA256Test.as +0 -116
- data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +0 -87
- data/tests/src/com/adobe/images/JPGEncoderTest.as +0 -54
- data/tests/src/com/adobe/images/PNGEncoderTest.as +0 -54
- data/tests/src/com/adobe/net/URITest.as +0 -589
- data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +0 -59
- data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +0 -62
- data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +0 -59
- data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +0 -63
- data/tests/src/com/adobe/protocols/events/MatchEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +0 -58
- data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +0 -60
- data/tests/src/com/adobe/serialization/json/JSONTest.as +0 -522
- data/tests/src/com/adobe/serialization/json/SimpleClass.as +0 -85
- data/tests/src/com/adobe/utils/ArrayUtilTest.as +0 -173
- data/tests/src/com/adobe/utils/DateUtilTest.as +0 -436
- data/tests/src/com/adobe/utils/DictionaryUtilTest.as +0 -93
- data/tests/src/com/adobe/utils/IntUtilTest.as +0 -73
- data/tests/src/com/adobe/utils/NumberFormatterTest.as +0 -70
- data/tests/src/com/adobe/utils/StringUtilTest.as +0 -304
- data/tests/src/com/adobe/utils/XMLUtilTest.as +0 -101
- data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +0 -66
@@ -1,61 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.air.filesystem.events
|
34
|
-
{
|
35
|
-
import flash.events.Event;
|
36
|
-
import flash.filesystem.File;
|
37
|
-
|
38
|
-
public class FileMonitorEvent extends Event
|
39
|
-
{
|
40
|
-
public static const CHANGE:String = "onFileChange";
|
41
|
-
public static const MOVE:String = "onFileMove";
|
42
|
-
public static const CREATE:String = "onFileCreate";
|
43
|
-
public static const ADD_VOLUME:String = "onVolumeAdd";
|
44
|
-
public static const REMOVE_VOLUME:String = "onVolumeRemove";
|
45
|
-
|
46
|
-
public var file:File;
|
47
|
-
public function FileMonitorEvent(type:String, bubbles:Boolean=false,
|
48
|
-
cancelable:Boolean=false)
|
49
|
-
{
|
50
|
-
super(type, bubbles, cancelable);
|
51
|
-
}
|
52
|
-
|
53
|
-
public override function clone():Event
|
54
|
-
{
|
55
|
-
var out:FileMonitorEvent = new FileMonitorEvent(type, bubbles, cancelable);
|
56
|
-
out.file = file;
|
57
|
-
|
58
|
-
return out;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
@@ -1,95 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2008, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.air.logging
|
34
|
-
{
|
35
|
-
import flash.filesystem.File;
|
36
|
-
import flash.filesystem.FileMode;
|
37
|
-
import flash.filesystem.FileStream;
|
38
|
-
|
39
|
-
import mx.core.mx_internal;
|
40
|
-
import mx.logging.targets.LineFormattedTarget;
|
41
|
-
|
42
|
-
use namespace mx_internal;
|
43
|
-
|
44
|
-
/**
|
45
|
-
* An Adobe AIR only class that provides a log target for the Flex logging
|
46
|
-
* framework, that logs files to a file on the user's system.
|
47
|
-
*
|
48
|
-
* This class will only work when running within Adobe AIR>
|
49
|
-
*/
|
50
|
-
public class FileTarget extends LineFormattedTarget
|
51
|
-
{
|
52
|
-
private const DEFAULT_LOG_PATH:String = "app-storage:/application.log";
|
53
|
-
|
54
|
-
private var log:File;
|
55
|
-
|
56
|
-
public function FileTarget(logFile:File = null)
|
57
|
-
{
|
58
|
-
if(logFile != null)
|
59
|
-
{
|
60
|
-
log = logFile;
|
61
|
-
}
|
62
|
-
else
|
63
|
-
{
|
64
|
-
log = new File(DEFAULT_LOG_PATH);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
public function get logURI():String
|
69
|
-
{
|
70
|
-
return log.url;
|
71
|
-
}
|
72
|
-
|
73
|
-
mx_internal override function internalLog(message:String):void
|
74
|
-
{
|
75
|
-
write(message);
|
76
|
-
}
|
77
|
-
|
78
|
-
private function write(msg:String):void
|
79
|
-
{
|
80
|
-
var fs:FileStream = new FileStream();
|
81
|
-
fs.open(log, FileMode.APPEND);
|
82
|
-
fs.writeUTFBytes(msg + File.lineEnding);
|
83
|
-
fs.close();
|
84
|
-
}
|
85
|
-
|
86
|
-
public function clear():void
|
87
|
-
{
|
88
|
-
var fs:FileStream = new FileStream();
|
89
|
-
fs.open(log, FileMode.WRITE);
|
90
|
-
fs.writeUTFBytes("");
|
91
|
-
fs.close();
|
92
|
-
}
|
93
|
-
|
94
|
-
}
|
95
|
-
}
|
@@ -1,165 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.air.net
|
34
|
-
{
|
35
|
-
import com.adobe.crypto.MD5;
|
36
|
-
import com.adobe.net.DynamicURLLoader;
|
37
|
-
|
38
|
-
import flash.events.Event;
|
39
|
-
import flash.events.EventDispatcher;
|
40
|
-
import flash.events.IOErrorEvent;
|
41
|
-
import flash.filesystem.File;
|
42
|
-
import flash.filesystem.FileMode;
|
43
|
-
import flash.filesystem.FileStream;
|
44
|
-
import flash.net.URLLoaderDataFormat;
|
45
|
-
import flash.net.URLRequest;
|
46
|
-
import flash.utils.ByteArray;
|
47
|
-
import com.adobe.air.net.events.ResourceCacheEvent;
|
48
|
-
|
49
|
-
//todo: add event metadata
|
50
|
-
|
51
|
-
public class ResourceCache extends EventDispatcher
|
52
|
-
{
|
53
|
-
private var _cacheName:String;
|
54
|
-
//maybe rename to make it clearer it loads data
|
55
|
-
public function ResourceCache(cacheName:String)
|
56
|
-
{
|
57
|
-
_cacheName = cacheName;
|
58
|
-
}
|
59
|
-
|
60
|
-
public function get cacheName():String
|
61
|
-
{
|
62
|
-
return _cacheName;
|
63
|
-
}
|
64
|
-
|
65
|
-
private function getStorageDir():File
|
66
|
-
{
|
67
|
-
return File.applicationStorageDirectory.resolvePath(_cacheName);
|
68
|
-
}
|
69
|
-
|
70
|
-
public function itemExists(key:String):Boolean
|
71
|
-
{
|
72
|
-
return getItemFile(key).exists;
|
73
|
-
}
|
74
|
-
|
75
|
-
public function clearCache():void
|
76
|
-
{
|
77
|
-
var cacheDir:File = getStorageDir();
|
78
|
-
try
|
79
|
-
{
|
80
|
-
cacheDir.deleteDirectory(true);
|
81
|
-
}
|
82
|
-
catch (e:IOErrorEvent)
|
83
|
-
{
|
84
|
-
// we tried!
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
public function getItemFile(key:String):File
|
89
|
-
{
|
90
|
-
var dir:File = getStorageDir();
|
91
|
-
var fName:String = generateKeyHash(key);
|
92
|
-
var file:File = dir.resolvePath(fName);
|
93
|
-
|
94
|
-
return file;
|
95
|
-
}
|
96
|
-
|
97
|
-
public function retrieve(url:String):void
|
98
|
-
{
|
99
|
-
|
100
|
-
var key:String = generateKeyHash(url);
|
101
|
-
var file:File = getItemFile(key);
|
102
|
-
|
103
|
-
//todo: do we need to check if the dir exists?
|
104
|
-
|
105
|
-
if(file.exists)
|
106
|
-
{
|
107
|
-
var e:ResourceCacheEvent = new ResourceCacheEvent(ResourceCacheEvent.ITEM_READY);
|
108
|
-
e.key = key;
|
109
|
-
e.file = file;
|
110
|
-
|
111
|
-
dispatchEvent(e);
|
112
|
-
return;
|
113
|
-
}
|
114
|
-
|
115
|
-
|
116
|
-
var loader:DynamicURLLoader = new DynamicURLLoader();
|
117
|
-
loader.file = file;
|
118
|
-
loader.key = key;
|
119
|
-
|
120
|
-
loader.addEventListener(Event.COMPLETE, onDataLoad);
|
121
|
-
loader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
|
122
|
-
|
123
|
-
loader.dataFormat = URLLoaderDataFormat.BINARY;
|
124
|
-
|
125
|
-
loader.load(new URLRequest(url));
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
private function onLoadError(event:IOErrorEvent):void
|
130
|
-
{
|
131
|
-
trace("onLoadError : could not cache item");
|
132
|
-
}
|
133
|
-
|
134
|
-
private function onDataLoad(event:Event):void
|
135
|
-
{
|
136
|
-
var loader:DynamicURLLoader = DynamicURLLoader(event.target);
|
137
|
-
|
138
|
-
var f:File = File(loader.file);
|
139
|
-
var key:String = String(loader.key);
|
140
|
-
|
141
|
-
var fileStream:FileStream = new FileStream();
|
142
|
-
fileStream.open(f, FileMode.WRITE);
|
143
|
-
fileStream.writeBytes(loader.data as ByteArray);
|
144
|
-
fileStream.close();
|
145
|
-
|
146
|
-
var g:ResourceCacheEvent = new ResourceCacheEvent(ResourceCacheEvent.ITEM_CACHED);
|
147
|
-
g.key = key;
|
148
|
-
g.file = f;
|
149
|
-
|
150
|
-
dispatchEvent(g);
|
151
|
-
|
152
|
-
var e:ResourceCacheEvent = new ResourceCacheEvent(ResourceCacheEvent.ITEM_READY);
|
153
|
-
e.key = key;
|
154
|
-
e.file = f;
|
155
|
-
|
156
|
-
dispatchEvent(e);
|
157
|
-
}
|
158
|
-
|
159
|
-
|
160
|
-
private function generateKeyHash(key:String):String
|
161
|
-
{
|
162
|
-
return MD5.hash(key);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.air.net.events
|
34
|
-
{
|
35
|
-
import flash.events.Event;
|
36
|
-
import flash.filesystem.File;
|
37
|
-
|
38
|
-
public class ResourceCacheEvent extends Event
|
39
|
-
{
|
40
|
-
|
41
|
-
public static const ITEM_READY:String = "onPathReady";
|
42
|
-
public static const ITEM_CACHED:String = "onItemCached";
|
43
|
-
|
44
|
-
[Bindable]
|
45
|
-
public var key:String;
|
46
|
-
|
47
|
-
[Bindable]
|
48
|
-
public var file:File;
|
49
|
-
|
50
|
-
public function ResourceCacheEvent(type:String,
|
51
|
-
bubbles:Boolean=false,
|
52
|
-
cancelable:Boolean=false)
|
53
|
-
{
|
54
|
-
super(type, bubbles, cancelable);
|
55
|
-
}
|
56
|
-
|
57
|
-
public override function clone():Event
|
58
|
-
{
|
59
|
-
var out:ResourceCacheEvent = new ResourceCacheEvent(type,
|
60
|
-
bubbles,
|
61
|
-
cancelable);
|
62
|
-
|
63
|
-
out.key = key;
|
64
|
-
out.file = file;
|
65
|
-
|
66
|
-
return out;
|
67
|
-
}
|
68
|
-
|
69
|
-
}
|
70
|
-
}
|
@@ -1,127 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2008, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.crypto {
|
34
|
-
import flash.utils.ByteArray;
|
35
|
-
import flash.utils.Endian;
|
36
|
-
import flash.utils.describeType;
|
37
|
-
/**
|
38
|
-
* Keyed-Hashing for Message Authentication
|
39
|
-
* Implementation based on algorithm description at
|
40
|
-
* http://www.faqs.org/rfcs/rfc2104.html
|
41
|
-
*/
|
42
|
-
public class HMAC
|
43
|
-
{
|
44
|
-
/**
|
45
|
-
* Performs the HMAC hash algorithm using byte arrays.
|
46
|
-
*
|
47
|
-
* @param secret The secret key
|
48
|
-
* @param message The message to hash
|
49
|
-
* @param algorithm Hash object to use
|
50
|
-
* @return A string containing the hash value of message
|
51
|
-
* @langversion ActionScript 3.0
|
52
|
-
* @playerversion Flash 8.5
|
53
|
-
* @tiptext
|
54
|
-
*/
|
55
|
-
public static function hash( secret:String, message:String, algorithm:Object = null ):String
|
56
|
-
{
|
57
|
-
var text:ByteArray = new ByteArray();
|
58
|
-
var k_secret:ByteArray = new ByteArray();
|
59
|
-
|
60
|
-
text.writeUTFBytes(message);
|
61
|
-
k_secret.writeUTFBytes(secret);
|
62
|
-
|
63
|
-
return hashBytes(k_secret, text, algorithm);
|
64
|
-
}
|
65
|
-
|
66
|
-
/**
|
67
|
-
* Performs the HMAC hash algorithm using string.
|
68
|
-
*
|
69
|
-
* @param secret The secret key
|
70
|
-
* @param message The message to hash
|
71
|
-
* @param algorithm Hash object to use
|
72
|
-
* @return A string containing the hash value of message
|
73
|
-
* @langversion ActionScript 3.0
|
74
|
-
* @playerversion Flash 8.5
|
75
|
-
* @tiptext
|
76
|
-
*/
|
77
|
-
public static function hashBytes( secret:ByteArray, message:ByteArray, algorithm:Object = null ):String
|
78
|
-
{
|
79
|
-
var ipad:ByteArray = new ByteArray();
|
80
|
-
var opad:ByteArray = new ByteArray();
|
81
|
-
var endian:String = Endian.BIG_ENDIAN;
|
82
|
-
|
83
|
-
if(algorithm == null){
|
84
|
-
algorithm = MD5;
|
85
|
-
}
|
86
|
-
|
87
|
-
if ( describeType(algorithm).@name.toString() == "com.adobe.crypto::MD5" ) {
|
88
|
-
endian = Endian.LITTLE_ENDIAN;
|
89
|
-
}
|
90
|
-
|
91
|
-
if ( secret.length > 64 ) {
|
92
|
-
algorithm.hashBytes(secret);
|
93
|
-
secret = new ByteArray();
|
94
|
-
secret.endian = endian;
|
95
|
-
|
96
|
-
while ( algorithm.digest.bytesAvailable != 0 ) {
|
97
|
-
secret.writeInt(algorithm.digest.readInt());
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
secret.length = 64
|
102
|
-
secret.position = 0;
|
103
|
-
for ( var x:int = 0; x < 64; x++ ) {
|
104
|
-
var byte:int = secret.readByte();
|
105
|
-
ipad.writeByte(0x36 ^ byte);
|
106
|
-
opad.writeByte(0x5c ^ byte);
|
107
|
-
}
|
108
|
-
|
109
|
-
ipad.writeBytes(message);
|
110
|
-
algorithm.hashBytes(ipad);
|
111
|
-
var tmp:ByteArray = new ByteArray();
|
112
|
-
tmp.endian = endian;
|
113
|
-
|
114
|
-
while ( algorithm.digest.bytesAvailable != 0 ) {
|
115
|
-
tmp.writeInt(algorithm.digest.readInt());
|
116
|
-
}
|
117
|
-
tmp.position = 0;
|
118
|
-
|
119
|
-
while ( tmp.bytesAvailable != 0 ) {
|
120
|
-
opad.writeByte(tmp.readUnsignedByte());
|
121
|
-
}
|
122
|
-
return algorithm.hashBytes( opad );
|
123
|
-
}
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
}
|