Exemplo n.º 1
0
        //RockSmithTrack har flere levels, vi lager alphatab track utifra et bestemt level
        public IList <RSSongInfo> GetAllSongInfos()
        {
            var src = _psarc.Entries.Where(x => x.Name.StartsWith(@"manifests/songs") && x.Name.EndsWith(".json"))
                      .OrderBy(x => x.Name);

            var        retValue        = new List <RSSongInfo>();
            RSSongInfo currentSongInfo = null;

            foreach (var entry in src)
            {
                var entryName           = System.IO.Path.GetFileNameWithoutExtension(entry.Name);
                var splitPoint          = entryName.LastIndexOf('_');
                var entrySongKey        = entryName.Substring(0, splitPoint);
                var entryArrangmentName = entryName.Substring(splitPoint + 1);

                if (currentSongInfo == null || entrySongKey != currentSongInfo.Key)
                {
                    currentSongInfo = new RSSongInfo()
                    {
                        Key = entrySongKey, TrackInfos = new List <RSTrackInfo>()
                    };
                    retValue.Add(currentSongInfo);
                }
                var arrangmentInfo = new RSTrackInfo()
                {
                    Name = entryArrangmentName, FileSize = entry.Length
                };
                currentSongInfo.TrackInfos.Add(arrangmentInfo);
            }

            return(retValue);
        }
Exemplo n.º 2
0
        //RockSmithTrack har flere levels, vi lager alphatab track utifra et bestemt level
        public IList<RSSongInfo> GetAllSongInfos()
        {
            var src = _psarc.Entries.Where(x => x.Name.StartsWith(@"manifests/songs") && x.Name.EndsWith(".json"))
                .OrderBy(x => x.Name);

            var retValue = new List<RSSongInfo>();
            RSSongInfo currentSongInfo = null;

            foreach (var entry in src)
            {
                var entryName = System.IO.Path.GetFileNameWithoutExtension(entry.Name);
                var splitPoint = entryName.LastIndexOf('_');
                var entrySongKey = entryName.Substring(0, splitPoint);
                var entryArrangmentName = entryName.Substring(splitPoint+1);

                if (currentSongInfo == null || entrySongKey != currentSongInfo.Key)
                {
                    currentSongInfo = new RSSongInfo() { Key = entrySongKey, TrackInfos = new List<RSTrackInfo>() };
                    retValue.Add(currentSongInfo);
                }
                var arrangmentInfo = new RSTrackInfo() { Name = entryArrangmentName, FileSize = entry.Length };
                currentSongInfo.TrackInfos.Add(arrangmentInfo);
            }

            return retValue;
        }
Exemplo n.º 3
0
 private RSTrackInfo findTrackContaining(IList <RSTrackInfo> songTracks, string[] preferences)
 {
     for (int i = 0; i < preferences.Length; i++)
     {
         RSTrackInfo found = songTracks.FirstOrDefault(t => t.Name.Contains(preferences[i]));
         if (found != null)
         {
             return(found);
         }
     }
     return(songTracks.FirstOrDefault());
 }
Exemplo n.º 4
0
        //RockSmithTrack har flere levels, vi lager alphatab track utifra et bestemt level
        public IList <RSSongInfo> GetAllSongInfos()
        {
            var src = _psarc.Entries.Where(x => x.Name.StartsWith(@"manifests/songs") && x.Name.EndsWith(".json"))
                      .OrderBy(x => x.Name);

            var        retValue        = new List <RSSongInfo>();
            RSSongInfo currentSongInfo = null;

            foreach (var entry in src)
            {
                var entryName           = System.IO.Path.GetFileNameWithoutExtension(entry.Name);
                var splitPoint          = entryName.LastIndexOf('_');
                var entrySongKey        = entryName.Substring(0, splitPoint);
                var entryArrangmentName = entryName.Substring(splitPoint + 1);

                if (currentSongInfo == null || entrySongKey != currentSongInfo.Key)
                {
                    string song_name, album_name, artist_name, song_year;
                    using (var wrappedStream = new NonClosingStreamWrapper(entry.Data))
                    {
                        using (var reader = new StreamReader(wrappedStream))
                        {
                            string  json       = reader.ReadToEnd();
                            JObject o          = JObject.Parse(json);
                            var     attributes = o["Entries"].First.Last["Attributes"];

                            song_name   = attributes["SongName"].ToString();
                            album_name  = attributes["AlbumName"].ToString();
                            artist_name = attributes["ArtistName"].ToString();
                            song_year   = attributes["SongYear"].ToString();
                        }
                    }

                    currentSongInfo = new RSSongInfo()
                    {
                        Key = entrySongKey, TrackInfos = new List <RSTrackInfo>(), SongName = song_name, AlbumName = album_name, ArtistName = artist_name, SongYear = song_year
                    };
                    retValue.Add(currentSongInfo);
                }
                var arrangmentInfo = new RSTrackInfo()
                {
                    Name = entryArrangmentName, FileSize = entry.Length
                };
                currentSongInfo.TrackInfos.Add(arrangmentInfo);
            }

            return(retValue);
        }
        //RockSmithTrack har flere levels, vi lager alphatab track utifra et bestemt level
        public IList<RSSongInfo> GetAllSongInfos()
        {
            var src = _psarc.Entries.Where(x => x.Name.StartsWith(@"manifests/songs") && x.Name.EndsWith(".json"))
                .OrderBy(x => x.Name);

            var retValue = new List<RSSongInfo>();
            RSSongInfo currentSongInfo = null;

            foreach (var entry in src)
            {
                var entryName = System.IO.Path.GetFileNameWithoutExtension(entry.Name);
                var splitPoint = entryName.LastIndexOf('_');
                var entrySongKey = entryName.Substring(0, splitPoint);
                var entryArrangmentName = entryName.Substring(splitPoint+1);

                if (currentSongInfo == null || entrySongKey != currentSongInfo.Key)
                {
                    string song_name, album_name, artist_name, song_year;
                    using (var wrappedStream = new NonClosingStreamWrapper(entry.Data))
                    {
                        using (var reader = new StreamReader(wrappedStream))
                        {
                            string json = reader.ReadToEnd();
                            JObject o = JObject.Parse(json);
                            var attributes = o["Entries"].First.Last["Attributes"];

                            song_name = attributes["SongName"].ToString();
                            album_name = attributes["AlbumName"].ToString();
                            artist_name = attributes["ArtistName"].ToString();
                            song_year = attributes["SongYear"].ToString();
                        }
                    }

                    currentSongInfo = new RSSongInfo() { Key = entrySongKey, TrackInfos = new List<RSTrackInfo>(), SongName = song_name, AlbumName = album_name, ArtistName = artist_name, SongYear = song_year };
                    retValue.Add(currentSongInfo);
                }
                var arrangmentInfo = new RSTrackInfo() { Name = entryArrangmentName, FileSize = entry.Length };
                currentSongInfo.TrackInfos.Add(arrangmentInfo);
            }

            return retValue;
        }