Ejemplo n.º 1
0
            public static MusicProviders Load()
            {
                Assembly    assembly  = Assembly.GetExecutingAssembly();
                List <Type> hostTypes = new List <Type>();

                foreach (var type in assembly.GetExportedTypes())
                {
                    if (type.Name == "MusicProviders")
                    {
                        continue;
                    }

                    //确定type为类并且继承且实现IMyInstance
                    if (type.IsClass && typeof(IMusicProvider).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        hostTypes.Add(type);
                    }
                }

                MusicProviders musicProviders = new MusicProviders();

                foreach (var type in hostTypes)
                {
                    IMusicProvider instance = (IMusicProvider)Activator.CreateInstance(type);
                    musicProviders.AddMusicProvider(instance);
                }

                return(musicProviders);
            }
Ejemplo n.º 2
0
 public SongItemDownloader(MusicProviders musicProviders, string target, MergedSong1 song1)
 {
     this.musicProviders = musicProviders;
     this.target         = target;
     this.song1          = song1;
 }
Ejemplo n.º 3
0
 public SongDownloader(MusicProviders musicProviders, string target)
 {
     this.musicProviders = musicProviders;
     this.target         = target;
 }