public void SeekStreamToBeginning()
 {
     if (ImageMemoryStream != null)
     {
         ImageMemoryStream.Seek(0, SeekOrigin.Begin);
     }
 }
Пример #2
0
        public void WhenIProcessTheFile()
        {
            ImageMemoryStream.Seek(0, SeekOrigin.Begin);
            const string classifierConfigFile = "svm_config.xml";

            //Arrange
            var handler = new ImageRatingHandler
            {
                Parameters = new WorkItemBase.WorkItemParameters
                {
                    RuntimeData = new Dictionary <string, string>
                    {
                        { "ExhibitId", ExhibitId.ToString(CultureInfo.InvariantCulture) },
                        { "FileId", FileId.ToString(CultureInfo.InvariantCulture) },
                        { "FileCategoryId", CategoryId.ToString(CultureInfo.InvariantCulture) },
                        { "ClassifierConfigFile", Path.GetFullPath(classifierConfigFile) }
                    }
                },
                WorkItemDataStream = ImageMemoryStream
            };

            //Act
            using (new Performance("ImageRating"))
            {
                HandlerOutcome = handler.Execute();
            }
        }
        public void Dispose()
        {
            if (ImageMemoryStream != null)
            {
                ImageMemoryStream.Dispose();
            }

            ImageWidthInPixels  = 0;
            ImageHeightInPixels = 0;
        }
Пример #4
0
        private void SetUpImageForRating(string resourceLocation)
        {
            SetupTestData(resourceLocation);

            //need to insert into imagemetadata now so Image Rating
            var image            = new Bitmap(ImageMemoryStream);
            var imageAsByteArray = ImageMemoryStream.ToByteArray();

            new ImageMetadataTable(ExhibitConnectionString).InsertImageMetaData(ExhibitId, FileId, image.Width, image.Height, imageAsByteArray, imageAsByteArray);
        }
Пример #5
0
 public void Dispose()
 {
     ImageMemoryStream?.Dispose();
     Image?.Dispose();
 }
Пример #6
0
 public MemoryStream GetAndResetImageMemoryStream()
 {
     ImageMemoryStream.Seek(0, SeekOrigin.Begin);
     return(ImageMemoryStream);
 }