예제 #1
0
        /// <summary>
        /// Add each shot information to the XML file
        /// </summary>
        /// <param name="shot"></param>
        /// <param name="tags"></param>
        public void addShot(Shot shot, List<String> tags)
        {
            xmlDoc.Load(@FilePath);

            /* search the shot node */
            XmlNode shotsNode = xmlDoc.SelectSingleNode("//ShotDetection//shots");
            XmlNode singleShotNode = xmlDoc.CreateElement("shot");
            XmlAttribute frame = xmlDoc.CreateAttribute("frame");
            frame.Value = shot.frame1 + "-" + shot.frame2;
            singleShotNode.Attributes.Append(frame);
            //singleShotNode.InnerText = shot.frame1 + "-" + shot.frame2;
            shotsNode.AppendChild(singleShotNode);

            /* add the tags node */
            XmlNode xmlTags = xmlDoc.CreateElement("tags");
            singleShotNode.AppendChild(xmlTags);

            if (tags != null)
            {
                for (int i = 0; i < tags.Count; i++)
                {
                    XmlNode singleTag = xmlDoc.CreateElement("tag");
                    singleTag.InnerText = tags[i];
                    xmlTags.AppendChild(singleTag);
                }
            }

            xmlDoc.Save(@FilePath);
        }
예제 #2
0
 public Shot createShot(int f1, int f2, double s, double e)
 {
     Shot sh = new Shot();
     sh.frame1 = f1;
     sh.frame2 = f2;
     sh.start = s;
     sh.end = e;
     return sh;
 }