Synchronous worker class, not thread safe. Should be executed and touched by a single thread.
More...
|
static void | CopyStreamTo (System.IO.Stream src, System.IO.Stream dest) |
| Copies a read stream to a write stream. More...
|
|
|
void | WriteItemCallback (string entryName, System.IO.Stream stream) |
| Called from ZipFile.Save as each queued entry is processed. More...
|
|
void | z_SaveProgress (object sender, SaveProgressEventArgs e) |
|
void | z_ZipError (object sender, ZipErrorEventArgs e) |
|
void | CreateDestinationFolder () |
| If the parent folder of the destination archive is missing, this method will create it. More...
|
|
Synchronous worker class, not thread safe. Should be executed and touched by a single thread.
Definition at line 21 of file BatchResizeWorker.cs.
Creates a new worker instance. Do not modify the settings while executing the Work() method.
- Parameters
-
Definition at line 27 of file BatchResizeWorker.cs.
BatchResizeSettings s
Stores the job settings.
Builds a dictionary from a collection of BatchResizeItems, using .targetFilename as the key.
- Parameters
-
- Returns
Definition at line 311 of file BatchResizeWorker.cs.
312 Dictionary<string,BatchResizeItem> d =
new Dictionary<string,BatchResizeItem>(StringComparer.OrdinalIgnoreCase);
313 foreach(BatchResizeItem i
in files) d.Add(i.TargetFilename,i);
static void ImageResizer.Plugins.BatchZipper.BatchResizeWorker.CopyStreamTo |
( |
System.IO.Stream |
src, |
|
|
System.IO.Stream |
dest |
|
) |
| |
|
inlinestatic |
Copies a read stream to a write stream.
- Parameters
-
Definition at line 177 of file BatchResizeWorker.cs.
179 int size = (src.CanSeek) ? Math.Min((
int)(src.Length - src.Position), 0x2000) : 0x2000;
180 byte[] buffer =
new byte[size];
184 n = src.Read(buffer, 0, buffer.Length);
185 dest.Write(buffer, 0, n);
void ImageResizer.Plugins.BatchZipper.BatchResizeWorker.CreateDestinationFolder |
( |
| ) |
|
|
inlineprotected |
If the parent folder of the destination archive is missing, this method will create it.
Definition at line 301 of file BatchResizeWorker.cs.
302 string dir = System.IO.Path.GetDirectoryName(s.destinationFile);
303 if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory(dir);
JobStats ImageResizer.Plugins.BatchZipper.BatchResizeWorker.GetJobStats |
( |
| ) |
|
|
inline |
Returns a snapshots of the job statistics
- Returns
Definition at line 229 of file BatchResizeWorker.cs.
Dictionary< string, BatchResizeItem > items
Used to map ZIP item names to instances. Required do to DotNetZipLib's callback system.
int successfulItems
How many items have been successfully resized and zipped
int failedItems
How many items failed to be resized and zipped
void ImageResizer.Plugins.BatchZipper.BatchResizeWorker.Work |
( |
| ) |
|
|
inline |
Executes the job, and returns when it is complete or has failed. Exceptions are delivered by events registered in the BatchResizeSetting instance - throws no execptions, unless you throw an execption inside a job event handler.
Definition at line 57 of file BatchResizeWorker.cs.
BatchResizeSettings s
Stores the job settings.
void Work()
Executes the job, and returns when it is complete or has failed. Exceptions are delivered by events r...
bool ImageResizer.Plugins.BatchZipper.BatchResizeWorker.wouldResize |
( |
BatchResizeItem |
i | ) |
|
|
inline |
Returns true if the specified item is going to be resized.
- Parameters
-
- Returns
Definition at line 140 of file BatchResizeWorker.cs.
143 bool resize = s.conf.Pipeline.IsAcceptedImageType(i.PhysicalPath);
145 if (String.IsNullOrEmpty(i.ResizeQuerystring)) resize =
false;
void ImageResizer.Plugins.BatchZipper.BatchResizeWorker.WriteItemCallback |
( |
string |
entryName, |
|
|
System.IO.Stream |
stream |
|
) |
| |
|
inlineprotected |
Called from ZipFile.Save as each queued entry is processed.
- Parameters
-
Definition at line 153 of file BatchResizeWorker.cs.
155 BatchResizeItem i =
items[entryName];
159 using (MemoryStream ms =
new MemoryStream()) {
160 s.conf.CurrentImageBuilder.Build(i.PhysicalPath, ms,
new ResizeSettings(i.ResizeQuerystring));
162 StreamUtils.CopyTo(ms, stream);
170 using (System.IO.FileStream
s = System.IO.File.OpenRead(i.PhysicalPath))
CopyStreamTo(s, stream);
bool wouldResize(BatchResizeItem i)
Returns true if the specified item is going to be resized.
Dictionary< string, BatchResizeItem > items
Used to map ZIP item names to instances. Required do to DotNetZipLib's callback system.
static void CopyStreamTo(System.IO.Stream src, System.IO.Stream dest)
Copies a read stream to a write stream.
Represents the settings which will be used to process the image. Extends NameValueCollection to provi...
BatchResizeSettings s
Stores the job settings.
int ImageResizer.Plugins.BatchZipper.BatchResizeWorker.failedItems = 0 |
|
protected |
DateTime ImageResizer.Plugins.BatchZipper.BatchResizeWorker.finishedAt = DateTime.MaxValue |
|
protected |
Dictionary<string,BatchResizeItem> ImageResizer.Plugins.BatchZipper.BatchResizeWorker.items |
|
protected |
Used to map ZIP item names to instances. Required do to DotNetZipLib's callback system.
Definition at line 37 of file BatchResizeWorker.cs.
List<ItemResult> ImageResizer.Plugins.BatchZipper.BatchResizeWorker.results = null |
|
protected |
SaveProgressEventArgs ImageResizer.Plugins.BatchZipper.BatchResizeWorker.savingCompletedEventArgs = null |
|
protected |
Stores the results of the Zip file saving betweent he time Saving_Completed fires, and we close the ZipFile instance and fire our own event
Definition at line 191 of file BatchResizeWorker.cs.
DateTime ImageResizer.Plugins.BatchZipper.BatchResizeWorker.startedAt = DateTime.MaxValue |
|
protected |
int ImageResizer.Plugins.BatchZipper.BatchResizeWorker.successfulItems = 0 |
|
protected |
The documentation for this class was generated from the following file: