GetPasswordBytes() public méthode

Gets the buffer of the password.
public GetPasswordBytes ( ) : byte[]
Résultat byte[]
Exemple #1
0
        /// <summary>Sends a Wake On LAN signal (magic packet) to a client.</summary>
        /// <param name="target">Destination <see cref="IPEndPoint"/>.</param>
        /// <param name="macAddress">The MAC address of the designated client.</param>
        /// <param name="password">The SecureOn password of the client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="macAddress"/> is null.</exception>
        /// <exception cref="SocketException">An error occurred when accessing the socket. See Remarks section of <see cref="UdpClient.Send(byte[], int, IPEndPoint)"/> for more information.</exception>
        public static void Send(IPEndPoint target, PhysicalAddress macAddress, SecureOnPassword password)
        {
            if (macAddress == null)
            {
                throw new ArgumentNullException(nameof(macAddress));
            }

            byte[] passwordBuffer = password?.GetPasswordBytes();
            byte[] packet         = GetWolPacket(macAddress.GetAddressBytes(), passwordBuffer);
            SendPacket(target, packet);
        }
Exemple #2
0
        /// <summary>
        /// Sendet ein Wake-On-LAN-Signal an einen Client.
        /// </summary>
        /// <param name="target">Der Ziel-IPEndPoint.</param>
        /// <param name="macAddress">Die MAC-Adresse des Clients.</param>
        /// <param name="password">Das SecureOn-Passwort des Clients.</param>
        /// <exception cref="System.ArgumentException">Die Länge des <see cref="T:System.Byte" />-Arrays macAddress ist nicht 6.</exception>
        /// <exception cref="System.ArgumentNullException">macAddress ist null.</exception>
        /// <exception cref="System.ArgumentNullException">password ist null.</exception>
        /// <exception cref="System.Net.Sockets.SocketException">Fehler beim Zugriff auf den Socket. Weitere Informationen finden Sie im Abschnitt "Hinweise".</exception>
        public static void Send(IPEndPoint target, byte[] macAddress, SecureOnPassword password)
        {
            if (macAddress == null)
                throw new ArgumentNullException("macAddress");

            if (password == null)
                throw new ArgumentNullException("password");

            byte[] passwordBuffer = password.GetPasswordBytes();
            byte[] packet = GetWolPacket(macAddress, passwordBuffer);
            SendPacket(target, packet);
        }
Exemple #3
0
        /// <summary>Sends a Wake On LAN signal (magic packet) to a client.</summary>
        /// <param name="target">Destination <see cref="IPEndPoint"/>.</param>
        /// <param name="macAddress">The MAC address of the designated client.</param>
        /// <param name="password">The SecureOn password of the client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="target"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="macAddress"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="password"/> is null.</exception>
        /// <returns>An asynchronous <see cref="Task"/> which sends a Wake On LAN signal (magic packet) to a client.</returns>
        public static Task SendAsync(IPEndPoint target, byte[] macAddress, SecureOnPassword password)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (macAddress == null)
            {
                throw new ArgumentNullException(nameof(macAddress));
            }

            var passwordBuffer = password?.GetPasswordBytes();
            var packet         = GetWolPacket(macAddress, passwordBuffer);

            return(SendPacketAsync(target, packet));
        }
Exemple #4
0
        /// <summary>
        /// Sendet ein Wake-On-LAN-Signal an einen Client.
        /// </summary>
        /// <param name="target">Der Ziel-IPEndPoint.</param>
        /// <param name="macAddress">Die MAC-Adresse des Clients.</param>
        /// <param name="password">Das SecureOn-Passwort des Clients.</param>
        /// <exception cref="System.ArgumentNullException">macAddress ist null.</exception>
        /// <exception cref="System.ArgumentNullException">password ist null.</exception>
        /// <returns>Ein asynchroner Task, welcher ein Wake-On-LAN-Signal an einen Client sendet.</returns>
        public static Task SendAsync(IPEndPoint target, PhysicalAddress macAddress, SecureOnPassword password)
        {
            if (target == null)
                throw new ArgumentNullException("target");
            if (macAddress == null)
                throw new ArgumentNullException("macAddress");
            if (password == null)
                throw new ArgumentNullException("password");

            var passwordBuffer = password.GetPasswordBytes();
            var p = GetWolPacket(macAddress.GetAddressBytes(), passwordBuffer);
            return SendPacketAsync(target, p);
        }