Пример #1
0
        public SngFile(string file)
        {
            _filePath = file;

            using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                BinaryReader br = new BinaryReader(stream);
                Version    = br.ReadInt32();
                _beatCount = br.ReadInt32();
                Beats      = new Ebeat[_beatCount];
                for (int i = 0; i < _beatCount; ++i)
                {
                    Beats[i] = new Ebeat(br);
                }

                _PhraseCount = br.ReadInt32();
                Phrases      = new Phrase[_PhraseCount];
                for (int i = 0; i < _PhraseCount; ++i)
                {
                    Phrases[i] = new Phrase(br);
                }

                _chordTemplateCount = br.ReadInt32();
                ChordTemplates      = new ChordTemplate[_chordTemplateCount];
                for (int i = 0; i < _chordTemplateCount; ++i)
                {
                    ChordTemplates[i] = new ChordTemplate(br);
                }
                _fretHandMuteTemplateCount = br.ReadInt32(); // always 0?
                _vocalsCount = br.ReadInt32();
                _vocals      = new Vocal[_vocalsCount];
                for (int i = 0; i < _vocalsCount; ++i)
                {
                    _vocals[i] = new Vocal(br);
                }

                _phraseIterationCount = br.ReadInt32();
                PhraseIterations      = new PhraseIteration[_phraseIterationCount];
                for (int i = 0; i < _phraseIterationCount; ++i)
                {
                    PhraseIterations[i] = new PhraseIteration(br);
                }

                PhrasePropertyCount = br.ReadInt32();
                PhraseProperties    = new PhraseProperty[PhrasePropertyCount];
                for (int i = 0; i < PhrasePropertyCount; ++i)
                {
                    PhraseProperties[i] = new PhraseProperty(br);
                }

                LinkedDiffCount = br.ReadInt32();
                LinkedDiffs     = new LinkedDiff[LinkedDiffCount];
                for (int i = 0; i < LinkedDiffCount; ++i)
                {
                    LinkedDiffs[i] = new LinkedDiff(br);
                }

                ControlCount = br.ReadInt32();
                Controls     = new Control[ControlCount];
                for (int i = 0; i < ControlCount; ++i)
                {
                    Controls[i] = new Control(br);
                }

                _songEventCount = br.ReadInt32();
                SongEvents      = new SongEvent[_songEventCount];
                for (int i = 0; i < _songEventCount; ++i)
                {
                    SongEvents[i] = new SongEvent(br);
                }
                SongSectionCount = br.ReadInt32();
                SongSections     = new SongSection[SongSectionCount];
                for (int i = 0; i < SongSectionCount; ++i)
                {
                    SongSections[i] = new SongSection(br);
                }

                _songLevelCount = br.ReadInt32();
                SongLevels      = new SongLevel[_songLevelCount];
                for (int i = 0; i < _songLevelCount; ++i)
                {
                    SongLevels[i] = new SongLevel(br, Version);
                }

                Metadata = new Metadata(br);

                // Not sure what this junk is down here yet

                int endLength = (int)(br.BaseStream.Length - br.BaseStream.Position);
                _unknown2 = br.ReadBytes(endLength);
            }
        }
        public SngFile(string file)
        {
            _filePath = file;

            using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                BinaryReader br = new BinaryReader(stream);
                Version = br.ReadInt32();
                _beatCount = br.ReadInt32();
                Beats = new Ebeat[_beatCount];
                for (int i = 0; i < _beatCount; ++i)
                {
                    Beats[i] = new Ebeat(br);
                }

                _PhraseCount = br.ReadInt32();
                Phrases = new Phrase[_PhraseCount];
                for (int i = 0; i < _PhraseCount; ++i)
                {
                    Phrases[i] = new Phrase(br);
                }

                _chordTemplateCount = br.ReadInt32();
                ChordTemplates = new ChordTemplate[_chordTemplateCount];
                for (int i = 0; i < _chordTemplateCount; ++i)
                {
                    ChordTemplates[i] = new ChordTemplate(br);
                }
                _fretHandMuteTemplateCount = br.ReadInt32(); // always 0?
                _vocalsCount = br.ReadInt32();
                _vocals = new Vocal[_vocalsCount];
                for (int i = 0; i < _vocalsCount; ++i)
                {
                    _vocals[i] = new Vocal(br);
                }

                _phraseIterationCount = br.ReadInt32();
                PhraseIterations = new PhraseIteration[_phraseIterationCount];
                for (int i = 0; i < _phraseIterationCount; ++i)
                {
                    PhraseIterations[i] = new PhraseIteration(br);
                }

                PhrasePropertyCount = br.ReadInt32();
                PhraseProperties = new PhraseProperty[PhrasePropertyCount];
                for (int i = 0; i < PhrasePropertyCount; ++i)
                {
                    PhraseProperties[i] = new PhraseProperty(br);
                }

                LinkedDiffCount = br.ReadInt32();
                LinkedDiffs = new LinkedDiff[LinkedDiffCount];
                for (int i = 0; i < LinkedDiffCount; ++i)
                {
                    LinkedDiffs[i] = new LinkedDiff(br);
                }

                ControlCount = br.ReadInt32();
                Controls = new Control[ControlCount];
                for (int i = 0; i < ControlCount; ++i)
                {
                    Controls[i] = new Control(br);
                }

                _songEventCount = br.ReadInt32();
                SongEvents = new SongEvent[_songEventCount];
                for (int i = 0; i < _songEventCount; ++i)
                {
                    SongEvents[i] = new SongEvent(br);
                }
                SongSectionCount = br.ReadInt32();
                SongSections = new SongSection[SongSectionCount];
                for (int i = 0; i < SongSectionCount; ++i)
                {
                    SongSections[i] = new SongSection(br);
                }

                _songLevelCount = br.ReadInt32();
                SongLevels = new SongLevel[_songLevelCount];
                for (int i = 0; i < _songLevelCount; ++i)
                {
                    SongLevels[i] = new SongLevel(br, Version);
                }

                Metadata = new Metadata(br);

                // Not sure what this junk is down here yet

                int endLength = (int)(br.BaseStream.Length - br.BaseStream.Position);
                _unknown2 = br.ReadBytes(endLength);

            }
        }