using System;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace Sasa.QualityTools.DrFx.Tests.Violation.CSharp.Microsoft.Usage
{
    // このクラスは CA2229:CreateMagicConstructor に違反しています。
    [Serializable]
    public class Rule2229A : ISerializable
    {
        [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
        protected virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
        }

        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
        void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
        {
            GetObjectData(info, context);
        }
    }

    // このクラスは CA2229:MakeUnsealedMagicConstructorFamily に違反しています。
    [Serializable]
    public class Rule2229B : ISerializable
    {
        public Rule2229B(SerializationInfo info, StreamingContext context)
        {
        }

        [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
        protected virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
        }

        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
        void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
        {
            GetObjectData(info, context);
        }
    }

    // このクラスは CA2229:MakeSealedMagicConstructorPrivate に違反しています。
    [Serializable]
    public sealed class Rule2229C : ISerializable
    {
        public Rule2229C(SerializationInfo info, StreamingContext context)
        {
        }

        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
        }
    }
}
