' Images in memory Public oImageData As Dictionary(Of String, ImageData) = New Dictionary(Of String, ImageData)This is the application class ImageData:
' ImageData class Public Class ImageData Private cExtension As String = "" Private nHeight As Integer = 0 Private nWidth As Integer = 0 Friend Property Extension() As String Get Return cExtension End Get Private Set(tcValue As String) cExtension = tcValue End Set End Property Friend Property Height() As Integer Get Return nHeight End Get Private Set(tnValue As Integer) nHeight = tnValue End Set End Property Friend Property Width() As Integer Get Return nWidth End Get Private Set(tnValue As Integer) nWidth = tnValue End Set End Property Friend Sub New(tnWidth As Integer, tnHeight As Integer, tcExtension As String) Width = tnWidth Height = tnHeight Extension = tcExtension End Sub End ClassThis is the initialization part:
' If this is the Web site If oApp.nApplicationMode = 3 Then ' If we have some images in memory If oApp.oAdmin.oRow("Image").length > 0 Then ' Load the application into the string builder loStringBuilderFile.LoadString(oApp.oAdmin.oRow("Image")) ' For each image For lnCounter = 1 To loStringBuilderFile.nLine ' Get the line If Not loStringBuilderFile.MLine(lnCounter) Then Return False End If lcImage = loStringBuilderFile.cLine ' If the file exists If oApp.FileExist(oApp.cGraphicFat + lcImage) Then ' Get the image details making it OK to reender the HTML without flickering loImage = New System.Drawing.Bitmap(oApp.cGraphicFat + lcImage) lnWidth = loImage.Width lnHeight = loImage.Height ' Initializaiton lcName = Trim(lcImage) lnLocation = oApp.At(".", lcName) lcExtension = "" ' If we have found it If lnLocation > 0 Then ' If this is not the last character If lnLocation < lcName.Length Then lcExtension = Mid(lcName, lnLocation + 1) End If End If oApp.oImageData.Add(UCase(lcImage), New ImageData(lnWidth, lnHeight, lcExtension)) Else AddError(oApp.cGraphicFat + lcImage + " does not exist.") End If Next End If End IfThis is the query part:
' Return True or False if an image is loaded in memory ' expC1 Name Public Function IsImageInMemory(ByVal tcName As String) As Boolean Dim lcName As String = "" Dim llFound As Boolean = False Dim loImageData As ImageData = Nothing ' Initialization lcName = UCase(Trim(tcName)) ' If the image is found in the dictionary If oProcess.oApp.oImageData.TryGetValue(lcName, loImageData) Then llFound = True ' Initialization nWidth = loImageData.Width nHeight = loImageData.Height End If Return llFound End Function