opensourceautomation / Open-Source-Automation

Open Source Automation is a home and commercial automation engine
www.opensourceautomation.com
GNU Lesser General Public License v3.0
97 stars 62 forks source link

EventGhost error with current version #350

Closed volfan6415 closed 8 years ago

volfan6415 commented 8 years ago

Hey so there is a bug in the current compiled eventghost plugin

Lines 81-99 should be replaced with the following code which fixes the error in line 81 ("Port" -> "EventGhost Port") and adds some additional debug logging

OSAEObjectProperty portAddress = OSAEObjectPropertyManager.GetObjectPropertyValue(computer.Name, "EventGhost Port");

        //if no value for port use default value of 33333
        Log.Debug("The port being used is: " + portAddress.Value);
        int port = 0;
        //Log.Debug("The port being used is: " + portAddress.Value);

        if ((portAddress.Value).Equals("", StringComparison.Ordinal))
            port = 33333;
        else
        {
            port = Int32.Parse(portAddress.Value);
            Log.Debug("The port being used is: " +portAddress.Value);

        }
        //logging.AddToLog(port, true);
        //logging.AddToLog(ipAddress, true);
        IPAddress serverAddr = IPAddress.Parse(ipAddress);
        IPEndPoint endPoint = new IPEndPoint(serverAddr, port);
        Log.Debug("The ipEndPoint is:" + ipAddress + ":" + port);

        //send the updpacket
        UdpClient udp = new UdpClient();
        byte[] sendBytes = Encoding.ASCII.GetBytes(combinedString);
        udp.Send(sendBytes, sendBytes.Length, endPoint);
volfan6415 commented 8 years ago

Also line 109 needs to be changed to

Log = new General.OSAELog(pName);