as3corelib 0.1.0 → 0.85.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/Gemfile +1 -4
  2. data/Gemfile.lock +7 -4
  3. data/README.textile +20 -10
  4. data/Rakefile +32 -2
  5. data/as3corelib.gemspec +13 -11
  6. data/lib/as3corelib.rb +10 -4
  7. data/lib/as3corelib/version.rb +4 -0
  8. metadata +31 -121
  9. data/build/build.properties +0 -48
  10. data/build/build.xml +0 -104
  11. data/examples/JSONExample/JSONExample.mxml +0 -73
  12. data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +0 -313
  13. data/src/com/adobe/air/filesystem/FileMonitor.as +0 -245
  14. data/src/com/adobe/air/filesystem/FileUtil.as +0 -63
  15. data/src/com/adobe/air/filesystem/VolumeMonitor.as +0 -184
  16. data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +0 -61
  17. data/src/com/adobe/air/logging/FileTarget.as +0 -95
  18. data/src/com/adobe/air/net/ResourceCache.as +0 -165
  19. data/src/com/adobe/air/net/events/ResourceCacheEvent.as +0 -70
  20. data/src/com/adobe/crypto/HMAC.as +0 -127
  21. data/src/com/adobe/crypto/MD5.as +0 -281
  22. data/src/com/adobe/crypto/MD5Stream.as +0 -402
  23. data/src/com/adobe/crypto/SHA1.as +0 -289
  24. data/src/com/adobe/crypto/SHA224.as +0 -257
  25. data/src/com/adobe/crypto/SHA256.as +0 -261
  26. data/src/com/adobe/crypto/WSSEUsernameToken.as +0 -114
  27. data/src/com/adobe/errors/IllegalStateError.as +0 -63
  28. data/src/com/adobe/fileformats/vcard/Address.as +0 -47
  29. data/src/com/adobe/fileformats/vcard/Email.as +0 -39
  30. data/src/com/adobe/fileformats/vcard/Phone.as +0 -39
  31. data/src/com/adobe/fileformats/vcard/VCard.as +0 -54
  32. data/src/com/adobe/fileformats/vcard/VCardParser.as +0 -246
  33. data/src/com/adobe/images/BitString.as +0 -39
  34. data/src/com/adobe/images/JPGEncoder.as +0 -648
  35. data/src/com/adobe/images/PNGEncoder.as +0 -141
  36. data/src/com/adobe/net/DynamicURLLoader.as +0 -55
  37. data/src/com/adobe/net/IURIResolver.as +0 -76
  38. data/src/com/adobe/net/MimeTypeMap.as +0 -200
  39. data/src/com/adobe/net/URI.as +0 -2466
  40. data/src/com/adobe/net/URIEncodingBitmap.as +0 -139
  41. data/src/com/adobe/net/proxies/RFC2817Socket.as +0 -198
  42. data/src/com/adobe/protocols/dict/Database.as +0 -66
  43. data/src/com/adobe/protocols/dict/Definition.as +0 -71
  44. data/src/com/adobe/protocols/dict/Dict.as +0 -360
  45. data/src/com/adobe/protocols/dict/DictionaryServer.as +0 -60
  46. data/src/com/adobe/protocols/dict/MatchStrategy.as +0 -66
  47. data/src/com/adobe/protocols/dict/Response.as +0 -71
  48. data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +0 -53
  49. data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +0 -67
  50. data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +0 -70
  51. data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +0 -69
  52. data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +0 -69
  53. data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +0 -55
  54. data/src/com/adobe/protocols/dict/events/ErrorEvent.as +0 -80
  55. data/src/com/adobe/protocols/dict/events/MatchEvent.as +0 -67
  56. data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +0 -70
  57. data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +0 -54
  58. data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +0 -68
  59. data/src/com/adobe/protocols/dict/util/SocketHelper.as +0 -81
  60. data/src/com/adobe/serialization/json/JSON.as +0 -86
  61. data/src/com/adobe/serialization/json/JSONDecoder.as +0 -327
  62. data/src/com/adobe/serialization/json/JSONEncoder.as +0 -312
  63. data/src/com/adobe/serialization/json/JSONParseError.as +0 -87
  64. data/src/com/adobe/serialization/json/JSONToken.as +0 -104
  65. data/src/com/adobe/serialization/json/JSONTokenType.as +0 -69
  66. data/src/com/adobe/serialization/json/JSONTokenizer.as +0 -702
  67. data/src/com/adobe/utils/ArrayUtil.as +0 -187
  68. data/src/com/adobe/utils/DateUtil.as +0 -701
  69. data/src/com/adobe/utils/DictionaryUtil.as +0 -87
  70. data/src/com/adobe/utils/IntUtil.as +0 -99
  71. data/src/com/adobe/utils/NumberFormatter.as +0 -74
  72. data/src/com/adobe/utils/StringUtil.as +0 -239
  73. data/src/com/adobe/utils/XMLUtil.as +0 -168
  74. data/src/com/adobe/webapis/ServiceBase.as +0 -48
  75. data/src/com/adobe/webapis/URLLoaderBase.as +0 -108
  76. data/src/com/adobe/webapis/events/ServiceEvent.as +0 -82
  77. data/tests/src/CoreLibTestRunner-app.xml +0 -135
  78. data/tests/src/CoreLibTestRunner.as +0 -138
  79. data/tests/src/CoreLibTestRunner.mxml +0 -46
  80. data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +0 -176
  81. data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +0 -63
  82. data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +0 -57
  83. data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +0 -59
  84. data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +0 -72
  85. data/tests/src/com/adobe/crypto/HMACMD5Test.as +0 -134
  86. data/tests/src/com/adobe/crypto/HMACSHA1Test.as +0 -138
  87. data/tests/src/com/adobe/crypto/MD5Test.as +0 -82
  88. data/tests/src/com/adobe/crypto/SHA1Test.as +0 -151
  89. data/tests/src/com/adobe/crypto/SHA224Test.as +0 -104
  90. data/tests/src/com/adobe/crypto/SHA256Test.as +0 -116
  91. data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +0 -87
  92. data/tests/src/com/adobe/images/JPGEncoderTest.as +0 -54
  93. data/tests/src/com/adobe/images/PNGEncoderTest.as +0 -54
  94. data/tests/src/com/adobe/net/URITest.as +0 -589
  95. data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +0 -59
  96. data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +0 -62
  97. data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +0 -61
  98. data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +0 -61
  99. data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +0 -61
  100. data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +0 -59
  101. data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +0 -63
  102. data/tests/src/com/adobe/protocols/events/MatchEventTest.as +0 -61
  103. data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +0 -61
  104. data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +0 -58
  105. data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +0 -60
  106. data/tests/src/com/adobe/serialization/json/JSONTest.as +0 -522
  107. data/tests/src/com/adobe/serialization/json/SimpleClass.as +0 -85
  108. data/tests/src/com/adobe/utils/ArrayUtilTest.as +0 -173
  109. data/tests/src/com/adobe/utils/DateUtilTest.as +0 -436
  110. data/tests/src/com/adobe/utils/DictionaryUtilTest.as +0 -93
  111. data/tests/src/com/adobe/utils/IntUtilTest.as +0 -73
  112. data/tests/src/com/adobe/utils/NumberFormatterTest.as +0 -70
  113. data/tests/src/com/adobe/utils/StringUtilTest.as +0 -304
  114. data/tests/src/com/adobe/utils/XMLUtilTest.as +0 -101
  115. data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +0 -66
