예제 #1
0
 public bool Equals(X9ImageField that)
 {
     if (this.Value != null && that.Value != null)
     {
         if (this.Value.Length != that.Value.Length)
         {
             return(false);
         }
         else
         {
             for (int i = 0; i < this.Value.Length; i++)
             {
                 if (this.Value[i] != that.Value[i])
                 {
                     return(false);
                 }
             }
             return(true);
         }
     }
     else
     {
         // Rubber stamp if we don't have access to the files
         return(true);
     }
 }
예제 #2
0
        static void WriteCheckSideImageToDisk(X9DepositItemImage image, DirectoryInfo destDir, string fileName, string virtualRunPath)
        {
            string       absPath    = Path.Combine(destDir.FullName, fileName);
            X9ImageField imageField = image.ImageViewData.ImageData;

            if (File.Exists(absPath))
            {
                File.Delete(absPath);
            }
            byte[] imageData = imageField.GetImageBytes();
            if (imageData != null && imageData.Any())
            {
                using (var imageBytes = new MemoryStream(imageData))
                    using (var outFile = File.OpenWrite(absPath))
                    {
                        imageBytes.CopyTo(outFile);
                    }

                if (virtualRunPath != null)
                {
                    Uri runRelativeUri = new Uri(StandardPaths.CombinePaths(virtualRunPath, destDir.Name, fileName), UriKind.Relative);
                    imageField.Image = FileReference.Create(absPath, runRelativeUri);
                }
            }
            else
            {
                throw new ArgumentNullException("Could not write image bytes to disk because none were found.");
            }
        }