// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace SharpDX.DirectInput
{
///
/// Attribute to describe a custom format for a field.
///
[AttributeUsage(AttributeTargets.Field)]
public sealed class DataObjectFormatAttribute : Attribute
{
public DataObjectFormatAttribute()
{
Flags = ObjectDataFormatFlags.None;
InstanceNumber = 0;
Guid = "";
TypeFlags = DeviceObjectTypeFlags.All;
}
public DataObjectFormatAttribute(string guid, DeviceObjectTypeFlags typeFlags)
{
Guid = guid;
TypeFlags = typeFlags;
Flags = ObjectDataFormatFlags.None;
InstanceNumber = 0;
ArrayCount = 0;
}
public DataObjectFormatAttribute(string guid, DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags)
{
Guid = guid;
TypeFlags = typeFlags;
Flags = flags;
}
public DataObjectFormatAttribute(string guid, DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags, int instanceNumber)
{
Guid = guid;
TypeFlags = typeFlags;
Flags = flags;
InstanceNumber = instanceNumber;
}
public DataObjectFormatAttribute(string guid, int arrayCount, DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags)
{
Guid = guid;
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = flags;
}
public DataObjectFormatAttribute(string guid, int arrayCount, DeviceObjectTypeFlags typeFlags)
{
Guid = guid;
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = ObjectDataFormatFlags.None;
}
public DataObjectFormatAttribute(DeviceObjectTypeFlags typeFlags)
{
TypeFlags = typeFlags;
Flags = ObjectDataFormatFlags.None;
InstanceNumber = 0;
ArrayCount = 0;
}
public DataObjectFormatAttribute(DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags)
{
TypeFlags = typeFlags;
Flags = flags;
}
public DataObjectFormatAttribute(DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags, int instanceNumber)
{
TypeFlags = typeFlags;
Flags = flags;
InstanceNumber = instanceNumber;
}
public DataObjectFormatAttribute(int arrayCount, DeviceObjectTypeFlags typeFlags)
{
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = ObjectDataFormatFlags.None;
}
public DataObjectFormatAttribute(int arrayCount, DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags)
{
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = flags;
}
public DataObjectFormatAttribute(int arrayCount, DeviceObjectTypeFlags typeFlags, ObjectDataFormatFlags flags, int instanceNumber)
{
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = flags;
InstanceNumber = instanceNumber;
}
public DataObjectFormatAttribute(int arrayCount, DeviceObjectTypeFlags typeFlags, int instanceNumber)
{
ArrayCount = arrayCount;
TypeFlags = typeFlags;
Flags = ObjectDataFormatFlags.None;
InstanceNumber = instanceNumber;
}
///
/// Gets or sets the name of the field. Default is using the field name.
///
public string Name;
///
/// Gets or sets Guid for the axis, button, or other input source. When requesting a data format, making this member empty indicates that any type of object is permissible.
///
/// The GUID.
public string Guid;
///
/// Gets or sets the array count.
///
/// The array count.
public int ArrayCount;
///
/// Gets or sets the device type that describes the object.
///
/// The type.
public DeviceObjectTypeFlags TypeFlags;
///
/// Gets or sets the extra flags used to describe the data format.
///
/// The flags.
public ObjectDataFormatFlags Flags;
///
/// Gets or sets the instance number.
///
/// The instance number.
public int InstanceNumber;
}
}