示例#1
0
        protected static bool CheckNullOrWhiteSpace(string parameter, string parameterName, out Response errorResponse)
        {
            errorResponse = null;
            if (string.IsNullOrWhiteSpace(parameter))
            {
                errorResponse = new SyncResponse { ErrorMessage = "Required parameter is missing or empty: " + parameterName, Error = (int)SyncResponseError.RequiredParameterMissing };
                return false;
            }

            return true;
        }
        public override bool CheckValidate(out Response errorResponse)
        {
            if (!CheckDeviceId(out errorResponse) ||
              !CheckDeviceMediaRoot(out errorResponse))
            {
                return false;
            }

            DeviceMediaRoot = DeviceMediaRoot.Trim();
            if (!DeviceMediaRoot.EndsWith("/")) DeviceMediaRoot = DeviceMediaRoot + "/";
            return true;
        }
示例#3
0
 protected bool CheckDeviceMediaRoot(out Response errorResponse)
 {
     return CheckNullOrWhiteSpace(DeviceMediaRoot, "DeviceMediaRoot", out errorResponse);
 }
示例#4
0
 protected bool CheckDeviceId(out Response errorResponse)
 {
     return CheckNullOrWhiteSpace(DeviceId, "DeviceId", out errorResponse);
 }
示例#5
0
 /// <summary>
 /// Checks and validates the contents of the request.
 /// </summary>
 /// <param name="errorResponse">If a check failed, an error that can be sent to be client.</param>
 /// <returns>True, if the request is valid, otherwise false.</returns>
 public abstract bool CheckValidate(out Response errorResponse);