Exemple #1
0
        /// <summary>
        /// Tries to create an instance of a chunk type that has specified ID.
        /// </summary>
        /// <param name="chunkId">ID of the chunk that need to be created.</param>
        /// <param name="chunksTypes">Collection of the chunks types to search for the one with
        /// <paramref name="chunkId"/> ID.</param>
        /// <returns>An instance of the chunk type with the specified ID or null if <paramref name="chunksTypes"/>
        /// doesn't contain chunk type with it.</returns>
        private static MidiChunk TryCreateChunk(string chunkId, ChunkTypesCollection chunksTypes)
        {
            Type type = null;

            return(chunksTypes?.TryGetType(chunkId, out type) == true && IsChunkType(type)
                ? (MidiChunk)Activator.CreateInstance(type)
                : null);
        }
Exemple #2
0
        // Token: 0x06003413 RID: 13331 RVA: 0x00148DE0 File Offset: 0x00146FE0
        private static MidiChunk TryCreateChunk(string chunkId, ChunkTypesCollection chunksTypes)
        {
            Type type = null;

            if (chunksTypes != null && chunksTypes.TryGetType(chunkId, out type) && MidiFile.IsChunkType(type))
            {
                return((MidiChunk)Activator.CreateInstance(type));
            }
            return(null);
        }