| Quintiq file version 2.0 | 
| #parent: #root | 
| Method DownloadFiles ( | 
|   structured[String] filenames | 
| ) id:Method_DialogEDIExportDEV_DownloadFiles | 
| { | 
|   #keys: '[108486.1.1111202994]' | 
|   Body: | 
|   [* | 
|     // Download files to client | 
|     exportpath := EditorImportExportPath.Text() | 
|     datasetname := ExternalMDSEditor::Editor().ObjectInfo( MacroPlan.MDSID() ).Name(); | 
|     downloadfiles := construct( Strings ); | 
|      | 
|     traverse( filenames, Elements, filename ) | 
|     { | 
|       filepath := exportpath + filename; | 
|       clientfile := Application.GetClientFile( filepath ); | 
|       clientfilename := clientfile.LocalFileName(); | 
|       modeldatamanager := ExternalModelDataManager::Create(); | 
|       if( filename.StartsWith( 'SM' ) ) | 
|       { | 
|         filename := filename.InsertBefore( '_ObjectMDS_' + 'ScenarioManager', '.xlsx' ); | 
|       } | 
|       else | 
|       { | 
|         filename := filename.InsertBefore( '_ObjectMDS_' + datasetname, '.xlsx' ); | 
|       } | 
|      | 
|       if( not modeldatamanager.FileExists( filename ) ) | 
|       { | 
|         error( filename, ' not found in server data' ) | 
|       } | 
|      | 
|      | 
|       downloaded := modeldatamanager.Download( filename, clientfilename ); | 
|       Application.TransferToClient( clientfile ); | 
|      | 
|       if ( downloaded ) | 
|       { | 
|         downloadfiles.Add( filepath ); | 
|       } | 
|       Application.RemoveLocalCopy( clientfile ); | 
|     } | 
|      | 
|     info('Downloaded files:', downloadfiles.Size() ); | 
|      | 
|     if ( downloadfiles.Size() > 0 ) | 
|     { | 
|       info('The following files have been exported:' ); | 
|       traverse( downloadfiles, Elements, e ) | 
|       { | 
|         info("'", e, "'"); | 
|       } | 
|     } | 
|     info('------------------------------') | 
|   *] | 
| } |