Example #1
0
        private void PurgeUnused()
        {
#if KK || KKS
            var unusedCoords = _allOverlayTextures.Keys.Where(x => (int)x >= _chaControl.chaFile.coordinate.Length).ToList();
            if (unusedCoords.Count > 0)
            {
                KoiSkinOverlayMgr.Logger.LogWarning($"Removing data for missing coordinates: {string.Join(", ", unusedCoords.Select(x => x.ToString()).ToArray())}");
                foreach (var unusedCoord in unusedCoords)
                {
                    _allOverlayTextures.Remove(unusedCoord);
                }
            }
#endif

            _textureStorage.PurgeUnused(_allOverlayTextures.SelectMany(x => x.Value.Values));

            var allTextures = _textureStorage.GetAllTextureIDs();
            foreach (var dic in _allOverlayTextures)
            {
                foreach (var invalidEntry in dic.Value.Where(x => !allTextures.Contains(x.Value)).ToList())
                {
                    KoiSkinOverlayMgr.Logger.LogWarning($"Invalid texture ID found, entry will be removed: coord={dic.Key} type={invalidEntry.Key} texID={invalidEntry.Value}");
                    dic.Value.Remove(invalidEntry.Key);
                }
            }
        }
Example #2
0
        private void PurgeUnused()
        {
            _textureStorage.PurgeUnused(_allOverlayTextures.SelectMany(x => x.Value.Values));

            var allTextures = _textureStorage.GetAllTextureIDs();

            foreach (var dic in _allOverlayTextures)
            {
                foreach (var invalidEntry in dic.Value.Where(x => !allTextures.Contains(x.Value)).ToList())
                {
                    KoiSkinOverlayMgr.Logger.LogWarning($"Invalid texture ID found, entry will be removed: coord={dic.Key} type={invalidEntry.Key} texID={invalidEntry.Value}");
                    dic.Value.Remove(invalidEntry.Key);
                }
            }
        }