public void Add(IrfNote note)
        {
            if (note == null) throw new ArgumentNullException("note");
            if (note.PlayerName == null) throw new ArgumentNullException("note.PlayerName");

            notes.Add(note.PlayerName, note);
        }
Example #2
0
        public void Merge(IrfNote irfNote)
        {
            if(irfNote == null) throw new ArgumentNullException("irfNote");

            if (!PlayerName.Equals(this.PlayerName, irfNote.PlayerName))
                throw new ArgumentException("PlayerName must be identical to merge 2 IrfNote", "irfNote");

            NoteText = NoteText ?? irfNote.NoteText;
            if (NoteText != null && irfNote.NoteText != null)
            {
                if (!NoteText.Value.Contains(irfNote.NoteText.Value))
                    NoteText.Value += Environment.NewLine + irfNote.NoteText.Value;
            }

            DateTime = DateTime ?? irfNote.DateTime;
            Classification = Classification ?? irfNote.Classification;
        }
        public override Node ExitPlayerNoteNode(Production node)
        {
            var values = GetChildValues(node);

            if (values.Count != 0)
            {
                IrfNote note = new IrfNote();
                note.PlayerName = (PlayerName)values[0];

                for (int i = 1; i < values.Count; i++)
                {
                    object value = values[i];
                    if (value is NoteText)
                        note.NoteText = (NoteText)value;
                    else if (value is DateTime)
                        note.DateTime = (DateTime)value;
                    else if (value is Classification)
                        note.Classification = (Classification)value;
                }
                node.AddValue(note);
            }

            return node;
        }