public void UpdateReference(Reference reference, List <ReferenceEntry> referenceItems, Stats stats) { var textTransformer = new TextTransformer(); foreach (var inputReferenceItem in referenceItems) { var referenceEntryContents = textTransformer.TransformText(inputReferenceItem.RawContents, stats); var referenceEntryTitle = textTransformer.TransformText(inputReferenceItem.RawTitle, stats); var entryToAddOrUpdate = reference.RawEntries.SingleOrDefault(ri => ri.Id == inputReferenceItem.Id); if (entryToAddOrUpdate == null) { entryToAddOrUpdate = inputReferenceItem; entryToAddOrUpdate.Order = reference.RawEntries.Select(re => re.Order).DefaultIfEmpty().Max() + 1; reference.RawEntries.Add(entryToAddOrUpdate); inputReferenceItem.WasCreated = true; } else { if (referenceEntryContents != entryToAddOrUpdate.Contents || referenceEntryTitle != entryToAddOrUpdate.Title) { inputReferenceItem.WasUpdated = true; } } entryToAddOrUpdate.Contents = referenceEntryContents; entryToAddOrUpdate.Title = referenceEntryTitle; inputReferenceItem.Title = referenceEntryTitle; inputReferenceItem.Contents = referenceEntryContents; } }
public StoryEventPreparer() { ChoicePreparer = new ChoicePreparer(); textTransformer = new TextTransformer(); }
public ChoicePreparer() { textTransformer = new TextTransformer(); }