コード例 #1
0
ファイル: PenController.cs プロジェクト: Deokbin/UWP-SDK
		/// <summary>
		/// Request to create profile
		/// </summary>
		/// <param name="profileName">Name of the profile to be created</param>
		/// <param name="password">Password of profile</param>
		//public void CreateProfile(string profileName, string password)
		public void CreateProfile(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.ReqCreateProfile(profileNameBytes, password), () => mClientV2.ReqCreateProfile(profileNameBytes, password));
			}
			else
				throw new NotSupportedException($"CreateProfile is not supported at this pen firmware version");

		}