Пример #1
0
        public String updateLegsPosition(long start, long end, PernasPosicao lp)
        {
            if (start > end)
            {
                return("");
            }
            String fileName = this.FileName;
            String xml      = "";

            XElement root = XElement.Load(fileName);
            IEnumerable <XElement> frame =
                from el in root.Elements("Frame")
                where (long)el.Attribute("timestamp") >= start
                select el;

            foreach (XElement el in frame)
            {
                if ((long)(Double.Parse(el.Attribute("timestamp").Value)) < end)
                {
                    el.Attribute("legs").Value = lp.ToString();
                    xml += el.ToString();
                }
                else
                {
                    break;
                }
            }
            root.Save(fileName);
            return(xml);
        }
Пример #2
0
        public String updateLegsPosition(String timestamp, PernasPosicao lp)
        {
            String fileName = this.FileName;
            String xml      = "";

            XElement root = XElement.Load(fileName);
            IEnumerable <XElement> frame =
                from el in root.Elements("Frame")
                where (string)el.Attribute("timestamp") == timestamp
                select el;

            foreach (XElement el in frame)
            {
                el.Attribute("legs").Value = lp.ToString();
                xml += el.ToString();
            }
            root.Save(fileName);
            return(xml);
        }