@@ -1,245 +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
34
- {
35
- import flash.filesystem.File;
36
- import flash.utils.Timer;
37
- import flash.events.TimerEvent;
38
- import flash.events.Event;
39
- import flash.events.EventDispatcher;
40
- import com.adobe.air.filesystem.events.FileMonitorEvent;
41
-
42
- /*
43
- Todo:
44
-
45
- -Cmonitor changes in multiple attributes
46
- -add support for monitoring multiple files
47
- */
48
-
49
- /**
50
- * Dispatched when the modified date of the file being modified changes.
51
- *
52
- * @eventType com.adobe.air.filesystem.events.FileMonitor.CHANGE
53
- */
54
- [Event(name="CHANGE", type="com.adobe.air.filesystem.events.FileMonitor")]
55
-
56
- /**
57
- * Dispatched when the file being monitored is moved or deleted. The file
58
- * will be unwatched.
59
- *
60
- * @eventType com.adobe.air.filesystem.events.FileMonitor.MOVE
61
- */
62
- [Event(name="MOVE", type="com.adobe.air.filesystem.events.FileMonitor")]
63
-
64
- /**
65
- * Dispatched when the file being monitored is created.
66
- *
67
- * @eventType com.adobe.air.filesystem.events.FileMonitor.CREATE
68
- */
69
- [Event(name="CREATE", type="com.adobe.air.filesystem.events.FileMonitor")]
70
-
71
- /**
72
- * Class that monitors files for changes.
73
- */
74
- public class FileMonitor extends EventDispatcher
75
- {
76
- private var _file:File;
77
- private var timer:Timer;
78
- public static const DEFAULT_MONITOR_INTERVAL:Number = 1000;
79
- private var _interval:Number;
80
- private var fileExists:Boolean = false;
81
-
82
- private var lastModifiedTime:Number;
83
-
84
- /**
85
- * Constructor
86
- *
87
- * @parameter file The File that will be monitored for changes.
88
- *
89
- * @param interval How often in milliseconds the file is polled for
90
- * change events. Default value is 1000, minimum value is 1000
91
- */
92
- public function FileMonitor(file:File = null, interval:Number = -1)
93
- {
94
- this.file = file;
95
-
96
- if(interval != -1)
97
- {
98
- if(interval < 1000)
99
- {
100
- _interval = 1000;
101
- }
102
- else
103
- {
104
- _interval = interval;
105
- }
106
- }
107
- else
108
- {
109
- _interval = DEFAULT_MONITOR_INTERVAL;
110
- }
111
- }
112
-
113
- /**
114
- * File being monitored for changes.
115
- *
116
- * Setting the property will result in unwatch() being called.
117
- */
118
- public function get file():File
119
- {
120
- return _file;
121
- }
122
-
123
- public function set file(file:File):void
124
- {
125
- if(timer && timer.running)
126
- {
127
- unwatch();
128
- }
129
-
130
- _file = file;
131
-
132
- if(!_file)
133
- {
134
- fileExists = false;
135
- return;
136
- }
137
-
138
- //note : this will throw an error if new File() is passed in.
139
- fileExists = _file.exists;
140
- if(fileExists)
141
- {
142
- lastModifiedTime = _file.modificationDate.getTime();
143
- }
144
-
145
- }
146
-
147
- /**
148
- * How often the system is polled for Volume change events.
149
- */
150
- public function get interval():Number
151
- {
152
- return _interval;
153
- }
154
-
155
- /**
156
- * Begins monitoring the specified file for changes.
157
- *
158
- * Broadcasts Event.CHANGE event when the file's modification date has changed.
159
- */
160
- public function watch():void
161
- {
162
- if(!file)
163
- {
164
- //should we throw an error?
165
- return;
166
- }
167
-
168
- if(timer && timer.running)
169
- {
170
- return;
171
- }
172
-
173
- //check and see if timer is active. if it is, return
174
- if(!timer)
175
- {
176
- timer = new Timer(_interval);
177
- timer.addEventListener(TimerEvent.TIMER, onTimerEvent, false, 0, true);
178
- }
179
-
180
- timer.start();
181
- }
182
-
183
- /**
184
- * Stops watching the specified file for changes.
185
- */
186
- public function unwatch():void
187
- {
188
- if(!timer)
189
- {
190
- return;
191
- }
192
-
193
- timer.stop();
194
- timer.removeEventListener(TimerEvent.TIMER, onTimerEvent);
195
- }
196
-
197
- private function onTimerEvent(e:TimerEvent):void
198
- {
199
- var outEvent:FileMonitorEvent;
200
-
201
- if(fileExists != _file.exists)
202
- {
203
- if(_file.exists)
204
- {
205
- //file was created
206
- outEvent = new FileMonitorEvent(FileMonitorEvent.CREATE);
207
- lastModifiedTime = _file.modificationDate.getTime();
208
- }
209
- else
210
- {
211
- //file was moved / deleted
212
- outEvent = new FileMonitorEvent(FileMonitorEvent.MOVE);
213
- unwatch();
214
- }
215
- fileExists = _file.exists;
216
- }
217
- else
218
- {
219
- if(!_file.exists)
220
- {
221
- return;
222
- }
223
-
224
- var modifiedTime:Number = _file.modificationDate.getTime();
225
-
226
- if(modifiedTime == lastModifiedTime)
227
- {
228
- return;
229
- }
230
-
231
- lastModifiedTime = modifiedTime;
232
-
233
- //file modified
234
- outEvent = new FileMonitorEvent(FileMonitorEvent.CHANGE);
235
- }
236
-
237
- if(outEvent)
238
- {
239
- outEvent.file = _file;
240
- dispatchEvent(outEvent);
241
- }
242
-
243
- }
244
- }
245
- }
@@ -1,63 +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
34
- {
35
- import flash.system.Capabilities;
36
- import flash.filesystem.File;
37
-
38
-
39
- public class FileUtil
40
- {
41
- /**
42
- * @return An Array of Files representing the root directories of the
43
- * operating system.
44
- */
45
- public static function getRootDirectories():Array
46
- {
47
- var v:Array = File.getRootDirectories();
48
- var os:String = Capabilities.os;
49
-
50
- if(os.indexOf("Mac") > -1)
51
- {
52
- v = File(v[0]).resolvePath("Volumes").getDirectoryListing();
53
- }
54
- else if(os.indexOf("Linux") > -1)
55
- {
56
- //todo: need to impliment Linux
57
- }
58
-
59
- return v;
60
- }
61
-
62
- }
63
- }
@@ -1,184 +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
34
- {
35
- import flash.events.EventDispatcher;
36
- import flash.utils.Timer;
37
- import flash.events.TimerEvent;
38
- import flash.filesystem.File;
39
- import flash.utils.Dictionary;
40
- import com.adobe.air.filesystem.events.FileMonitorEvent;
41
- import com.adobe.utils.ArrayUtil;
42
-
43
- /**
44
- * Dispatched when a volume is added to the system.
45
- *
46
- * @eventType com.adobe.air.filesystem.events.FileMonitor.ADD_VOLUME
47
- */
48
- [Event(name="ADD_VOLUME", type="com.adobe.air.filesystem.events.FileMonitor")]
49
-
50
- /**
51
- * Dispatched when a volume is removed from the system.
52
- *
53
- * @eventType com.adobe.air.filesystem.events.FileMonitor.REMOVE_VOLUME
54
- */
55
- [Event(name="REMOVE_VOLUME", type="com.adobe.air.filesystem.events.FileMonitor")]
56
-
57
- /**
58
- * Class that monitors changes to the File volumes attached to the operating
59
- * system.
60
- */
61
- public class VolumeMonitor extends EventDispatcher
62
- {
63
- private var timer:Timer;
64
- private var _interval:Number;
65
- private static const DEFAULT_MONITOR_INTERVAL:Number = 2000;
66
-
67
- private var volumes:Dictionary;
68
-
69
- /**
70
- * Constructor.
71
- *
72
- * @param interval How often in milliseconds the system is polled for
73
- * volume change events. Default value is 2000, minimum value is 1000
74
- */
75
- public function VolumeMonitor(interval:Number = -1)
76
- {
77
- if(interval != -1)
78
- {
79
- if(interval < 1000)
80
- {
81
- _interval = 1000;
82
- }
83
- else
84
- {
85
- _interval = interval;
86
- }
87
- }
88
- else
89
- {
90
- _interval = DEFAULT_MONITOR_INTERVAL;
91
- }
92
- }
93
-
94
- /**
95
- * How often the system is polled for Volume change events.
96
- */
97
- public function get interval():Number
98
- {
99
- return _interval;
100
- }
101
-
102
- /**
103
- * Begins the monitoring of changes to the attached File volumes.
104
- */
105
- public function watch():void
106
- {
107
- if(!timer)
108
- {
109
- timer = new Timer(_interval);
110
- timer.addEventListener(TimerEvent.TIMER, onTimerEvent,false,0, true);
111
- }
112
-
113
- //we reinitialize the hash everytime we start watching
114
- volumes = new Dictionary();
115
-
116
- var v:Array = FileUtil.getRootDirectories();
117
- for each(var f:File in v)
118
- {
119
- //null or undefined
120
- if(volumes[f.url] == null)
121
- {
122
- volumes[f.url] = f;
123
- }
124
- }
125
-
126
- timer.start();
127
- }
128
-
129
- /**
130
- * Stops monitoring for changes to the attached File volumes.
131
- */
132
- public function unwatch():void
133
- {
134
- timer.stop();
135
- timer.removeEventListener(TimerEvent.TIMER, onTimerEvent);
136
- }
137
-
138
- private function onTimerEvent(e:TimerEvent):void
139
- {
140
- var v:Array = FileUtil.getRootDirectories();
141
-
142
- var outEvent:FileMonitorEvent;
143
- var found:Boolean = false;
144
- for(var key:String in volumes)
145
- {
146
- for each(var f:File in v)
147
- {
148
- //trace("--\n" + key);
149
- //trace(f.url);
150
- if(f.url == key)
151
- {
152
- found = true;
153
- break;
154
- }
155
- }
156
-
157
- if(!found)
158
- {
159
- outEvent = new FileMonitorEvent(FileMonitorEvent.REMOVE_VOLUME);
160
- outEvent.file = volumes[key];
161
- dispatchEvent(outEvent);
162
- delete volumes[key];
163
- }
164
-
165
- found = false;
166
- }
167
-
168
- for each(var f2:File in v)
169
- {
170
- //null or undefined
171
- if(volumes[f2.url] == null)
172
- {
173
- volumes[f2.url] = f2;
174
- outEvent = new FileMonitorEvent(FileMonitorEvent.ADD_VOLUME);
175
- outEvent.file = f2;
176
-
177
- dispatchEvent(outEvent);
178
- }
179
- }
180
- }
181
-
182
-
183
- }
184
- }