コード例 #1
0
        private void ParseAndUpdateConfig(string data)
        {
            String[] lines = data.Split('\n');
            foreach (String line in lines)
            {
                if (line.ToLower().Contains(matchstring))
                {
                    String[] rawconf = line.Split(delim);
                    for (int i = 0; i < 5; i++)
                    {
                        if (rawconf.Length > i) // Set values from Config Line
                        {
                            switch (i)
                            {
                            case 0:
                                break;

                            case 1:
                                thistextPosition.X = trygetdouble(rawconf[i], textPosX);
                                break;

                            case 2:
                                thistextPosition.Y = trygetdouble(rawconf[i], textPosY);
                                break;

                            case 3:
                                thistextScale = trygetdouble(rawconf[i], textScale);
                                break;

                            case 4:
                                thisconfigcolour = "<color=" + rawconf[i].Trim() + ">";
                                break;

                            default:
                                break;
                            }
                        }
                        else // Set Default Values
                        {
                            switch (i)
                            {
                            case 0:
                                break;

                            case 1:
                                thistextPosition.X = textPosX;
                                break;

                            case 2:
                                thistextPosition.Y = textPosY;
                                break;

                            case 3:
                                thistextScale = textScale;
                                break;

                            case 4:
                                var fontColor = thisLcd.GetValueColor("FontColor");
                                thisconfigcolour = $"<color={fontColor.R},{fontColor.G},{fontColor.B}>";
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    break;
                }
            }
        }