OSAE.XBMC.XBMC.RunInterface C# (CSharp) Method

RunInterface() public method

public RunInterface ( string pluginName ) : void
pluginName string
return void
        public override void RunInterface(string pluginName)
        {
            Log.Info("Running interface");
            gAppName = pluginName;
            Log = new General.OSAELog(gAppName);
            if (OSAEObjectManager.ObjectExists(gAppName))
                Log.Info("Found the XBMC plugin's Object (" + gAppName + ")");
            else
                Log.Info("Could Not Find the XBMC plugin's Object!!! (" + gAppName + ")");

            try
            {
                gDebug = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Debug").Value);
            }
            catch
            { Log.Info("The XBMC Object Type seems to be missing the Debug Property!"); }
            Log.Info("Debug Mode Set to " + gDebug);


            OwnTypes();
            //OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");
            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                        case "IP":
                            ip = p.Value;
                            break;
                        case "Port":
                            port = Int32.Parse(p.Value);
                            break;
                        case "Username":
                            username = p.Value;
                            break;
                        case "Password":
                            password = p.Value;
                            break;
                    }
                }
                Log.Info("Creating new XBMC System connection: " + obj.Name + " (" + ip + ":" + port + ", user=" + username + ")");
                try
                {
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                    {
                        Systems.Add(system);
                        Log.Info("XBMC System connection Successfull for: " + obj.Name);
                    }
                }
                catch (Exception ex)
                { Log.Error("Error connecting to XBMC system",ex); }
            }

            try
            {
                Clock = new System.Timers.Timer();
                Clock.Interval = 10000;

                Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
                Clock.Start();
                if (gDebug) Log.Debug("Timers Started");
            }
            catch (Exception ex)
            { Log.Error("Error starting timers ", ex); }
        }