예제 #1
0
        public override void UpdateNewRunFromPointerFormat(IDataModel model, ModelDelta token, string name, IReadOnlyList <ArrayRunElementSegment> sourceSegments, int parentIndex, ref IFormattedRun run)
        {
            var length = PCSString.ReadString(model, run.Start, true);

            if (length > 0)
            {
                var newRun = new PCSRun(model, run.Start, length, run.PointerSources);
                if (!newRun.Equals(run))
                {
                    model.ClearFormat(token, newRun.Start, newRun.Length);
                }
                run = newRun;
            }
        }
예제 #2
0
        public override ErrorInfo TryParseData(IDataModel model, string name, int dataIndex, ref IFormattedRun run)
        {
            var length = PCSString.ReadString(model, dataIndex, true);

            if (length < 0)
            {
                return(new ErrorInfo($"Format was specified as a string, but no string was recognized."));
            }
            else if (PokemonModel.SpanContainsAnchor(model, dataIndex, length))
            {
                return(new ErrorInfo($"Format was specified as a string, but a string would overlap the next anchor."));
            }
            run = new PCSRun(model, dataIndex, length);

            return(ErrorInfo.NoError);
        }