Beispiel #1
0
        public static void ChanProc(ParseContext2 ctx)
        {
            ChangeRec chan = ctx.Parent.CHAN;

            if (chan.Date != null)
            {
                UnkRec err = new UnkRec();
                err.Error = UnkRec.ErrorCode.MultChan;
                GedRecParse.LookAhead(ctx);
                err.Beg = ctx.Begline + ctx.Parent.BegLine;
                err.End = ctx.Endline + ctx.Parent.BegLine;
                ctx.Parent.Errors.Add(err);
                return;
            }

            ChanParse(ctx, chan);
            if (chan.Date == null)
            {
                UnkRec err = new UnkRec();
                err.Error = UnkRec.ErrorCode.ChanDate;
                err.Beg   = ctx.Begline + ctx.Parent.BegLine;
                err.End   = ctx.Endline + ctx.Parent.BegLine;
                ctx.Parent.Errors.Add(err);
            }
        }
Beispiel #2
0
        public static void ChanParse(ParseContext2 ctx, ChangeRec chan)
        {
            //StructParseContext ctx2 = new StructParseContext(ctx, chan);
            StructParseContext ctx2 = PContextFactory.Alloc(ctx, chan);

            StructParse(ctx2, tagDict);
            ctx.Endline = ctx2.Endline;
            PContextFactory.Free(ctx2);
        }
Beispiel #3
0
        private GEDCommon ChanExtraM(string teststring, string tag)
        {
            var rec = ReadOne(string.Format(teststring, tag));

            Assert.AreNotEqual(0, rec.Errors.Count, tag); // TODO validate error detail
            Assert.AreEqual(0, rec.Unknowns.Count, tag);
            ChangeRec chan = rec.CHAN;

            Assert.AreEqual(1, chan.OtherLines.Count, tag);
            Assert.AreEqual("fumbar", rec.RIN, tag);
            return(rec);
        }
Beispiel #4
0
        public void TestChan6() // TODO test all supported records?
        {
            // multi line extra
            var txt = "0 @N1@ SOUR\n1 CHAN\n2 CUSTOM foo\n3 _BLAH bar\n1 RIN fumbar";
            var rec = ReadOne(txt);

            Assert.AreEqual(1, rec.Errors.Count);
            Assert.AreEqual(0, rec.Unknowns.Count);
            ChangeRec chan = rec.CHAN;

            Assert.AreEqual("fumbar", rec.RIN);
            Assert.AreEqual(1, chan.OtherLines.Count);
            Assert.AreEqual(2, chan.OtherLines[0].LineCount);
        }
        /// <summary>
        /// Finishes changing of connector's state.
        /// </summary>
        /// <param name="changeRec">The object that allows to record changes.</param>
        private void EndChange(ChangeRec changeRec)
        {
            try
            {
                this._activeIndex = this._connected.IndexOf(changeRec.NewActive);

                // When objects are added and moved,
                // raise ConnectedChanged before ActiveChanged.
                foreach (var change in changeRec.ConnectedChanges)
                {
                    if (change.Action == ConnectedChangedAction.Connect ||
                        change.Action == ConnectedChangedAction.Move)
                    {
                        this.OnConnectedChanged(change);
                    }
                }

                if (changeRec.OldActive != changeRec.NewActive)
                {
                    this.OnActiveChanged(new ActiveChangedEventArgs(changeRec.OldActive, changeRec.NewActive));
                }

                // When objects are disconnected,
                // raise ConnectedChanged after ActiveChanged.
                foreach (var change in changeRec.ConnectedChanges)
                {
                    if (change.Action == ConnectedChangedAction.Disconnect)
                    {
                        this.OnConnectedChanged(change);
                    }
                }

                // Synchronize the selected element in the list of views.
                this._viewsCollectionView.MoveCurrentToPosition(this._activeIndex);
            }
            finally
            {
                this._isChanging = false;
            }
        }