Пример #1
0
        public void readSharkFromSample2(string url, object lck, int seq_current)
        {
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;
            //settings.ConformanceLevel = ConformanceLevel.Fragment;

            using (XmlReader xmlReader = XmlReader.Create(url, settings))
            {
                Queue <MTCValue> queueRef    = null;
                MTCValue         tmpMTCValue = new MTCValue();

                while (true)
                {
                    if (!xmlReader.ReadToFollowing("Position"))
                    {
                        break;
                    }


                    if (xmlReader.IsStartElement())
                    {
                        tmpMTCValue.idx    = Convert.ToInt32(xmlReader.GetAttribute("sequence"));
                        tmpMTCValue.name   = xmlReader.GetAttribute("name");
                        tmpMTCValue.tStamp = xmlReader.GetAttribute("timestamp");


                        string s = xmlReader.GetAttribute("name");
                        switch (s)
                        {
                        case "xPosition":
                            queueRef = queue_posX;
                            break;

                        case "yPosition":
                            queueRef = queue_posY;
                            break;

                        case "zPosition":
                            queueRef = queue_posZ;
                            break;
                        }
                        xmlReader.Read();   // read value
                        tmpMTCValue.value = Convert.ToDouble(xmlReader.Value);

                        if (tmpMTCValue.idx <= seq_current)
                        {
                            //Console.WriteLine("Value:{0}", xmlReader.Value);
                            queueRef.Enqueue(tmpMTCValue);
                        }
                        else
                        {
                            //Console.WriteLine("Bypass..");
                        }
                    }
                }
            }
        }
Пример #2
0
        public void readKukaAudioFromSample2(string url)
        {
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;
            //settings.ConformanceLevel = ConformanceLevel.Fragment;

            bool firstCall = true;

            double time_old = 0;
            double time_new = 0;

            using (XmlReader xmlReader = XmlReader.Create(url, settings))
            {
                MTCValue tmpMTCValue = new MTCValue();


                while (true)
                {
                    xmlReader.ReadToFollowing("SoundLevel");

                    if (xmlReader.GetAttribute("timestamp") == null)
                    {
                        break;
                    }

                    tmpMTCValue.idx    = Convert.ToInt32(xmlReader.GetAttribute("sequence"));
                    tmpMTCValue.name   = xmlReader.GetAttribute("name");
                    tmpMTCValue.tStamp = xmlReader.GetAttribute("timestamp");
                    xmlReader.Read();   // read value

                    if (xmlReader.Value == "UNAVAILABLE")
                    {
                        continue;
                    }

                    tmpMTCValue.value = Convert.ToDouble(xmlReader.Value);

                    queue.Enqueue(tmpMTCValue);

                    time_new = tmpMTCValue.toSec();

                    if (firstCall)
                    {
                        time_old  = time_new;
                        firstCall = false;
                    }
                    //Console.WriteLine("time_old={0} time_new={1} time_diff={2}", time_old, time_new, time_new - time_old);
                    if (time_new - time_old > 10)
                    {
                        break;
                    }
                }
            }
        }
Пример #3
0
        public void readKukaAudioFromSample(string url)
        {
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;
            //settings.ConformanceLevel = ConformanceLevel.Fragment;

            using (XmlReader xmlReader = XmlReader.Create(url, settings))
            {
                MTCValue tmpMTCValue = new MTCValue();


                while (true)
                {
                    xmlReader.ReadToFollowing("SoundLevel");

                    if (xmlReader.GetAttribute("timestamp") == null)
                    {
                        break;
                    }

                    tmpMTCValue.idx    = Convert.ToInt32(xmlReader.GetAttribute("sequence"));
                    tmpMTCValue.name   = xmlReader.GetAttribute("name");
                    tmpMTCValue.tStamp = xmlReader.GetAttribute("timestamp");
                    xmlReader.Read();   // read value

                    if (xmlReader.Value == "UNAVAILABLE")
                    {
                        continue;
                    }

                    tmpMTCValue.value = Convert.ToDouble(xmlReader.Value);

                    queue.Enqueue(tmpMTCValue);
                }
            }
        }