public void PopulateBlows(Block block, int testPlace, string audioIdSuffix) { int count = 1; foreach (Row row in block.Rows) { for (int i = 1; i <= NumBells; i++) { Blow blow = new Blow { Bell = row.RowArr[i], ChangeStr = row.ChangeStr }; // If this is the test place and the last row, set IsTestBell to true and IsLastBlow to true; if (row.RowNum == block.NumRows && i == testPlace) { blow.IsTestBell = true; } else { blow.IsTestBell = false; } blow.BellActual = BellAct.DeriveBellActual(Stage, TenorWeight, blow.Bell); blow.RowNum = row.RowNum; blow.Place = i; if (blow.RowNum % 2 == 1) { blow.IsHandstroke = true; } else { blow.IsHandstroke = false; } blow.BellSound = "/audio/tws" + blow.BellActual + ".mp3"; blow.AudioId = "audio" + count.ToString(); // If an audioIdSuffix parameter was provided, add it to the end of AudioId if (audioIdSuffix != string.Empty) { blow.AudioId += audioIdSuffix; } count++; Blows.Add(blow); // Exit if test blow reached if (blow.IsTestBell == true) { break; } } } }
public void LoadBlows(BlowSetCore blowSetCore, string audioIdSuffix) { int rowNum = 1; int place = 1; int currRowNum = 0; int gapCumulativeRow = 0; int gapCumulative = 0; int count = 1; foreach (BlowCore blowCore in blowSetCore.BlowsCore) { Blow blow = new Blow { Bell = blowCore.Bell, ChangeStr = blowCore.ChangeStr, Gap = blowCore.Gap, AltGap = blowCore.AltGap, IsTestBell = blowCore.IsTestBell, IsHighlighted = blowCore.IsHighlighted }; blow.BellActual = BellAct.DeriveBellActual(Stage, TenorWeight, blow.Bell); blow.RowNum = rowNum; blow.Place = place; place += 1; if (place > NumBells) { rowNum += 1; place = 1; } if (blow.RowNum % 2 == 1) { blow.IsHandstroke = true; } else { blow.IsHandstroke = false; } blow.BellSound = "/audio/tws" + blow.BellActual + ".mp3"; blow.AudioId = "audio" + count.ToString(); // If an audioIdSuffix parameter was provided, add it to the end of AudioId if (audioIdSuffix != string.Empty) { blow.AudioId += audioIdSuffix; } count++; // Update GapCumulativeRow if (blow.RowNum == currRowNum) { gapCumulativeRow += blow.Gap; } else { gapCumulativeRow = blow.Gap; currRowNum = blow.RowNum; } blow.GapCumulativeRow = gapCumulativeRow; // Update GapCumulative gapCumulative += blow.Gap; blow.GapCumulative = gapCumulative; // Update GapStr blow.GapStr = blow.Gap.ToString(); // Add blow to Blows list Blows.Add(blow); } }