static void ProcessTrackComponentLine(string line, Chart chart, Song.Instrument instrument, List <NoteFlag> flagsList) { int stringViewIndex = 0; uint position = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); // Skip over the equals sign char type = line[stringViewIndex]; HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); switch (type) { case 'N': { int noteNumber = (int)HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); uint length = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); switch (instrument) { case Song.Instrument.GHLiveGuitar: case Song.Instrument.GHLiveBass: LoadGHLiveNote(chart, position, noteNumber, length, flagsList); break; case Song.Instrument.Drums: LoadDrumNote(chart, position, noteNumber, length); break; case Song.Instrument.Guitar: case Song.Instrument.GuitarCoop: case Song.Instrument.Rhythm: case Song.Instrument.Bass: case Song.Instrument.Keys: LoadStandardNote(chart, position, noteNumber, length, flagsList); break; default: // Unrecognised Note newNote = new Note(position, noteNumber, length); chart.Add(newNote, false); break; } } break; case 'S': { int specialNumber = (int)HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); uint length = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); if (specialNumber == 2) { chart.Add(new Starpower(position, length), false); } } break; case 'E': { string eventName = HackyStringViewFunctions.GetNextTextUpToQuote(line, ref stringViewIndex); chart.Add(new ChartEvent(position, eventName), false); } break; default: break; } }
static void ProcessSongComponentLine(string line, Song song, List <Anchor> anchorData) { int stringViewIndex = 0; uint position = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); // Skip over the equals sign char type = line[stringViewIndex]; HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); switch (type) { case 'B': { uint value = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); song.Add(new BPM(position, value), false); } break; case 'T': { uint numerator = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); TimeSignature ts = new TimeSignature(position, numerator); song.Add(ts, false); if (stringViewIndex < line.Length) { uint denominator = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); denominator = (uint)(Mathf.Pow(2, denominator)); ts.denominator = denominator; } } break; case 'E': { string text = HackyStringViewFunctions.GetNextTextUpToQuote(line, ref stringViewIndex); const string SECTION_ID = "section"; // Check if it's a section if (string.Compare(text, 0, SECTION_ID, 0, SECTION_ID.Length) == 0) { text = text.Remove(0, SECTION_ID.Length); text = text.Trim(); song.Add(new Section(text, position), false); } else { song.Add(new Event(text, position), false); } } break; case 'A': { uint anchorValue = HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); Anchor a; a.position = position; a.anchorTime = (float)(anchorValue / 1000000.0d); anchorData.Add(a); } break; default: return; } }