예제 #1
0
        static void MainHandler(Object source, System.Timers.ElapsedEventArgs e)
        {
            string outStr = "";

            foreach (var hardwareItem in myComputer.Hardware)
            {
                hardwareItem.Update();
                hardwareItem.GetReport();

                outStr += String.Format("<div class='row'><div class='col-xs-12'><h1>{0}</h1></div></div>", hardwareItem.Name);

                foreach (var sensor in hardwareItem.Sensors)
                {
                    if (sensor.SensorType == SensorType.Temperature)
                    {
                        outStr += String.Format("<div class='row'><div class='col-xs-8'>{0}</div><div class='col-xs-4'>{1}C</div></div>", sensor.Name, sensor.Value);
                    }

                    if (sensor.SensorType == SensorType.Load)
                    {
                        outStr += String.Format("<div class='row'><div class='col-xs-8'>{0}</div><div class='col-xs-4 vcenter'><div class='progress'><div class='progress-bar' role='progressbar' aria-valuenow='{1}' aria-minvalue='0' aria-maxvalue='100' style='width:{1}%'></div></div></div></div>", sensor.Name, Math.Round(Convert.ToDouble(sensor.Value)));
                    }
                }
            }
            LogitechArx.LogiArxSetTagContentById("test", outStr);
        }
예제 #2
0
        private async void updateSubscriber()
        {
            if (twitchChannel != null)
            {
                if (twitchChannel.partner.Value)
                {
                    try
                    {
                        Total <List <Subscription <User> > > subs = await twitchUser.RetriveSubscribers();

                        string text = "<ul>";
                        foreach (Subscription <User> sub in subs.wrapped)
                        {
                            text += "<li>" + sub.wrapped.name.ToString() + "</li>";
                        }
                        text += "</ul>";
                        LogitechArx.LogiArxSetTagContentById("last_subs", text);
                    }
                    catch { }
                }
                else
                {
                    LogitechArx.LogiArxSetTagContentById("last_subs", "No partner");
                }
            }
        }
예제 #3
0
 private void updateChannelInfo()
 {
     if (twitchChannel != null)
     {
         LogitechArx.LogiArxSetTagContentById("channel_views", twitchChannel.views.ToString());
         LogitechArx.LogiArxSetTagContentById("followers", twitchChannel.followers.ToString());
         LogitechArx.LogiArxSetTagContentById("mature", twitchChannel.mature.ToString());
     }
 }
예제 #4
0
        void Start() //Start Logitech ARX INIT
        {
            contextCallback.arxCallBack = new LogitechArx.logiArxCB(this.callback);
            contextCallback.arxContext  = System.IntPtr.Zero;
            bool retVal = LogitechArx.LogiArxInit("de.so.TwitchControl", "TwitchControl", ref contextCallback);

            if (!retVal)
            {
                int retCode = LogitechArx.LogiArxGetLastError();
                Debug.Fail("SDK can't be initalized! Error: " + retCode);
            }
        }
예제 #5
0
        static void Start()
        {
            LogitechArx.logiArxCbContext contextCallback;
            contextCallback.arxCallBack = arxCallback;
            contextCallback.arxContext  = System.IntPtr.Zero;
            bool retVal = LogitechArx.LogiArxInit("arx.hardware.monitor", "ArxHWM", ref
                                                  contextCallback);

            if (!retVal)
            {
                int retCode = LogitechArx.LogiArxGetLastError();
                Console.WriteLine("loading sdk failed: " + retCode);
            }
        }
예제 #6
0
 private void updateIRC()
 {
     Debug.Print("Update IRC");
     if (irc != null)
     {
         try
         {
             List <String> messages = irc.GetMessages();
             string        text     = "<ul>";
             foreach (String message in messages)
             {
                 text += "<li>" + message + "</li>";
             }
             text += "</ul>";
             LogitechArx.LogiArxSetTagContentById("chat_messages", text);
         }
         catch { }
     }
 }
