forked from wfowler1/LibBSP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply C# coding style for Indentation and braces from https://learn.m…
- Loading branch information
Showing
58 changed files
with
22,975 additions
and
18,399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace LibBSP { | ||
/// <summary> | ||
/// Custom Attribute class to mark a member of a struct as an count for another lump. The | ||
/// member this Attribute is applied to should always be paired with a member with an | ||
/// <see cref="IndexAttribute"/> applied to it. The two attributes can the be used to grab a | ||
/// range of objects from the specified lump through the | ||
/// <see cref="BSP.GetReferencedObjects<T>(object, string)"/> method. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] | ||
public class CountAttribute : Attribute { | ||
namespace LibBSP | ||
{ | ||
/// <summary> | ||
/// Custom Attribute class to mark a member of a struct as an count for another lump. The | ||
/// member this Attribute is applied to should always be paired with a member with an | ||
/// <see cref="IndexAttribute"/> applied to it. The two attributes can the be used to grab a | ||
/// range of objects from the specified lump through the | ||
/// <see cref="BSP.GetReferencedObjects<T>(object, string)"/> method. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] | ||
public class CountAttribute : Attribute | ||
{ | ||
|
||
public string lumpName; | ||
|
||
/// <summary> | ||
/// Constructs a new instance of a <see cref="CountAttribute"/> object. The member this Attribute | ||
/// is applied to will be used as a count of objects in the lump referenced by <paramref name="lumpName"/>. | ||
/// </summary> | ||
/// <param name="lumpName">The lump the member is an count for. Corresponds to the public properties in the <see cref="BSP"/> class.</param> | ||
public CountAttribute(string lumpName) { | ||
this.lumpName = lumpName; | ||
} | ||
} | ||
public string lumpName; | ||
|
||
/// <summary> | ||
/// Constructs a new instance of a <see cref="CountAttribute"/> object. The member this Attribute | ||
/// is applied to will be used as a count of objects in the lump referenced by <paramref name="lumpName"/>. | ||
/// </summary> | ||
/// <param name="lumpName">The lump the member is an count for. Corresponds to the public properties in the <see cref="BSP"/> class.</param> | ||
public CountAttribute(string lumpName) | ||
{ | ||
this.lumpName = lumpName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace LibBSP { | ||
/// <summary> | ||
/// Custom Attribute class to mark a member of a struct as an index into another lump. The | ||
/// member this Attribute is applied to can be paired with a member with a <see cref="CountAttribute"/> | ||
/// applied to it. The two attributes can the be used to grab a range of objects | ||
/// from the specified lump through the | ||
/// <see cref="BSP.GetReferencedObjects<T>(object, string)"/> method. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] | ||
public class IndexAttribute : Attribute { | ||
namespace LibBSP | ||
{ | ||
/// <summary> | ||
/// Custom Attribute class to mark a member of a struct as an index into another lump. The | ||
/// member this Attribute is applied to can be paired with a member with a <see cref="CountAttribute"/> | ||
/// applied to it. The two attributes can the be used to grab a range of objects | ||
/// from the specified lump through the | ||
/// <see cref="BSP.GetReferencedObjects<T>(object, string)"/> method. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] | ||
public class IndexAttribute : Attribute | ||
{ | ||
|
||
public string lumpName; | ||
public string lumpName; | ||
|
||
/// <summary> | ||
/// Constructs a new instance of an <see cref="IndexAttribute"/> object. The member this Attribute | ||
/// is applied to will be used as an index into the lump referenced by <paramref name="lumpName"/>. | ||
/// </summary> | ||
/// <param name="lumpName">The lump the member is an index into. Corresponds to the public properties in the <see cref="BSP"/> class.</param> | ||
public IndexAttribute(string lumpName) { | ||
this.lumpName = lumpName; | ||
} | ||
} | ||
/// <summary> | ||
/// Constructs a new instance of an <see cref="IndexAttribute"/> object. The member this Attribute | ||
/// is applied to will be used as an index into the lump referenced by <paramref name="lumpName"/>. | ||
/// </summary> | ||
/// <param name="lumpName">The lump the member is an index into. Corresponds to the public properties in the <see cref="BSP"/> class.</param> | ||
public IndexAttribute(string lumpName) | ||
{ | ||
this.lumpName = lumpName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace LibBSP { | ||
namespace LibBSP | ||
{ | ||
|
||
/// <summary> | ||
/// Contains static methods for retrieving custom attributes. | ||
/// </summary> | ||
public static partial class CustomAttributeExtensions { | ||
|
||
/// <summary> | ||
/// Retrieves a custom attribute of a specified type that is applied to a specified member. | ||
/// </summary> | ||
/// <param name="element">The member to inspect.</param> | ||
/// <returns>A custom attribute that matches <typeparamref name="T"/>, or <c>null</c> if no such attribute is found.</returns> | ||
/// <typeparam name="T">The type of attribute to search for.</typeparam> | ||
public static T GetCustomAttribute<T>(this MemberInfo element) where T : Attribute { | ||
return Attribute.GetCustomAttribute(element, typeof(T)) as T; | ||
} | ||
/// <summary> | ||
/// Contains static methods for retrieving custom attributes. | ||
/// </summary> | ||
public static partial class CustomAttributeExtensions | ||
{ | ||
|
||
} | ||
/// <summary> | ||
/// Retrieves a custom attribute of a specified type that is applied to a specified member. | ||
/// </summary> | ||
/// <param name="element">The member to inspect.</param> | ||
/// <returns>A custom attribute that matches <typeparamref name="T"/>, or <c>null</c> if no such attribute is found.</returns> | ||
/// <typeparam name="T">The type of attribute to search for.</typeparam> | ||
public static T GetCustomAttribute<T>(this MemberInfo element) where T : Attribute | ||
{ | ||
return Attribute.GetCustomAttribute(element, typeof(T)) as T; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.