Beispiel #1
0
        public static bool ShouldLoad(string id, ChunkLoadBehaviour behav)
        {
            if (IsCritical(id))
            {
                return(true);
            }
            bool flag = PngChunk.isKnown(id);

            switch (behav)
            {
            case ChunkLoadBehaviour.LOAD_CHUNK_ALWAYS:
                return(true);

            case ChunkLoadBehaviour.LOAD_CHUNK_IF_SAFE:
                if (!flag)
                {
                    return(IsSafeToCopy(id));
                }
                return(true);

            case ChunkLoadBehaviour.LOAD_CHUNK_KNOWN:
                return(flag);

            case ChunkLoadBehaviour.LOAD_CHUNK_NEVER:
                return(false);

            default:
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>Decides if a chunk should be loaded, according to a ChunkLoadBehaviour</summary>
        /// <param name="id"></param>
        /// <param name="behav"></param>
        /// <returns></returns>
        public static bool ShouldLoad(String id, ChunkLoadBehaviour behav)
        {
            if (IsCritical(id))
            {
                return(true);
            }

            bool kwown = PngChunk.isKnown(id);

            switch (behav)
            {
            case ChunkLoadBehaviour.LOAD_CHUNK_ALWAYS:
                return(true);

            case ChunkLoadBehaviour.LOAD_CHUNK_IF_SAFE:
                return(kwown || IsSafeToCopy(id));

            case ChunkLoadBehaviour.LOAD_CHUNK_KNOWN:
                return(kwown);

            case ChunkLoadBehaviour.LOAD_CHUNK_NEVER:
                return(false);
            }

            return(false); // should not reach here
        }