Esempio n. 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;
        }
Esempio n. 3
0
 protected bool CheckDeviceMediaRoot(out Response errorResponse)
 {
     return CheckNullOrWhiteSpace(DeviceMediaRoot, "DeviceMediaRoot", out errorResponse);
 }
Esempio n. 4
0
 protected bool CheckDeviceId(out Response errorResponse)
 {
     return CheckNullOrWhiteSpace(DeviceId, "DeviceId", out errorResponse);
 }
Esempio n. 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);