Files
RobustToolbox/Robust.Shared/ViewVariables/ViewVariablesUtility.cs
T
SilverandGitHub 25926a17b7 Renames SS14.* to Robust.* (#793)
RobustToolbox projects should be named Robust.* 

This PR changes the RobustToolbox projects from SS14.* to Robust.*

Updates SS14.* prefixes/namespaces to Robust.*
Updates SpaceStation14.sln to RobustToolbox.sln
Updates MSBUILD/SS14.* to MSBUILD/Robust.*
Updates CSProject and MSBuild references for the above
Updates git_helper.py
Removes Runserver and Runclient as they are unusable
2019-04-15 20:24:59 -06:00

26 lines
958 B
C#

using System;
using System.Linq;
using System.Reflection;
using Robust.Shared.Utility;
namespace Robust.Shared.ViewVariables
{
public static class ViewVariablesUtility
{
/// <summary>
/// Check whether this type has any fields or properties with the <see cref="ViewVariablesAttribute"/>,
/// i.e. whether there are any members that are visible in a VV window.
/// </summary>
/// <remarks>
/// This is quite an expensive operation, don't use it lightly.
/// </remarks>
/// <param name="type">The type to check.</param>
/// <returns>True if there are members with the attribute, false otherwise.</returns>
public static bool TypeHasVisibleMembers(Type type)
{
return type.GetAllFields().Cast<MemberInfo>().Concat(type.GetAllProperties())
.Any(f => f.GetCustomAttribute<ViewVariablesAttribute>() != null);
}
}
}