protected override void OnStart(string[] args)
        {
            try
            {
                myRegistry.SubKey = "SOFTWARE\\OSAE\\DBSETTINGS";
                osae.APIpath      = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
                IPHostEntry ipEntry = Dns.GetHostByName(osae.ComputerName);
                IPAddress[] addr    = ipEntry.AddressList;
                _computerIP = addr[0].ToString();

                System.IO.FileInfo file = new System.IO.FileInfo(osae.APIpath + "/Logs/");
                file.Directory.Create();
                if (osae.GetObjectPropertyValue("SYSTEM", "Prune Logs").Value == "TRUE")
                {
                    string[] files = Directory.GetFiles(osae.APIpath + "/Logs/");
                    foreach (string f in files)
                    {
                        File.Delete(f);
                    }
                }
            }
            catch (Exception ex)
            {
                osae.AddToLog("Error getting registry settings and/or deleting logs: " + ex.Message, true);
            }

            osae.AddToLog("OnStart", true);

            osae.AddToLog("Creating Computer object: " + osae.ComputerName, true);
            if (osae.GetObjectByName(osae.ComputerName) == null)
            {
                OSAEObject obj = osae.GetObjectByAddress(_computerIP);
                if (obj == null)
                {
                    osae.ObjectAdd(osae.ComputerName, osae.ComputerName, "COMPUTER", _computerIP, "", true);
                    osae.ObjectPropertySet(osae.ComputerName, "Host Name", osae.ComputerName);
                }
                else if (obj.Type == "COMPUTER")
                {
                    osae.ObjectUpdate(obj.Name, osae.ComputerName, obj.Description, "COMPUTER", _computerIP, obj.Container, obj.Enabled);
                    osae.ObjectPropertySet(osae.ComputerName, "Host Name", osae.ComputerName);
                }
                else
                {
                    osae.ObjectAdd(osae.ComputerName + "." + _computerIP, osae.ComputerName, "COMPUTER", _computerIP, "", true);
                    osae.ObjectPropertySet(osae.ComputerName + "." + _computerIP, "Host Name", osae.ComputerName);
                }
            }
            else
            {
                OSAEObject obj = osae.GetObjectByName(osae.ComputerName);
                osae.ObjectUpdate(obj.Name, obj.Name, obj.Description, "COMPUTER", _computerIP, obj.Container, obj.Enabled);
                osae.ObjectPropertySet(obj.Name, "Host Name", osae.ComputerName);
            }

            try
            {
                osae.AddToLog("Creating Service object", true);
                OSAEObject svcobj = osae.GetObjectByName("SERVICE-" + osae.ComputerName);
                if (svcobj == null)
                {
                    osae.ObjectAdd("SERVICE-" + osae.ComputerName, "SERVICE-" + osae.ComputerName, "SERVICE", "", "SYSTEM", true);
                }
                osae.ObjectStateSet("SERVICE-" + osae.ComputerName, "ON");
            }
            catch (Exception ex)
            {
                osae.AddToLog("Error creating service object - " + ex.Message, true);
            }

            if (connectToService())
            {
                //LoadPlugins();
                Thread loadPluginsThread = new Thread(new ThreadStart(LoadPlugins));
                loadPluginsThread.Start();
            }

            Clock.Interval = 5000;
            Clock.Start();
            Clock.Elapsed += new System.Timers.ElapsedEventHandler(checkConnection);
        }
        public Boolean UpdateObject(string oldName, string newName, string description, string type, string address, string container, int enabled)
        {
            osae.ObjectUpdate(oldName, newName, description, type, address, container, enabled);

            return(true);
        }