Example #1
0
        // start external application
        public static void SelectEntryOK(int line)
        {
            // remove alle entries
            RemoveEntries();

            try
            {
                Process.Start(listEntries[line].Path);
                WriteDebugMessage("Start Application: " + listEntries[line].Path);

                // display execute path
                LogitechGSDK.LogiLcdColorSetText(1, "Excute... " + listEntries[line].Name, selectedColorR, selectedColorG, selectedColorB);
                LogitechGSDK.LogiLcdColorSetText(3, "@ " + listEntries[line].Path, lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(5, "(go back with <- )", lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdUpdate();
            }
            catch (Exception ex)
            {
                var first  = ex.Message.Substring(0, (int)(ex.Message.Length / 3));
                var second = ex.Message.Substring((int)(ex.Message.Length / 3), (int)(ex.Message.Length / 3));
                var third  = ex.Message.Substring((ex.Message.Length / 3) + (ex.Message.Length / 3), (int)(ex.Message.Length / 3));

                WriteDebugMessage("Faled to start Application: " + ex.ToString() + " " + listEntries[line].Path);
                LogitechGSDK.LogiLcdColorSetText(0, "failed: " + listEntries[line].Name, selectedColorR, selectedColorG, selectedColorB);
                LogitechGSDK.LogiLcdColorSetText(1, "Error:", lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(2, first, lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(3, second, lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(4, third, lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(6, "@ " + listEntries[line].Path, lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdColorSetText(7, "(go back with <- )", lineColorR, lineColorG, lineColorB);
                LogitechGSDK.LogiLcdUpdate();
            }
            finally
            {
                noPageLock = false;
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            // check and load config
            AppSettings loadedSettings = CheckandLoadConfig();

            listEntries = loadedSettings.Applications;


            // set settings
            titelColorR    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).R;
            titelColorG    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).G;
            titelColorB    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).B;
            lineColorR     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).R;
            lineColorG     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).G;
            lineColorB     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).B;
            selectedColorR = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).R;
            selectedColorG = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).G;
            selectedColorB = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).B;
            prefixSelector = loadedSettings.GlobalSettings.PrefixSelector;
            suffixSelector = loadedSettings.GlobalSettings.SuffixSelector;
            debugOn        = loadedSettings.GlobalSettings.DebugMode;
            paddingLeft    = loadedSettings.GlobalSettings.paddingLeft;
            topOffset      = loadedSettings.GlobalSettings.topOffset;



            // check if already running
            Process[] pname = Process.GetProcessesByName(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
            if (pname.Length > 1)
            {
                Process currentProcess = Process.GetCurrentProcess();
                debugOn = true;
                WriteDebugMessage("App already running need to kill all other...");

                foreach (Process task in pname)
                {
                    if (task.Id != currentProcess.Id)
                    {
                        task.Kill();
                        WriteDebugMessage("Process ID: " + task.Id + " killed");
                    }
                }
                WriteDebugMessage("...Done, but manuel restart is neccessary, press any key to exit..");
                Console.ReadKey();
                Environment.Exit(1);
            }
            else
            {
                WriteDebugMessage("no other instance is running... start");
            }


            // init device
            InitDevice();



            // initial line numbers, indexe etc. for scrolling and paging

            displayLines = g19DisplayLines - topOffset;

            maxIndexNumber = listEntries.Count - 1;
            if (maxIndexNumber >= displayLines)
            {
                maxLineNumber = displayLines;
            }
            else
            {
                maxLineNumber = maxIndexNumber;
            }
            int indexNumber = -1;
            int lineNumber  = -1;
            int pageNumber  = 0;

            // load display entries
            InitDisplayEntries();

            // main loop
            while (1 == 1)
            {
                // set time or titel
                if (loadedSettings.GlobalSettings.ShowClockInsteadOfTitel)
                {
                    LogitechGSDK.LogiLcdColorSetTitle(DateTime.Now.ToShortTimeString(), titelColorR, titelColorG, titelColorB);
                }
                else
                {
                    LogitechGSDK.LogiLcdColorSetTitle(loadedSettings.GlobalSettings.AppTitle, titelColorR, titelColorG, titelColorB);
                }
                LogitechGSDK.LogiLcdUpdate();


                // go down button
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_DOWN) & noPageLock)
                {
                    // count line number until end of page (7)
                    if (lineNumber < maxLineNumber)
                    {
                        lineNumber += 1;
                    }
                    // jump to top
                    else if (lineNumber == maxIndexNumber)
                    {
                        lineNumber = 0;
                    }

                    // count index until max index
                    if (indexNumber == maxIndexNumber)
                    {
                        indexNumber = 0;
                        lineNumber  = 0;
                    }
                    else
                    {
                        indexNumber += 1;
                    }

                    WriteDebugMessage("-> DOWN <-- Line " + lineNumber + " index number:  " + indexNumber + " on Page " + pageNumber);

                    // go down on Page 0 or 1
                    if (pageNumber == 0)
                    {
                        Reorder(lineNumber, indexNumber, appNAME);
                    }
                    else
                    {
                        Reorder(lineNumber, indexNumber, appPATH);
                    }
                }

                // go up button
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_UP) & noPageLock)
                {
                    // discount line number until start page (0)
                    if (lineNumber > -1 & indexNumber <= maxLineNumber)
                    {
                        lineNumber += -1;
                    }

                    // discount until index or line -1
                    if (indexNumber == -1 | lineNumber == -1)
                    {
                        indexNumber = maxIndexNumber;
                        lineNumber  = maxLineNumber;
                    }
                    else
                    {
                        indexNumber += -1;
                    }

                    WriteDebugMessage("-> UP <-- Line " + lineNumber + " index number:  " + indexNumber + " on Page " + pageNumber);

                    // go up Page 0 or 1
                    if (pageNumber == 0)
                    {
                        Reorder(lineNumber, indexNumber, appNAME);
                    }
                    else
                    {
                        Reorder(lineNumber, indexNumber, appPATH);
                    }
                }

                // hit enter
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_OK) & noPageLock)
                {
                    WriteDebugMessage("-> OK <-- Line " + lineNumber);
                    SelectEntryOK(lineNumber);
                }

                // go back (left)
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_LEFT) | LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_CANCEL))
                {
                    WriteDebugMessage("-> BACK (left) <-- Line " + lineNumber);
                    pageNumber = 0;
                    Reorder(lineNumber, indexNumber, appNAME);
                    noPageLock = true;
                }

                // show path (right)
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_RIGHT) & noPageLock)
                {
                    WriteDebugMessage("-> SHOW PATH (right) <-- Line " + lineNumber);
                    Reorder(lineNumber, indexNumber, appPATH);
                    pageNumber = 1;
                }

                Thread.Sleep(100);
            }
        }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        //BUTTON TEST
        String colorButtons = "";
        String monoButtons  = "";

        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_CANCEL))
        {
            colorButtons += "Cancel";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_DOWN))
        {
            colorButtons += "Down";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_LEFT))
        {
            colorButtons += "Left";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_MENU))
        {
            colorButtons += "Menu";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_OK))
        {
            colorButtons += "Ok";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_RIGHT))
        {
            colorButtons += "Right";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_UP))
        {
            colorButtons += "Up";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_0))
        {
            monoButtons += "Button 0";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_1))
        {
            monoButtons += "Button 1";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_2))
        {
            monoButtons += "Button 2";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_3))
        {
            monoButtons += "Button 3";
        }

        LogitechGSDK.LogiLcdMonoSetText(0, monoButtons);
        LogitechGSDK.LogiLcdColorSetText(5, colorButtons, 255, 255, 0);

        //LCD TYPE CONNECTED TEST
        String lcdsConnected = "LCDs connected :";

        if (LogitechGSDK.LogiLcdIsConnected(LogitechGSDK.LOGI_LCD_TYPE_MONO))
        {
            lcdsConnected += "MONO ";
        }
        if (LogitechGSDK.LogiLcdIsConnected(LogitechGSDK.LOGI_LCD_TYPE_COLOR))
        {
            lcdsConnected += "COLOR";
        }

        LogitechGSDK.LogiLcdMonoSetText(1, lcdsConnected);
        LogitechGSDK.LogiLcdColorSetText(2, lcdsConnected, 255, 255, 0);

        LogitechGSDK.LogiLcdUpdate();
        if (Input.GetKey(KeyCode.Mouse0))
        {
            //COLOR TEST
            pixelMatrix = new byte[307200];
            int           red    = 0;
            int           blue   = 0;
            int           green  = 0;
            int           alpha  = 0;
            System.Random random = new System.Random();
            red   = random.Next(0, 255);
            blue  = random.Next(0, 255);
            green = random.Next(0, 255);
            alpha = random.Next(0, 255);
            for (int i = 0; i < 307200; i++)
            {
                if ((i % 1) == 0)
                {
                    pixelMatrix[i] = (byte)blue;               // blue
                }
                if ((i % 2) == 0)
                {
                    pixelMatrix[i] = (byte)green;               // green
                }
                if ((i % 3) == 0)
                {
                    pixelMatrix[i] = (byte)red;               // red
                }
                if ((i % 4) == 0)
                {
                    pixelMatrix[i] = (byte)alpha;               // red
                }
            }

            LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix);
            LogitechGSDK.LogiLcdColorSetText(6, "color : " + red + " - " + blue + " - " + green + " - " + alpha, 255, 0, 0);
        }
        if (Input.GetKey(KeyCode.Mouse1))
        {
            //MONO TEST
            pixelMatrix = new byte[6880];
            int pixel;
            for (int i = 0; i < 6880; i++)
            {
                System.Random random = new System.Random();
                pixel          = random.Next(0, 255);
                pixelMatrix[i] = (byte)pixel; // red
            }

            LogitechGSDK.LogiLcdMonoSetBackground(pixelMatrix);
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        int StoredPage = GameControl.control.LCDPage;

        if (GameControl.control.Shutdown == true)
        {
            LogitechGSDK.LogiLcdShutdown();
        }

        //BUTTON TEST
        String colorButtons = "";
        String monoButtons  = "";

        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_CANCEL))
        {
            colorButtons += "Cancel";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_DOWN))
        {
            colorButtons += "Down";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_LEFT))
        {
            colorButtons += "Left";
            GameControl.control.LCDPage--;
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_MENU))
        {
            colorButtons += "Menu";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_OK))
        {
            colorButtons += "Ok";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_RIGHT))
        {
            colorButtons += "Right";
            GameControl.control.LCDPage++;
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_UP))
        {
            colorButtons += "Up";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_0))
        {
            monoButtons += "Button 0";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_1))
        {
            monoButtons += "Button 1";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_2))
        {
            monoButtons += "Button 2";
        }
        if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_3))
        {
            monoButtons += "Button 3";
        }

        // LogitechGSDK.LogiLcdMonoSetText(0, monoButtons);
        // LogitechGSDK.LogiLcdColorSetText(5, colorButtons, 255, 255, 0);

        if (GameControl.control.LCDPage < 0)
        {
            GameControl.control.LCDPage = 0;
        }

        if (GameControl.control.LCDPage != StoredPage)
        {
            for (int i = 0; i < 8; i++)
            {
                LogitechGSDK.LogiLcdColorSetText(i, "", 0, 0, 0);
            }
        }

        if (GameControl.control.ChangeColor == true)
        {
            Timer -= 1 * Time.deltaTime;

            if (Timer <= 0)
            {
                Timer = 1;
                RaveParty();
            }
        }

        LogitechGSDK.LogiLcdUpdate();
    }
