示例#1
0
        private IEnumerable <ISound> LoadInternal(IDictionary <int, string> map, IFileAccessor accessor)
        {
            foreach (var kv in map)
            {
                var decoder = GetDecoder(Path.GetFileNameWithoutExtension(kv.Value), accessor);
                if (decoder.Decoder == null)
                {
                    continue;
                }

                using (var stream = accessor.OpenRead(decoder.Filename))
                {
                    ISound decoded;

                    try
                    {
                        decoded = decoder.Decoder(stream);
                        decoded[NumericData.Id] = kv.Key;
                    }
                    catch
                    {
                        decoded = null;
                    }

                    if (decoded != null)
                    {
                        yield return(decoded);
                    }
                }
            }
        }