hongji.li
2023-11-07 1a1ba3ad5ed9e4380185aa1ccad20204a0e5f115
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Quintiq file version 2.0
#parent: #root
Method UploadFiles (
  structured[String] filenames
) id:Method_DialogEDIImport_UploadFiles
{
  #keys: '[132444.0.94011033]'
  Body:
  [*
    // Upload files to server
    importpath := EditorImportExportPath.Text();
    missingfiles := construct( Strings );
    uploadedfiles := construct( Strings );
    
    info('uploading files...');
    traverse( filenames, Elements, filename )
    {
      filepath := importpath + filename;
      info('2 Import path: [', filepath ,']' );
    
      if( Application.ClientFileExists( filepath ) )
      {
        clientfile := Application.GetClientFile( filepath );
        Application.TransferFromClient( clientfile );
        clientfilename := clientfile.LocalFileName();
        modeldatamanager := ExternalModelDataManager::Create();
        uploaded := modeldatamanager.Upload( clientfilename, filename );
    
        if ( uploaded )
        {
          uploadedfiles.Add( filepath );
        }
        Application.RemoveLocalCopy( clientfile );
      }
      else
      {
        missingfiles.Add( filepath );
      }
    }
    
    if ( uploadedfiles.Size() > 0 )
    {
      info('The following files have been loaded:' );
      traverse( uploadedfiles, Elements, e )
      {
        info(e);
      }
    }
    
    if ( missingfiles.Size() > 0 )
    {
      info('');
      info('(!) The following files were missing:' );
      traverse( missingfiles, Elements, e )
      {
        info(e);
      }
      info('Data for the missing files will be loaded from [Default server data]');
    }
    info('------------------------------')
  *]
}