Example #5
0
    void DoMyWindow(int WindowID)
    {
        if (boot.Terminal == false)
        {
            if (CloseButton.Contains(Event.current.mousePosition))
            {
                if (GUI.Button(new Rect(CloseButton), "X", Skin.customStyles [0]))
                {
                    appman.SelectedApp = "Command Line V3";
                }
            }
            else
            {
                GUI.backgroundColor = com.colors[Customize.cust.ButtonColorInt];
                GUI.contentColor    = com.colors[Customize.cust.FontColorInt];
                GUI.Button(new Rect(CloseButton), "X", Skin.customStyles [1]);
            }

            if (MiniButton.Contains(Event.current.mousePosition))
            {
                if (GUI.Button(new Rect(MiniButton), "-", Skin.customStyles [2]))
                {
                    minimize = !minimize;
                    Minimize();
                }
            }
            else
            {
                GUI.backgroundColor = com.colors[Customize.cust.ButtonColorInt];
                GUI.contentColor    = com.colors[Customize.cust.FontColorInt];
                if (GUI.Button(new Rect(MiniButton), "-", Skin.customStyles [2]))
                {
                    minimize = !minimize;
                    Minimize();
                }
            }

            GUI.DragWindow(new Rect(DefaltBoxSetting));
            GUI.Box(new Rect(DefaltBoxSetting), "Command-Line Interface");
        }

        if (cli.PastCommands.Count > Customize.cust.DeletionAmt)
        {
            cli.PastCommands.RemoveAt(0);
        }

        if (cli.AutoScroll == true)
        {
            scrollpos.y    = scrollsize * 20;
            cli.AutoScroll = false;
        }

        if (cli.SetScrollPos == true)
        {
            scrollpos.y      = scrollsize * 20 / ScrollValue;
            cli.SetScrollPos = false;
        }

        Style.fontSize = Customize.cust.TerminalFontSize;

        //if (Event.current.type == EventType.KeyDown)
        //{
        //	AudioSoucres.pitch = Random.Range (0.96f, 1.04f);
        //	AudioSoucres.PlayOneShot (AudioClips);
        //	//AudioSoucres.pitch = 1;
        //}

        if (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.Return)
        {
            cli.PastCommands.Add(cli.Parse);
            cli.CommandCheck();
            cli.Parse        = "";
            cli.SetScrollPos = true;

            for (int i = 0; i < 8; i++)
            {
                LogitechGSDK.LogiLcdColorSetText(i, "", 0, 0, 0);
            }

            LogitechGSDK.LogiLcdUpdate();
        }

        if (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.DownArrow)
        {
            if (PastCommandSelect < scrollsize - 1)
            {
                PastCommandSelect++;
                cli.Parse = cli.PastCommands[PastCommandSelect];
            }
        }

        if (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.UpArrow)
        {
            if (PastCommandSelect >= 1)
            {
                PastCommandSelect--;
                cli.Parse = cli.PastCommands[PastCommandSelect];
            }
        }

        User = "" + GameControl.control.ProfileName + "@" + Customize.cust.GatewayName + ">";

        SMod = Customize.cust.TerminalFontSize / 2 * 0.1f;

        //Customize.cust.TerminalTextPosMod = SMod * User.Length;


        if (boot.Terminal == true)
        {
            GUI.contentColor = Color.white;

            scrollpos = GUI.BeginScrollView(new Rect(2, 2, windowRect.width - 4, windowRect.height - HMod), scrollpos, new Rect(0, 0, 0, scrollsize * 22));

            GUI.Label(new Rect(2, scrollsize * 20 * SMod, windowRect.width - 2, Customize.cust.FontSize + 2), User, Style);

            //cli.Parse = GUI.TextField(new Rect(User.Length + Customize.cust.TerminalTextPosMod * Customize.cust.TerminalFontSize, scrollsize*20-1*SMod, windowRect.width-84, 23), cli.Parse, 500,Style);
            cli.Parse = GUI.TextField(new Rect(User.Length + Customize.cust.TerminalTextPosMod * Customize.cust.TerminalFontSize, scrollsize * 20 * SMod, windowRect.width - 84, Customize.cust.FontSize + 2), cli.Parse, 500, Style);

            for (scrollsize = 0; scrollsize < cli.PastCommands.Count; scrollsize++)
            {
                GUI.Label(new Rect(2, scrollsize * 20 * SMod, windowRect.width - 2, 25), "" + cli.PastCommands [scrollsize], Style);
            }

            GUI.EndScrollView();
        }
        else
        {
            GUI.contentColor = Color.green;


            scrollpos = GUI.BeginScrollView(new Rect(2, 25, windowRect.width - 4, windowRect.height - 40), scrollpos, new Rect(0, 0, 0, scrollsize * 24));

            //GUI.Label (new Rect (2, windowRect.height - 50, windowRect.width-2, Customize.cust.FontSize+2),User,Style);

            //cli.Parse = GUI.TextField(new Rect(User.Length + Customize.cust.TerminalTextPosMod * Customize.cust.TerminalFontSize, scrollsize*20-1*SMod, windowRect.width-84, 23), cli.Parse, 500,Style);
            //cli.Parse = GUI.TextField(new Rect(User.Length + Customize.cust.TerminalTextPosMod * Customize.cust.TerminalFontSize, windowRect.height - 50, windowRect.width-84, Customize.cust.FontSize+2), cli.Parse, 500,Style);

            for (scrollsize = 0; scrollsize < cli.PastCommands.Count; scrollsize++)
            {
                GUI.Label(new Rect(2, scrollsize * 24, windowRect.width - 2, 20), "" + cli.PastCommands [scrollsize], Style);
            }

            GUI.EndScrollView();
            GUI.Label(new Rect(2, windowRect.height - 20, windowRect.width - 2, Customize.cust.FontSize + 2), ">", Style);

            cli.Parse = GUI.TextField(new Rect(12, windowRect.height - 20, windowRect.width - 84, Customize.cust.FontSize + 2), cli.Parse, 500, Style);
        }
    }