public JwList<VmScheduledUpload> GetChunkedScheduledUploads() { JwList<VmScheduledUpload> uploads = new JwList<VmScheduledUpload>(); JwList<JwCsvRow> rows = JwUtility.ReadCsvFile(GetChunkedSessionManifestFileName()); foreach( JwCsvRow row in rows) { VmScheduledUpload upload = new VmScheduledUpload(); upload.Name = row.Fields[0]; upload.FileType = row.Fields[1]; upload.SizeInBytes = JwUtility.ParseInteger(row.Fields[2]); upload.AirportCode = row.Fields[3]; uploads.Add(upload); } return uploads; }
public void AddUpload( JwList<VmScheduledUpload> v, String name, String fullName, String fileTypeCode, String airportCode) { VmScheduledUpload o = new VmScheduledUpload(); o.Name = name; o.FullName = fullName; o.FileType = fileTypeCode; o.AirportCode = airportCode; FileInfo fi = new FileInfo(fullName); o.SizeInBytes = ( fi.Exists ) ? fi.Length : 0; v.Add(o); }
public void WriteFile(VmScheduledUpload upload) { WriteFile( upload.AirportCode, upload.FileType, upload.Name, upload.FullName); }
public void UploadChunk(StringBuilder sb, VmScheduledUpload upload, long endByte) { long beginByte = endByte + 1; long remainingLength = _packetSize - sb.Length; long desiredEndByte = beginByte + remainingLength; long constrainedEndByte = upload.SizeInBytes; endByte = Math.Min(desiredEndByte, constrainedEndByte); String fileName = _manager.GetPathToFile( upload.AirportCode, upload.FileType, upload.Name); String value = JwUtility.ReadPartially( fileName, (int)beginByte, (int)endByte); sb.Append(value); if( sb.Length == _packetSize) { Upload(sb); sb.Length = 0; } if( endByte == upload.SizeInBytes) { if( _uploads.IsEmpty() ) { if( sb.Length != 0) Upload(sb); return; } upload = _uploads.RemoveFirst(); endByte = 0; } UploadChunk(sb, upload, endByte-1); }