Files
PURErat-crack-scode/decompiled/PanelPlugins/PureHelper.Client/ProtoBuf/ProtoIncludeAttribute.cs
T
2026-08-27 10:56:38 -06:00

38 lines
981 B
C#

using System;
using System.ComponentModel;
using ProtoBuf.Meta;
namespace ProtoBuf;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
public sealed class ProtoIncludeAttribute : Attribute
{
public int Tag { get; }
public string KnownTypeName { get; }
public Type KnownType => TypeModel.ResolveKnownType(KnownTypeName, null, null);
[DefaultValue(DataFormat.Default)]
public DataFormat DataFormat { get; set; }
public ProtoIncludeAttribute(int tag, Type knownType)
: this(tag, ((object)knownType == null) ? "" : knownType.AssemblyQualifiedName)
{
}
public ProtoIncludeAttribute(int tag, string knownTypeName)
{
if (tag <= 0)
{
throw new ArgumentOutOfRangeException("tag", "Tags must be positive integers");
}
if (string.IsNullOrEmpty(knownTypeName))
{
throw new ArgumentNullException("knownTypeName", "Known type cannot be blank");
}
Tag = tag;
KnownTypeName = knownTypeName;
}
}