Beispiel #1
0
        public static void CheckReferencesAndDispose(Image ReferencedImage, PictureBoxWithInterpolationMode[] PictureBoxes, PictureBoxWithInterpolationMode SelectedAcreBox)
        {
            if (ReferencedImage != null)
            {
                if (SelectedAcreBox.Image == ReferencedImage)
                {
                    return;
                }

                foreach (PictureBoxWithInterpolationMode Box in PictureBoxes)
                {
                    if (Box != null && Box.BackgroundImage == ReferencedImage)
                    {
                        return;
                    }
                }

                foreach (KeyValuePair <ushort, Image> Pair in LoadedImageDictionary)
                {
                    if (Pair.Value == ReferencedImage)
                    {
                        LoadedImageDictionary.Remove(Pair.Key);
                        break;
                    }
                }

                foreach (KeyValuePair <byte, Image> Pair in LoadedAnimalCrossingMapIcons)
                {
                    if (Pair.Value == ReferencedImage)
                    {
                        LoadedAnimalCrossingMapIcons.Remove(Pair.Key);
                        break;
                    }
                }

                ReferencedImage.Dispose();
            }
        }
Beispiel #2
0
        public static void CheckReferencesAndDispose(Image referencedImage, PictureBoxWithInterpolationMode[] pictureBoxes, PictureBoxWithInterpolationMode selectedAcreBox)
        {
            if (referencedImage == null || selectedAcreBox.Image == referencedImage ||
                pictureBoxes.Any(box => box != null && box.BackgroundImage == referencedImage))
            {
                return;
            }

            foreach (var pair in _loadedImageDictionary)
            {
                if (pair.Value == referencedImage)
                {
                    _loadedImageDictionary.Remove(pair.Key);
                    break;
                }
            }

            foreach (var pair in _loadedAnimalCrossingMapIcons)
            {
                if (pair.Value == referencedImage)
                {
                    _loadedAnimalCrossingMapIcons.Remove(pair.Key);
                    break;
                }
            }

            referencedImage.Dispose();
        }