using System;
using System.Collections.Generic;
using System.Linq;
#if SIMPLSHARP
using Crestron.SimplSharp.Reflection;
#else
using System.Reflection;
#endif
using ICD.Common.Properties;
using ICD.Common.Utils;
using ICD.Common.Utils.Collections;
using ICD.Common.Utils.Extensions;
namespace ICD.Common.Attributes.Rpc
{
///
/// Represents a method that can be called by the server via RPC.
///
[PublicAPI]
[MeansImplicitUse]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
public sealed class RpcAttribute : AbstractIcdAttribute
{
private static readonly Dictionary>> s_MethodCache;
private static readonly Dictionary>> s_PropertyCache;
private static readonly SafeCriticalSection s_MethodCacheSection;
private static readonly SafeCriticalSection s_PropertyCacheSection;
private readonly string m_Key;
#region Constructors
///
/// Constructor.
///
static RpcAttribute()
{
s_MethodCache = new Dictionary>>();
s_PropertyCache = new Dictionary>>();
s_MethodCacheSection = new SafeCriticalSection();
s_PropertyCacheSection = new SafeCriticalSection();
}
///
/// Constructor.
///
///
public RpcAttribute(string key)
{
m_Key = key;
}
#endregion
#region Methods
///
/// Gets the method on the client with the given key, matching the parameter types.
///
///
///
///
///
[CanBeNull]
public static MethodInfo GetMethod(object client, string key, IEnumerable