コード例 #1
0
        protected SynologyParameters(SynologyRequest request, [CallerMemberName] string methodName = null)
        {
            var method = request.GetType().GetMethod(methodName);

            if (method != null)
            {
                var attr = method.GetCustomAttribute(typeof(RequestMethodAttribute)) as RequestMethodAttribute;

                if (attr != null)
                {
                    Method = attr.Name;
                }
                else
                {
                    throw new Exception("RequestMethodAttribute not found on caller method.");
                }
            }
            else
            {
                throw new Exception("Caller Method not found.");
            }

            Version = 1;
        }