using JetBrains.Annotations;
namespace Siggingway;
///
/// The main way to use Siggingway. Apply this attribute to any field/property
/// that should make use of a signature. See the field documentation for more
/// information.
///
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
[MeansImplicitUse(ImplicitUseKindFlags.Assign, ImplicitUseTargetFlags.Itself)]
// ReSharper disable once ClassNeverInstantiated.Global
public sealed class SignatureAttribute : Attribute {
///
/// The memory signature for this field/property.
///
public readonly string Signature;
///
/// The way this signature should be used. By default, this is guessed using
/// simple heuristics, but it can be manually specified if Siggingway can't
/// figure it out.
///
///
///
public SignatureUseFlags UseFlags = SignatureUseFlags.Auto;
///
/// The type of scan to perform. By default, this scans the text section of
/// the executable, but this should be set to StaticAddress for static
/// addresses.
///
public ScanType ScanType = ScanType.Text;
///
/// The detour name if this signature is for a hook. Siggingway will search
/// the type containing this field/property for a method that matches the
/// hook's delegate type, but if it doesn't find one or finds more than one,
/// it will fail. You can specify the name of the method here to avoid this.
///
public string? DetourName;
///
/// When is set to Offset, this is the offset from
/// the signature to read memory from.
///
public int Offset;
///
/// When a signature is fallible, any errors while resolving it will be
/// logged in the Dalamud log and the field/property will not have its value
/// set. When a signature is not fallible, any errors will be thrown as
/// exceptions instead. If fallibility is not specified, it is inferred
/// based on if the field/property is nullable.
///
public Fallibility Fallibility = Fallibility.Auto;
///
/// Create a with the given signature.
///
/// signature to scan for, see
public SignatureAttribute(string signature) {
this.Signature = signature;
}
}