示例#1
0
        public static MusicDatabase Load(string fileName)
        {
            MusicDatabase dataBase = null;

            try
            {
                var xs     = new XmlSerializer(typeof(MusicDatabase), new Type[] { typeof(Music), typeof(Album) });
                var stream = new FileStream(fileName, FileMode.Open);
                dataBase = (MusicDatabase)xs.Deserialize(stream);
                stream.Close();
            }
            catch (Exception)
            {
                return(new MusicDatabase());
            }
            return(dataBase);
        }
示例#2
0
 public SearchEngine(MusicDatabase database, ReceiveResponse callback)
 {
     _localIndexer = new LocalIndexer(database);
     Callback = callback;
     Database = database;
 }
示例#3
0
 public Peer(string name, MusicDatabase database, ReceiveResponse responseCallback)
 {
     Name = name;
     PeerContainer = new PeerContainer();
     SearchEngine = new SearchEngine(database, responseCallback);
 }