Beispiel #1
0
        SmallParts ParseParts(JToken json)
        {
            SmallParts part = new SmallParts();

            part.btnStyle  = btnGlobal;
            part.fontStyle = fontGlobal;
            part.lineStyle = lineGlobal;
            ParseFont(ref part.fontStyle, json["FontStyle"]);
            ParseButton(ref part.btnStyle, json["ButtonStyle"]);
            ParseLine(ref part.lineStyle, json["LineStyle"]);
            part.id         = (string)json["id"];
            part.btnRect    = new Rectangle(part.btnStyle.pos.X, part.btnStyle.pos.Y, part.btnStyle.width, part.btnStyle.height);
            part.linePoints = ParsePoints(json["Points"]);
            return(part);
        }
Beispiel #2
0
        private ReadButConfig()
        {
            table = new Hashtable();
            FileStream fd = new FileStream("Config.json", FileMode.Open);

            byte[] buff = new byte[fd.Length];
            fd.Read(buff, 0, (int)fd.Length);
            string  str        = Encoding.Default.GetString(buff);
            JObject jsonObject = JObject.Parse(str);

            ParseFont(ref fontGlobal, jsonObject["FontStyle"]);
            ParseButton(ref btnGlobal, jsonObject["ButtonStyle"]);
            ParseLine(ref lineGlobal, jsonObject["LineStyle"]);

            btnRegion = new Region();
            JArray list = (JArray)jsonObject["list"];

            for (int i = 0; i < list.Count; ++i)
            {
                SmallParts part = ParseParts(list[i]);
                table.Add(part.id, part);
                btnRegion.Union(part.btnRect);
            }
        }