Beispiel #1
0
        public static List <ScoreNodes> FromStream(Stream s)
        {
            var list      = new List <ScoreNodes>();
            var numTracks = s.ReadInt32LE();

            byte[] temp = new byte[32];
            for (var i = 0; i < numTracks; i++)
            {
                s.Read(temp, 0, 32);
                var title = Encoding.UTF8.GetString(temp, 0, 32);
                title = title.Remove(title.IndexOf('\0'));
                s.Read(temp, 0, 32);
                var type = Encoding.UTF8.GetString(temp, 0, 32);
                type = type.Remove(type.IndexOf('\0'));
                var nodes = BeatInfo.FromStream(s);
                list.Add(new ScoreNodes(title, type, nodes));
            }
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// Loads score nodes for each instrument track.
        /// </summary>
        /// <param name="media">Must already have InstrumentTracks set.</param>
        /// <param name="songPath"></param>
        private void LoadScoreNodes(JcfMedia media, string songPath)
        {
            using (var stream = File.OpenRead(Path.Combine(songPath, "nowline.nodes")))
            {
                var numTracks = stream.ReadInt32LE();
                var temp      = new byte[32];
                for (var i = 0; i < numTracks; i++)
                {
                    stream.Read(temp, 0, 32);
                    var title = Encoding.UTF8.GetString(temp, 0, 32);
                    title = title.Remove(title.IndexOf('\0'));

                    stream.Read(temp, 0, 32);
                    var type = Encoding.UTF8.GetString(temp, 0, 32);
                    type = type.Remove(type.IndexOf('\0'));

                    var nodes = BeatInfo.FromStream(stream);
                    var index = media.InstrumentTracks.FirstOrDefault(track => track.Title == title);
                    media.ScoreNodes[index] = new ScoreNodes(title, type, nodes);
                }
            }
        }