コード例 #1
0
ファイル: ChanStructParse.cs プロジェクト: zhifu10001/YAGP
        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);
            }
        }
コード例 #2
0
ファイル: ChanStructParse.cs プロジェクト: zhifu10001/YAGP
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
        /// <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;
            }
        }