예제 #1
0
		/// <summary>
		/// Request to delete profile
		/// </summary>
		/// <param name="profileName">Name of the profile to be deleted</param>
		/// <param name="password">password of profile</param>
		public void DeleteProfile(string profileName, byte[] password)
		{
			if (IsSupportPenProfile())
			{
				if (string.IsNullOrEmpty(profileName))
					throw new ArgumentNullException("profileName");
				if (password == null)
					throw new ArgumentNullException("password");

				byte[] profileNameBytes = Encoding.UTF8.GetBytes(profileName);
				//byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
				if (profileNameBytes.Length > PenProfile.LIMIT_BYTE_LENGTH_PROFILE_NAME)
					throw new ArgumentOutOfRangeException("profileName", $"profileName byte length must be {PenProfile.LIMIT_BYTE_LENGTH_PROFILE_NAME} or less");
				else if (password.Length != PenProfile.LIMIT_BYTE_LENGTH_PASSWORD)
					throw new ArgumentOutOfRangeException("password", $"password byte length must be {PenProfile.LIMIT_BYTE_LENGTH_PASSWORD}");

				Request(() => mClientV1.ReqDeleteProfile(profileNameBytes, password), () => mClientV2.ReqDeleteProfile(profileNameBytes, password));
			}
			else
				throw new NotSupportedException($"CreateProfile is not supported at this pen firmware version");
		}