1"""Suite Special Events: Commands for mounting Disk Copy images 2Level 1, version 1 3 4Generated from Macintosh HD:Hulpprogramma's:Disk Copy 5AETE/AEUT resource version 1/0, language 0, script 0 6""" 7 8import aetools 9import MacOS 10 11_code = 'ddsk' 12 13class Special_Events_Events: 14 15 _argmap_mount = { 16 'access_mode' : 'Acss', 17 'checksum_verification' : 'VChk', 18 'signature_verification' : 'VSig', 19 'RAM_caching' : 'Cach', 20 } 21 22 def mount(self, _object, _attributes={}, **_arguments): 23 """mount: Mounts a Disk Copy image as a disk volume 24 Required argument: a reference to the disk image to be mounted 25 Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible) 26 Keyword argument checksum_verification: Verify the checksum before mounting? 27 Keyword argument signature_verification: Verify the DigiSign� signature before mounting? 28 Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache) 29 Keyword argument _attributes: AppleEvent attribute dictionary 30 Returns: a reference to mounted disk 31 """ 32 _code = 'ddsk' 33 _subcode = 'Moun' 34 35 aetools.keysubst(_arguments, self._argmap_mount) 36 _arguments['----'] = _object 37 38 aetools.enumsubst(_arguments, 'Acss', _Enum_Acss) 39 aetools.enumsubst(_arguments, 'VChk', _Enum_bool) 40 aetools.enumsubst(_arguments, 'VSig', _Enum_bool) 41 aetools.enumsubst(_arguments, 'Cach', _Enum_bool) 42 43 _reply, _arguments, _attributes = self.send(_code, _subcode, 44 _arguments, _attributes) 45 if _arguments.has_key('errn'): 46 raise aetools.Error, aetools.decodeerror(_arguments) 47 # XXXX Optionally decode result 48 if _arguments.has_key('----'): 49 return _arguments['----'] 50 51 _argmap_execute_DiskScript = { 52 'checksum_verification' : 'VChk', 53 'signature_verification' : 'VSig', 54 } 55 56 def execute_DiskScript(self, _object, _attributes={}, **_arguments): 57 """execute DiskScript: Executes a Disk Copy-specific DiskScript 58 Required argument: a reference to the DiskScript to execute 59 Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript? 60 Keyword argument signature_verification: Should the DigiSign� signature of the DiskScript and the images it references be verified? 61 Keyword argument _attributes: AppleEvent attribute dictionary 62 """ 63 _code = 'ddsk' 64 _subcode = 'XEQd' 65 66 aetools.keysubst(_arguments, self._argmap_execute_DiskScript) 67 _arguments['----'] = _object 68 69 aetools.enumsubst(_arguments, 'VChk', _Enum_bool) 70 aetools.enumsubst(_arguments, 'VSig', _Enum_bool) 71 72 _reply, _arguments, _attributes = self.send(_code, _subcode, 73 _arguments, _attributes) 74 if _arguments.has_key('errn'): 75 raise aetools.Error, aetools.decodeerror(_arguments) 76 # XXXX Optionally decode result 77 if _arguments.has_key('----'): 78 return _arguments['----'] 79 80 def unmount(self, _object, _attributes={}, **_arguments): 81 """unmount: Unmount and eject (if necessary) a volume 82 Required argument: a reference to disk to be unmounted (and ejected) 83 Keyword argument _attributes: AppleEvent attribute dictionary 84 """ 85 _code = 'ddsk' 86 _subcode = 'Umnt' 87 88 if _arguments: raise TypeError, 'No optional args expected' 89 _arguments['----'] = _object 90 91 92 _reply, _arguments, _attributes = self.send(_code, _subcode, 93 _arguments, _attributes) 94 if _arguments.has_key('errn'): 95 raise aetools.Error, aetools.decodeerror(_arguments) 96 # XXXX Optionally decode result 97 if _arguments.has_key('----'): 98 return _arguments['----'] 99 100 _argmap_create = { 101 'saving_as' : 'SvAs', 102 'logical_blocks' : 'Blks', 103 'zeroing' : 'Zero', 104 'leave_image_mounted' : 'Moun', 105 'filesystem' : 'Fsys', 106 } 107 108 def create(self, _object, _attributes={}, **_arguments): 109 """create: Create a new Disk Copy document 110 Required argument: the name of the volume to create 111 Keyword argument saving_as: the disk image to be created 112 Keyword argument logical_blocks: the number of logical blocks 113 Keyword argument zeroing: Should all blocks on the disk be set to zero? 114 Keyword argument leave_image_mounted: Should the image be mounted after it is created? 115 Keyword argument filesystem: file system to use (Mac OS Standard/compatible, Mac OS Enhanced) 116 Keyword argument _attributes: AppleEvent attribute dictionary 117 Returns: a reference to newly created disk image (or newly mounted disk) 118 """ 119 _code = 'ddsk' 120 _subcode = 'Crea' 121 122 aetools.keysubst(_arguments, self._argmap_create) 123 _arguments['----'] = _object 124 125 aetools.enumsubst(_arguments, 'SvAs', _Enum_fss_) 126 aetools.enumsubst(_arguments, 'Blks', _Enum_long) 127 aetools.enumsubst(_arguments, 'Zero', _Enum_bool) 128 aetools.enumsubst(_arguments, 'Moun', _Enum_bool) 129 aetools.enumsubst(_arguments, 'Fsys', _Enum_Fsys) 130 131 _reply, _arguments, _attributes = self.send(_code, _subcode, 132 _arguments, _attributes) 133 if _arguments.has_key('errn'): 134 raise aetools.Error, aetools.decodeerror(_arguments) 135 # XXXX Optionally decode result 136 if _arguments.has_key('----'): 137 return _arguments['----'] 138 139 def verify_checksum(self, _object, _attributes={}, **_arguments): 140 """verify checksum: Verify the checksum of a Disk Copy 4.2 or a Disk Copy 6.0 read-only document 141 Required argument: the disk image to be verified 142 Keyword argument _attributes: AppleEvent attribute dictionary 143 Returns: the result of the checksum verification 144 """ 145 _code = 'ddsk' 146 _subcode = 'Vcrc' 147 148 if _arguments: raise TypeError, 'No optional args expected' 149 _arguments['----'] = _object 150 151 152 _reply, _arguments, _attributes = self.send(_code, _subcode, 153 _arguments, _attributes) 154 if _arguments.has_key('errn'): 155 raise aetools.Error, aetools.decodeerror(_arguments) 156 # XXXX Optionally decode result 157 if _arguments.has_key('----'): 158 return _arguments['----'] 159 160 def verify_signature(self, _object, _attributes={}, **_arguments): 161 """verify signature: Verify the DigiSign� signature for a Disk Copy document 162 Required argument: the disk image to be verified 163 Keyword argument _attributes: AppleEvent attribute dictionary 164 Returns: Is the DigiSign� signature valid? 165 """ 166 _code = 'ddsk' 167 _subcode = 'Vsig' 168 169 if _arguments: raise TypeError, 'No optional args expected' 170 _arguments['----'] = _object 171 172 173 _reply, _arguments, _attributes = self.send(_code, _subcode, 174 _arguments, _attributes) 175 if _arguments.has_key('errn'): 176 raise aetools.Error, aetools.decodeerror(_arguments) 177 # XXXX Optionally decode result 178 if _arguments.has_key('----'): 179 return _arguments['----'] 180 181 _argmap_sign_image = { 182 'using_signer' : 'Sinr', 183 } 184 185 def sign_image(self, _object, _attributes={}, **_arguments): 186 """sign image: Add a DigiSign� signature to a Disk Copy document 187 Required argument: the disk image to be signed 188 Keyword argument using_signer: a reference to signer file to use 189 Keyword argument _attributes: AppleEvent attribute dictionary 190 """ 191 _code = 'ddsk' 192 _subcode = 'Asig' 193 194 aetools.keysubst(_arguments, self._argmap_sign_image) 195 _arguments['----'] = _object 196 197 aetools.enumsubst(_arguments, 'Sinr', _Enum_alis) 198 199 _reply, _arguments, _attributes = self.send(_code, _subcode, 200 _arguments, _attributes) 201 if _arguments.has_key('errn'): 202 raise aetools.Error, aetools.decodeerror(_arguments) 203 # XXXX Optionally decode result 204 if _arguments.has_key('----'): 205 return _arguments['----'] 206 207 _argmap_create_a_floppy_from = { 208 'signature_verification' : 'VSig', 209 'erase_confirmation' : 'Cfrm', 210 'make_multiple_floppies' : 'Mult', 211 } 212 213 def create_a_floppy_from(self, _object, _attributes={}, **_arguments): 214 """create a floppy from: create a floppy disk from a Disk Copy document 215 Required argument: the disk image to make a floppy from 216 Keyword argument signature_verification: Should the DigiSign� signature be verified before creating a floppy disk? 217 Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks? 218 Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks? 219 Keyword argument _attributes: AppleEvent attribute dictionary 220 """ 221 _code = 'ddsk' 222 _subcode = 'Bfpy' 223 224 aetools.keysubst(_arguments, self._argmap_create_a_floppy_from) 225 _arguments['----'] = _object 226 227 aetools.enumsubst(_arguments, 'VSig', _Enum_bool) 228 aetools.enumsubst(_arguments, 'Cfrm', _Enum_bool) 229 aetools.enumsubst(_arguments, 'Mult', _Enum_bool) 230 231 _reply, _arguments, _attributes = self.send(_code, _subcode, 232 _arguments, _attributes) 233 if _arguments.has_key('errn'): 234 raise aetools.Error, aetools.decodeerror(_arguments) 235 # XXXX Optionally decode result 236 if _arguments.has_key('----'): 237 return _arguments['----'] 238 239 _argmap_check_image = { 240 'details' : 'ChDe', 241 } 242 243 def check_image(self, _object, _attributes={}, **_arguments): 244 """check image: Check the disk image�s internal data structures for any inconsistencies. Works on NDIF, Disk Copy 4.2, DART�, or DiskSet images. 245 Required argument: the disk image to be verified 246 Keyword argument details: Should the disk image details be displayed? 247 Keyword argument _attributes: AppleEvent attribute dictionary 248 Returns: a record containing a boolean (true/false) value if the image passes consistency tests, and the numbers of warnings and errors 249 """ 250 _code = 'ddsk' 251 _subcode = 'Chek' 252 253 aetools.keysubst(_arguments, self._argmap_check_image) 254 _arguments['----'] = _object 255 256 aetools.enumsubst(_arguments, 'ChDe', _Enum_bool) 257 258 _reply, _arguments, _attributes = self.send(_code, _subcode, 259 _arguments, _attributes) 260 if _arguments.has_key('errn'): 261 raise aetools.Error, aetools.decodeerror(_arguments) 262 # XXXX Optionally decode result 263 if _arguments.has_key('----'): 264 return _arguments['----'] 265 266 _argmap_segment_image = { 267 'segment_count' : 'SGCT', 268 'segment_size' : 'SGSZ', 269 'segment_name' : 'SGNM', 270 'image_ID' : 'SGID', 271 } 272 273 def segment_image(self, _object, _attributes={}, **_arguments): 274 """segment image: Segment a NDIF R/W or R/O image into smaller pieces 275 Required argument: the disk image to be segmented 276 Keyword argument segment_count: the number of image segments to create 277 Keyword argument segment_size: the size of image segments (in blocks) to create 278 Keyword argument segment_name: the root name for each image segment file 279 Keyword argument image_ID: string used to generate a unique image ID to group the segments 280 Keyword argument _attributes: AppleEvent attribute dictionary 281 Returns: a list of references to the image segments created 282 """ 283 _code = 'ddsk' 284 _subcode = 'SGMT' 285 286 aetools.keysubst(_arguments, self._argmap_segment_image) 287 _arguments['----'] = _object 288 289 290 _reply, _arguments, _attributes = self.send(_code, _subcode, 291 _arguments, _attributes) 292 if _arguments.has_key('errn'): 293 raise aetools.Error, aetools.decodeerror(_arguments) 294 # XXXX Optionally decode result 295 if _arguments.has_key('----'): 296 return _arguments['----'] 297 298 _argmap_create_SMI = { 299 'source_images' : 'SMI1', 300 'launching_application' : 'SMI2', 301 'launching_document' : 'SMI3', 302 'version_string' : 'SMI4', 303 'checksum_verification' : 'VChk', 304 'signature_verification' : 'VSig', 305 'image_signing' : 'SImg', 306 } 307 308 def create_SMI(self, _object, _attributes={}, **_arguments): 309 """create SMI: Creates a self-mounting image (SMI) from a list of NDIF disk images 310 Required argument: the self-mounting image to create 311 Keyword argument source_images: a list of references to sources images 312 Keyword argument launching_application: the path to an application to launch 313 Keyword argument launching_document: the path to a document to open 314 Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image 315 Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI? 316 Keyword argument signature_verification: Should the DigiSign� signature of the source images be verified before creating the SMI? 317 Keyword argument image_signing: Should the SMI be given a digital signature when it is created? 318 Keyword argument _attributes: AppleEvent attribute dictionary 319 Returns: a reference to the self-mounting image created 320 """ 321 _code = 'ddsk' 322 _subcode = 'MSMI' 323 324 aetools.keysubst(_arguments, self._argmap_create_SMI) 325 _arguments['----'] = _object 326 327 aetools.enumsubst(_arguments, 'VChk', _Enum_bool) 328 aetools.enumsubst(_arguments, 'VSig', _Enum_bool) 329 aetools.enumsubst(_arguments, 'SImg', _Enum_bool) 330 331 _reply, _arguments, _attributes = self.send(_code, _subcode, 332 _arguments, _attributes) 333 if _arguments.has_key('errn'): 334 raise aetools.Error, aetools.decodeerror(_arguments) 335 # XXXX Optionally decode result 336 if _arguments.has_key('----'): 337 return _arguments['----'] 338 339 340class Verify_Checksum_reply_record(aetools.ComponentItem): 341 """Verify Checksum reply record - """ 342 want = 'Rcrc' 343class validity(aetools.NProperty): 344 """validity - true if checksum is valid """ 345 which = 'Vlid' 346 want = 'bool' 347class expected_checksum(aetools.NProperty): 348 """expected checksum - checksum value stored in the image header (in hexadecimal) """ 349 which = 'crcE' 350 want = 'TEXT' 351class calculated_checksum(aetools.NProperty): 352 """calculated checksum - checksum value actually calculated (in hexadecimal) """ 353 which = 'crcA' 354 want = 'TEXT' 355 356class Check_Image_reply_record(aetools.ComponentItem): 357 """Check Image reply record - """ 358 want = 'Rchk' 359class consistency(aetools.NProperty): 360 """consistency - Does the image pass consistency checks? """ 361 which = 'Rch1' 362 want = 'bool' 363class error_count(aetools.NProperty): 364 """error count - the number of errors recorded """ 365 which = 'Rch2' 366 want = 'long' 367class warning_count(aetools.NProperty): 368 """warning count - the number of warnings recorded """ 369 which = 'Rch3' 370 want = 'long' 371Verify_Checksum_reply_record._propdict = { 372 'validity' : validity, 373 'expected_checksum' : expected_checksum, 374 'calculated_checksum' : calculated_checksum, 375} 376Verify_Checksum_reply_record._elemdict = { 377} 378Check_Image_reply_record._propdict = { 379 'consistency' : consistency, 380 'error_count' : error_count, 381 'warning_count' : warning_count, 382} 383Check_Image_reply_record._elemdict = { 384} 385_Enum_Acss = { 386 'read_and_write' : 'RdWr', # read/write access 387 'read_only' : 'Rdxx', # read-only access 388 'any' : 'Anyx', # best possible access 389} 390 391_Enum_Fsys = { 392 'Mac_OS_Standard' : 'Fhfs', # classic HFS file system 393 'compatible_Mac_OS_Extended' : 'Fhf+', # new HFS+ file system 394} 395 396_Enum_alis = None # XXXX enum alis not found!! 397_Enum_fss_ = None # XXXX enum fss not found!! 398_Enum_long = None # XXXX enum long not found!! 399_Enum_bool = None # XXXX enum bool not found!! 400 401# 402# Indices of types declared in this module 403# 404_classdeclarations = { 405 'Rchk' : Check_Image_reply_record, 406 'Rcrc' : Verify_Checksum_reply_record, 407} 408 409_propdeclarations = { 410 'crcE' : expected_checksum, 411 'Rch2' : error_count, 412 'crcA' : calculated_checksum, 413 'Rch3' : warning_count, 414 'Vlid' : validity, 415 'Rch1' : consistency, 416} 417 418_compdeclarations = { 419} 420 421_enumdeclarations = { 422 'Acss' : _Enum_Acss, 423 'Fsys' : _Enum_Fsys, 424} 425