public static void Add() { using (var context = new MusColectionContext()) { SongList songList = new SongList(); SongDescription songDescription = new SongDescription(); Console.Write("Ввдите исполнителя песни: "); songList.Singer = Console.ReadLine(); Console.Write("Введите композицию: "); songList.Song = Console.ReadLine(); Console.WriteLine("Описание"); Console.Write("\tдлительность трека: "); songDescription.SongLehgth = Console.ReadLine(); Console.Write("\tвведите рейтинг трека: "); int rating = 0; int.TryParse(Console.ReadLine(), out rating); if (rating == 0) { Console.WriteLine("Вы не отметили рейтинг песни?"); } Console.WriteLine("Слова песни по умолчанию. Cлова наиболее любимых треков можно будет занести позже"); songDescription.SongText = ""; context.SongLists.Add(songList); context.SongDescriptions.Add(songDescription); context.SaveChanges(); } }
public static void Update(string oldSinger, string newSinger, string newSong, string songLength, int rating, string songText) { using (var context = new MusColectionContext()) { SongList songList = context.SongLists.FirstOrDefault(treck => treck.Singer == oldSinger); if (songList != null) { songList.Singer = newSinger; songList.Song = newSong; context.Entry(songList).State = EntityState.Modified; context.SaveChanges(); } SongDescription songDescription = context.SongDescriptions.FirstOrDefault(description => description.SongList.Singer == oldSinger); if (songDescription != null) { songDescription.SongLehgth = songLength; songDescription.Rating = rating; songDescription.SongText = songText; context.SaveChanges(); } Console.Clear(); ShowCollection(); } }
public virtual void DownloadContent(SongDescription pSelectedSong) { var gameService = this.Factory.Instantiate <IGameSongRepository>(); var hardTablature = gameService.GetSongVersionTablature("teste", "gu1t@rm0n1c5", pSelectedSong.OidHardTablature); File.WriteAllText(pSelectedSong.ConfigFileName, hardTablature); }
public virtual void DownloadSong(SongDescription pSelectedSong) { if (!File.Exists(pSelectedSong.ConfigFileName)) { this.DownloadContent(pSelectedSong); } if (!File.Exists(pSelectedSong.SyncFileName)) { this.DownloadSynchronization(pSelectedSong); } //Download audio file (if available) }
public virtual GtTickDataTable LoadTickDataTable(ref SongDescription pSongDescription) { //IList<GuitarScoreNote> scoreNotes = ReadXmlScores(pSongDescription); var xmlScoreReader = new XmlScoreReader(pSongDescription.ConfigFileName, pSongDescription.SyncFileName); pSongDescription.Pitch = xmlScoreReader.Pitch; var tickDataTable = ConvertScoreNotesInTickTable(xmlScoreReader.ScoreNotes); tickDataTable.UpdateSync(xmlScoreReader.SyncElements); tickDataTable.AutoCompleteMomentInMiliseconds(); return(tickDataTable); }
public void DownloadSongAllFilesExist() { var fileLoader = new GtFileLoader(); var songDescription = new SongDescription() { Song = "Song Name", Artist = "Artist Name", ConfigFileName = TestConfig.AudioPath + "metallica-for_whom_the_bell_tolls(linked).song.xml", SyncFileName = TestConfig.AudioPath + "metallica-for_whom_the_bell_tolls(linked).song.xml", AudioFileName = TestConfig.AudioPath + "?.mp3", TimeSignature = Guitarmonics.AudioLib.Player.GtTimeSignature.Time4x4, }; fileLoader.DownloadSong(songDescription); }
public void ReadNotesFromXmlFile() { var fileLoader = new GtFileLoader(); var songDescription = new SongDescription() { Song = "Song Name", Artist = "Artist Name", ConfigFileName = TestConfig.AudioPath + "metallica-for_whom_the_bell_tolls(linked).song.xml", SyncFileName = TestConfig.AudioPath + "metallica-for_whom_the_bell_tolls(linked).song.xml", AudioFileName = TestConfig.AudioPath + "?.mp3", TimeSignature = Guitarmonics.AudioLib.Player.GtTimeSignature.Time4x4, }; //IList<GuitarScoreNote> scores = fileLoader.ReadXmlScores(songDescription); var tickDataTable = fileLoader.LoadTickDataTable(ref songDescription); Assert.IsNotNull(tickDataTable); }
public static void Delete(string singer) { using (var context = new MusColectionContext()) { SongList songList = context.SongLists.Include("Description").FirstOrDefault(); if (songList != null) { context.SongDescriptions.Remove(songList.Description); context.SongLists.Remove(songList); context.SaveChanges(); } SongDescription songDescription = context.SongDescriptions.FirstOrDefault(description => description.SongList.Singer == singer); if (songDescription != null) { context.SongDescriptions.Remove(songDescription); context.SaveChanges(); } } }
public void TestDownloadMp3() { var songDescription = new SongDescription() { Song = "Seek & Destroy", Artist = "Metallica", OidHardTablature = Guid.Empty, ConfigFileName = TestConfig.DataFolderPath + "Metallica.KillEmAll.Seek&Destroy\\hard.xml", SyncFileName = TestConfig.DataFolderPath + "Metallica.KillEmAll.Seek&Destroy\\Sync.xml", AudioFileName = TestConfig.DataFolderPath + "Metallica.KillEmAll.Seek&Destroy\\Metallica.KillEmAll.Seek&Destroy.mp3", TimeSignature = Guitarmonics.AudioLib.Player.GtTimeSignature.Time4x4, }; File.Delete(songDescription.AudioFileName); var fileLoader = new GtFileLoader(); fileLoader.DownloadMp3(songDescription); Assert.IsTrue(File.Exists(songDescription.AudioFileName)); }
public void DownloadSongSyncFileDontExist() { var mockRepository = new MockRepository(); var fileLoader = mockRepository.PartialMock <GtFileLoader>(); var songDescription = new SongDescription() { Song = "Song Name", Artist = "Artist Name", ConfigFileName = TestConfig.AudioPath + "metallica-for_whom_the_bell_tolls(linked).song.xml", SyncFileName = TestConfig.AudioPath + "INVALID", AudioFileName = TestConfig.AudioPath + "?.mp3", TimeSignature = Guitarmonics.AudioLib.Player.GtTimeSignature.Time4x4, }; fileLoader.Expect(x => x.DownloadSynchronization(songDescription)); mockRepository.ReplayAll(); fileLoader.DownloadSong(songDescription); mockRepository.VerifyAll(); }
public override GtTickDataTable LoadTickDataTable(ref SongDescription pSongDescription) { return(new Double_GtTickDataTable_ChromaticScale()); //fake it! }
public override GtTickDataTable LoadTickDataTable(ref SongDescription pSongDescription) { return(new Double_GtTickDataTable_3200Notes()); //fake it! }
public override void DownloadSong(SongDescription pSelectedSong) { }
public virtual void DownloadMp3(SongDescription pSelectedSong) { //not implemented!!!! }