Port name can not be empty

Apr 20, 2011 at 2:35 PM

Hello.

On any machines i get "Port name can not be empty" (free translatet from german) exception. Please build in a check of the newName parameter in RenameDevice function:

 

        /// <summary>
        /// Renames the specified serial device, only if there is not already another serial device with the specified name.
        /// </summary>
        /// <param name="device">The device to be renamed.</param>
        /// <param name="newName">The new name for the device.</param>
        private static void RenameDevice(SerialDevice device, string newName)
        {
            // Make sure this port isn't already opened by another device
            if (!String.IsNullOrEmpty(newName))
            {
                for (int existingDevice = 0; existingDevice < _SerialDevices.Count; existingDevice++)
                {
                    if (_SerialDevices[existingDevice].Port.Equals(newName, StringComparison.OrdinalIgnoreCase))
                    {
                        return;
                    }
                }

                device.Port = newName;
                device.SetName(newName);
            }
        }

Coordinator
Apr 21, 2011 at 6:06 PM

if this code fixes the problem, you are welcome to commit it to the repository.

- Dan
--------
Daniel P. Ames Ph.D.
Idaho State University Dept. of Geosciences
dan.ames@isu.edu
--------
Sent from my Droid

On Apr 20, 2011 4:37 PM, "tomaten" <notifications@codeplex.com> wrote:
> From: tomaten
>
> Hello.On any machines i get "Port name can not be empty" (free translatet from german) exception. Please build in a check of the newName parameter in RenameDevice function: /// <summary> /// Renames the specified serial device, only if there is not already another serial device with the specified name. /// </summary> /// <param name="device">The device to be renamed.</param> /// <param name="newName">The new name for the device.</param> private static void RenameDevice(SerialDevice device, string newName) { // Make sure this port isn't already opened by another device if (!String.IsNullOrEmpty(newName)) { for (int existingDevice = 0; existingDevice < _SerialDevices.Count; existingDevice++) { if (_SerialDevices[existingDevice].Port.Equals(newName, StringComparison.OrdinalIgnoreCase)) { return; } } device.Port = newName; device.SetName(newName); } }
>
>
Apr 22, 2011 at 3:35 AM

Please copy the one line of code. I would not interfere with the integration of GPS.NET.

Developer
Aug 4, 2011 at 2:42 AM

No issue with integrating this as I see it. I don't have a PC at the moment otherwise i'd do it myself.