Ejemplo n.º 1
0
        public ModuleDataSnapshot CreateSnapshot()
        {
            var snapshot = new ModuleDataSnapshot();

            foreach (var(fieldContainer, fieldList) in fieldsByFieldContainer)
            {
                snapshot.Add(CreateDataSegment(fieldContainer, fieldList));
            }
            return(snapshot);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new snapshot with all the segments in this one, but relocated
        /// such that the data is <paramref name="from"/> is moved to <paramref name="to"/>
        /// (and all other data is offset by the same amount).
        /// </summary>
        internal ModuleDataSnapshot Relocated(ModuleAddress from, ModuleAddress to)
        {
            var offset   = to.LogicalValue - from.LogicalValue;
            var snapshot = new ModuleDataSnapshot();

            foreach (var segment in Segments)
            {
                snapshot.Add(segment.WithAddress(segment.Address.PlusLogicalOffset(offset)));
            }
            return(snapshot);
        }
Ejemplo n.º 3
0
        internal ModuleDataSnapshot CreatePartialSnapshot(TreeNode root)
        {
            if (root.Container.Schema != Schema)
            {
                throw new ArgumentException("Invalid root for snapshot: incorrect schema");
            }

            var fieldContainers = root.DescendantFieldContainers().ToList();
            var snapshot        = new ModuleDataSnapshot();

            foreach (var fc in fieldContainers)
            {
                snapshot.Add(CreateDataSegment(fc, fieldsByFieldContainer[fc]));
            }
            return(snapshot);
        }
Ejemplo n.º 4
0
        internal ModuleDataSnapshot CreatePartialSnapshot(TreeNode root)
        {
            if (root.Container.Schema != Schema)
            {
                throw new ArgumentException("Invalid root for snapshot: incorrect schema");
            }
            if (!(root.Container is ContainerBase containerBase))
            {
                throw new ArgumentException("Invalid root for snapshot: unknown container type");
            }
            var fieldContainers = containerBase.DescendantsAndSelf().OfType <FieldContainer>().ToList();
            var snapshot        = new ModuleDataSnapshot();

            foreach (var fc in fieldContainers)
            {
                snapshot.Add(CreateDataSegment(fc, fieldsByFieldContainer[fc]));
            }
            return(snapshot);
        }