protected void btnMigrateImages_Click(object sender, EventArgs e) { int cBytesDone = 0; int cFilesDone = 0; if (!int.TryParse(txtLimitMB.Text, out int cMBytesLimit)) { cMBytesLimit = 100; } int cBytesLimit = cMBytesLimit * 1024 * 1024; if (!int.TryParse(txtLimitFiles.Text, out int cFilesLimit)) { cFilesLimit = 100; } Dictionary <string, MFBImageCollection> images = MFBImageInfo.FromDB(CurrentSource, true); List <string> lstKeys = images.Keys.ToList(); if (CurrentSource == MFBImageInfoBase.ImageClass.Aircraft || CurrentSource == MFBImageInfoBase.ImageClass.Flight) { lstKeys.Sort((sz1, sz2) => { return(Convert.ToInt32(sz2, CultureInfo.InvariantCulture) - Convert.ToInt32(sz1, CultureInfo.InvariantCulture)); }); } else { lstKeys.Sort(); } // ImageDict foreach (string szKey in lstKeys) { if (cBytesDone > cBytesLimit || cFilesDone >= cFilesLimit) { break; } AWSImageManagerAdmin im = new AWSImageManagerAdmin(); foreach (MFBImageInfo mfbii in images[szKey]) { int cBytes = im.ADMINMigrateToS3(mfbii); if (cBytes >= 0) // migration occured { cBytesDone += cBytes; cFilesDone++; } if (cBytesDone > cBytesLimit || cFilesDone >= cFilesLimit) { break; } } } lblMigrateResults.Text = String.Format(CultureInfo.CurrentCulture, Resources.Admin.MigrateImagesTemplate, cFilesDone, cBytesDone); }
protected void btnMigrateImages_Click(object sender, EventArgs e) { Int32 cBytesDone = 0; Int32 cFilesDone = 0; Int32 cMBytesLimit = 100; Int32 cFilesLimit = 100; if (!Int32.TryParse(txtLimitMB.Text, out cMBytesLimit)) { cMBytesLimit = 100; } Int32 cBytesLimit = cMBytesLimit * 1024 * 1024; if (!Int32.TryParse(txtLimitFiles.Text, out cFilesLimit)) { cFilesLimit = 100; } Dictionary <string, List <MFBImageInfo> > images = ImageDictionary; foreach (string szKey in SortedKeys) { if (cBytesDone > cBytesLimit || cFilesDone >= cFilesLimit) { break; } AWSImageManagerAdmin im = new AWSImageManagerAdmin(); foreach (MFBImageInfo mfbii in images[szKey]) { Int32 cBytes = im.ADMINMigrateToS3(mfbii); if (cBytes >= 0) // migration occured { cBytesDone += cBytes; cFilesDone++; } if (cBytesDone > cBytesLimit || cFilesDone >= cFilesLimit) { break; } } } lblMigrateResults.Text = String.Format(CultureInfo.CurrentCulture, Resources.Admin.MigrateImagesTemplate, cFilesDone, cBytesDone); }