/// <summary>
/// Extract files from zip file and upload.
public static List getUnzippedFiles(SharedServiceUnitURL _uploadFileURL, container _fileSuffixes)
{
#File
System.IO.Compression.ZipArchive zipArchive =
new System.IO.Compression.ZipArchive(File::UseFileFromURL(_uploadFileURL), System.IO.Compression.ZipArchiveMode::Read);
CLRObject archiveEntries = zipArchive.get_Entries();
int length = archiveEntries.get_Count();
List uploadUrlList = new List(types::Container);
container consUnzippedFile;
int i;
for (i = 0; i < length; i++)
{
System.IO.Compression.ZipArchiveEntry item = archiveEntries.get_Item(i);
List fileNameComponents = strSplit(item.Name, #FileExtensionDelimiter);
ListIterator iterator = new ListIterator(fileNameComponents);
str fileSuffix;
while (iterator.more())
{
fileSuffix = iterator.value();
iterator.next();
}
if (conLen(_fileSuffixes) == 0 || conFind(_fileSuffixes, fileSuffix) > 0)
{
using(System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
item.Open().CopyTo(stream);
str fileID = BankStatementImportUtils::sendFileToTempStore(stream, item.Name).getFileId();
consUnzippedFile = [fileID, item.Name];
uploadUrlList.addEnd(consUnzippedFile);
}
}
}
return uploadUrlList;
}
No comments:
Post a Comment