-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The ImageOptimizer now returns more information about the optimized f…
…iles.
- Loading branch information
Showing
9 changed files
with
143 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace DeveImageOptimizer.Helpers | ||
{ | ||
public static class FileHelperMethods | ||
{ | ||
public static void SafeDeleteTempFile(string path) | ||
{ | ||
try | ||
{ | ||
if (File.Exists(path)) | ||
{ | ||
File.Delete(path); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Warning: Couldn't remove tempfile at path: '{path}'. Exception:{Environment.NewLine}{ex}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace DeveImageOptimizer.State | ||
namespace DeveImageOptimizer.State | ||
{ | ||
public interface IFilesProcessingState | ||
{ | ||
void AddProcessedFile(string file); | ||
void AddFailedFile(string file); | ||
void AddProcessedFile(OptimizedFileResult optimizedFileResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace DeveImageOptimizer.State | ||
{ | ||
public class OptimizedFileResult | ||
{ | ||
public string Path { get; } | ||
public bool Successful { get; } | ||
|
||
public long OriginalSize { get; } | ||
public long OptimizedSize { get; } | ||
|
||
public List<string> Errors { get; set; } | ||
|
||
public OptimizedFileResult(string path, bool successful, long originalSize, long optimizedSize, List<string> errors) | ||
{ | ||
Path = path; | ||
Successful = successful; | ||
OriginalSize = originalSize; | ||
OptimizedSize = optimizedSize; | ||
Errors = errors; | ||
} | ||
} | ||
} |