public Script(SheetRow[] rows) { Act act = null; Scene scene = null; //loop rows foreach (SheetRow row in rows) { //skip first header row if (row.Scene.Contains("SCENE") && row.Moment.Contains("MOMENT")) { continue; } if (row.Scene.Contains("ACT ")) { //if not first if (null != act) { act.AddScene(scene); scene = null; AddAct(act); } act = new Act(); act.Number = row.Scene.Substring(row.Scene.LastIndexOf(' ') + 1); //go to next row continue; } //if new scene if (row.Scene.Contains("TIME")) { //if not first scene if (null != scene) { act.AddScene(scene); } scene = new Scene(); scene.Time = row.Duration; //go to next row continue; } //if last element if (row.Scene.Contains("SCRIPT TOTAL")) { TotalTime = row.Duration; //add last scene to last act act.AddScene(scene); //add last act to script AddAct(act); //all done no need to continue checking rows break; } //not above so it's a new moment Moment moment = new Moment(row.Moment, row.Line, row.Duration, row.Location, row.SFX); if (scene.Number != row.Scene) { scene.Number = row.Scene; } scene.AddMoment(moment); } }
public void AddMoment(Moment moment) { _moments.Add(moment); }