コード例 #1
0
        /// <summary>
        /// Get the Floor tag from Calibration XML.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns>FloorCalibration.Floor</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     System.FormatException
        ///     System.OverflowException
        ///     FloorCalibration.UnparseableXMLException" />
        private static CalibrationConfiguration GetFloorConfigFromXML(string xml)
        {
            XDocument xdoc = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml));
            CalibrationConfiguration configuration = null;

            foreach (var xel in xdoc.Root.Elements())
            {
                if (xel.Name == XMLElementsAndAttributes.Floor)
                {
                    foreach (var tagContent in xel.Elements())
                    {
                        if (tagContent.Name == XMLElementsAndAttributes.CalibrationConfiguration)
                        {
                            string frontDistance       = tagContent.Attribute(XMLElementsAndAttributes.FrontDistance).Value;
                            string backDistance        = tagContent.Attribute(XMLElementsAndAttributes.BackDistance).Value;
                            string leftDistance        = tagContent.Attribute(XMLElementsAndAttributes.LeftDistance).Value;
                            string rightDistance       = tagContent.Attribute(XMLElementsAndAttributes.RightDistance).Value;
                            string primaryScreenWidth  = tagContent.Attribute(XMLElementsAndAttributes.PrimaryScreenWidth).Value;
                            string primaryScreenHeight = tagContent.Attribute(XMLElementsAndAttributes.PrimaryScreenHeight).Value;

                            configuration = new CalibrationConfiguration(frontDistance, backDistance, leftDistance, rightDistance, primaryScreenWidth, primaryScreenHeight);
                        }
                    }
                }
            }

            return(configuration);
        }
コード例 #2
0
ファイル: Dictionary.cs プロジェクト: guozanhua/kinect-ripple
        /// <summary>
        /// Get the Floor tag from Calibration XML.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns>FloorCalibration.Floor</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     System.FormatException
        ///     System.OverflowException
        ///     FloorCalibration.UnparseableXMLException" />
        private static CalibrationConfiguration GetFloorConfigFromXML(string xml)
        {
            XDocument xdoc = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml));
            CalibrationConfiguration configuration = null;

            foreach (var xel in xdoc.Root.Elements())
            {
                if (xel.Name == XMLElementsAndAttributes.Floor)
                {

                    foreach (var tagContent in xel.Elements())
                    {
                        if (tagContent.Name == XMLElementsAndAttributes.CalibrationConfiguration)
                        {
                            string frontDistance = tagContent.Attribute(XMLElementsAndAttributes.FrontDistance).Value;
                            string backDistance = tagContent.Attribute(XMLElementsAndAttributes.BackDistance).Value;
                            string leftDistance = tagContent.Attribute(XMLElementsAndAttributes.LeftDistance).Value;
                            string rightDistance = tagContent.Attribute(XMLElementsAndAttributes.RightDistance).Value;
                            string primaryScreenWidth = tagContent.Attribute(XMLElementsAndAttributes.PrimaryScreenWidth).Value;
                            string primaryScreenHeight = tagContent.Attribute(XMLElementsAndAttributes.PrimaryScreenHeight).Value;

                            configuration = new CalibrationConfiguration(frontDistance, backDistance, leftDistance, rightDistance, primaryScreenWidth, primaryScreenHeight);
                        }
                    }

                }
            }

            return configuration;
        }