예제 #7
0
        private async void updateStreamInfo()
        {
            Debug.Print("Update Stream Info");
            Stream twitchStream = null;

            try
            {
                twitchStream = await twitchClient.RetrieveStream(twitchUser.name.ToString());

                LogitechArx.LogiArxSetTagContentById("average_fps", twitchStream.averageFps.ToString());
                LogitechArx.LogiArxSetTagContentById("game", twitchStream.game.ToString());
                LogitechArx.LogiArxSetTagContentById("viewers", twitchStream.viewers.ToString());
                LogitechArx.LogiArxSetTagContentById("video_quality", twitchStream.videoHeight.ToString() + "p");
                LogitechArx.LogiArxSetTagContentById("status", twitchChannel.status.ToString());
                if (twitchChannel.delay.ToString() != "")
                {
                    LogitechArx.LogiArxSetTagContentById("delay", twitchChannel.delay.ToString());
                }
                else
                {
                    LogitechArx.LogiArxSetTagContentById("delay", "None");
                }
            }
            catch
            {
                LogitechArx.LogiArxSetTagContentById("average_fps", "");
                LogitechArx.LogiArxSetTagContentById("game", "");
                LogitechArx.LogiArxSetTagContentById("viewers", "");
                LogitechArx.LogiArxSetTagContentById("video_quality", "");
                LogitechArx.LogiArxSetTagContentById("status", "Stream offline!");
                LogitechArx.LogiArxSetTagContentById("delay", "");
            }


            if (twitchChannel != null)
            {
                if (!twitchChannel.partner.Value)
                {
                    LogitechArx.LogiArxSetTagPropertyById("commercial_card", "hidden", "true");
                }
            }
        }
예제 #8
0
        static void SDKCallback(int eventType, int eventValue, System.String eventArg, System.IntPtr context)
        {
            if (eventType == LogitechArx.LOGI_ARX_EVENT_MOBILEDEVICE_ARRIVAL)
            {
                // Initilize Environment
                if (!LogitechArx.LogiArxAddFileAs("view.html", "view.html"))
                {
                    int retCode = LogitechArx.LogiArxGetLastError();
                    Debug.WriteLine("exec failed: " + retCode);
                }

                if (!LogitechArx.LogiArxAddFileAs("bootstrap.min.css", "bootstrap.min.css"))
                {
                    int retCode = LogitechArx.LogiArxGetLastError();
                    Debug.WriteLine("exec failed: " + retCode);
                }

                if (!LogitechArx.LogiArxAddFileAs("bootstrap.min.js", "bootstrap.min.js"))
                {
                    int retCode = LogitechArx.LogiArxGetLastError();
                    Debug.WriteLine("exec failed: " + retCode);
                }

                if (!LogitechArx.LogiArxSetIndex("view.html"))
                {
                    int retCode = LogitechArx.LogiArxGetLastError();
                    Debug.WriteLine("exec failed: " + retCode);
                }
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_MOBILEDEVICE_REMOVAL)
            {
                // Handle Disconnect
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_TAP_ON_TAG)
            {
                // Handle Inputs
            }
        }
예제 #9
0
        void callback(int eventType, int eventValue, System.String eventArg, System.IntPtr context)
        {
            if (eventType == LogitechArx.LOGI_ARX_EVENT_MOBILEDEVICE_ARRIVAL)
            {
                LogitechArx.LogiArxAddFileAs("index.html", "index.html", "text/html");
                Thread.Sleep(1000);
                LogitechArx.LogiArxAddFileAs("jquery.min.js", "jquery.min.js", "text/html");
                Thread.Sleep(1000);
                LogitechArx.LogiArxSetIndex("index.html");
                try
                {
                    if (twitchUser == null)
                    {
                        MessageBox.Show("You are not logged in!", "Login");
                    }
                    else
                    {
                        update();
                    }
                }
                catch { }
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_MOBILEDEVICE_REMOVAL)
            {
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_FOCUS_ACTIVE)
            {
                if (twitchUser == null)
                {
                    MessageBox.Show("You are not logged in!", "Login");
                }
                else
                {
                    update();
                }
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_FOCUS_INACTIVE)
            {
            }
            else if (eventType == LogitechArx.LOGI_ARX_EVENT_TAP_ON_TAG)
            {
                if (twitchUser == null)
                {
                    MessageBox.Show("You are not logged in!", "Login");
                }
                else
                {
                    switch (eventArg)
                    {
                    case "makeCommercial30":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec30);
                        break;

                    case "makeCommercial60":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec60);
                        break;

                    case "makeCommercial90":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec90);
                        break;

                    case "makeCommercial120":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec120);
                        break;

                    case "makeCommercial150":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec150);
                        break;

                    case "makeCommercial180":
                        twitchUser.StartCommercial(TwitchConstants.CommercialLength.Sec180);
                        break;
                    }
                }
            }
        }