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();
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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)
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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();
                }
            }
        }
Esempio n. 9
0
        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));
        }
Esempio n. 10
0
        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();
        }
Esempio n. 11
0
 public override GtTickDataTable LoadTickDataTable(ref SongDescription pSongDescription)
 {
     return(new Double_GtTickDataTable_ChromaticScale()); //fake it!
 }
Esempio n. 12
0
 public override GtTickDataTable LoadTickDataTable(ref SongDescription pSongDescription)
 {
     return(new Double_GtTickDataTable_3200Notes()); //fake it!
 }
Esempio n. 13
0
 public override void DownloadSong(SongDescription pSelectedSong)
 {
 }
Esempio n. 14
0
 public virtual void DownloadMp3(SongDescription pSelectedSong)
 {
     //not implemented!!!!
 }