Editor/Embedded/Datamodel/ElementOwnershipException.cs

Custom InvalidOperationException subclass used by the Datamodel to indicate an Element is being manipulated by a Datamodel that does not own it. Provides two internal constructors with a default message and a serialization constructor.

#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.Datamodel.Codecs;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization;
using System.Security;
using System.Numerics;
using CodecRegistration = System.Tuple<string, int>;
using System.Reflection;

namespace HumanoidRetargeter.EditorTools.Embedded.Datamodel;

    /// <summary>
    /// The exception that is thrown when a Datamodel tries to manipulate an <see cref="Element"/> with an innapropriate owner.
    /// </summary>
    [Serializable]
    public class ElementOwnershipException : InvalidOperationException
    {
        internal ElementOwnershipException(string message)
            : base(message)
        {
        }

        internal ElementOwnershipException()
            : base("Cannot add an Element from a different Datamodel. Use ImportElement() first.")
        {
        }

        [SecuritySafeCritical]
        protected ElementOwnershipException(SerializationInfo info, StreamingContext context)
        {
        }
    }