Ewl » Canonical The canonical version of EWL Read More
Clone URL:  
Pushed to 2 repositories · View In Graph Contained in tip and canonical

Removed System.Drawing parameter from BlobManagementStatics.ValidateUploadedFile
to save client code from having to reference System.Drawing.

Changeset 8b7e7632ab9e

Parent 56bd720f6ca3

by Profile picture of William GrossWilliam Gross

Changes to one file · Browse files at 8b7e7632ab9e Showing diff from parent 56bd720f6ca3 Diff from another changeset...

 
16
17
18
19
20
21
 
22
23
24
 
37
38
39
40
41
42
43
 
 
44
45
46
 
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
16
17
18
 
 
 
19
20
21
22
 
35
36
37
 
 
 
 
38
39
40
41
42
 
46
47
48
 
 
 
 
 
 
 
 
 
 
49
50
51
@@ -16,9 +16,7 @@
  /// Pass null for acceptableFileExtensions if there is no restriction on file extension.   /// PerformAdditionalImageValidation cannot be null but may be an empty delegate.   /// </summary> - public static void ValidateUploadedFile( - Validator validator, RsFile file, string[] acceptableFileExtensions, Action<Validator, System.Drawing.Image> performAdditionalImageValidation, - bool mustBeRenderableImage ) { + public static void ValidateUploadedFile( Validator validator, RsFile file, string[] acceptableFileExtensions, bool mustBeRenderableImage ) {   if( file == null )   return;   @@ -37,10 +35,8 @@
  else   // Make sure it is an image type that we understand. Also perform optional custom validation.   try { - using( var stream = new MemoryStream( file.Contents ) ) { - var image = System.Drawing.Image.FromStream( stream ); - performAdditionalImageValidation( validator, image ); - } + using( var stream = new MemoryStream( file.Contents ) ) + System.Drawing.Image.FromStream( stream );   }   catch( ArgumentException ) {   // If we end up in this catch block, it means that System.Drawing.Image does not understand our image. Since we already know that our content type @@ -50,16 +46,6 @@
  }     /// <summary> - /// Provides a height/width image validation method without you having to create a custom validation method. - /// </summary> - public static Action<Validator, System.Drawing.Image> GetWidthAndHeightImageValidationMethod( int width, int height ) { - return ( validator2, image ) => { - if( image.Height != height || image.Width != width ) - validator2.NoteErrorAndAddMessage( "Image must be " + width + "x" + height + " pixels." ); - }; - } - - /// <summary>   /// Returns null if the file is null, the file is not an image, or there is no thumbnail resource info creator.   /// </summary>   internal static IEnumerable<Control> GetThumbnailControl( BlobFile file, Func<decimal, ResourceInfo> thumbnailResourceInfoCreator ) {