示例#1
0
        private void SerializeAnalyzers(XmlWriter writer, ObservableDictionary <IAnalyzer, ObservableDictionary <string, string> > analyzers)
        {
            writer.WriteStartElement("analyzers");
            foreach (IAnalyzer analyzer in analyzers.Keys)
            {
                writer.WriteStartElement("analyzer");

                if (analyzer is IAccelerometerAnalyzer)
                {
                    writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(analyzer as IAccelerometerAnalyzer));
                }
                else if (analyzer is IBalanceBoardAnalyzer)
                {
                    writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(analyzer as IBalanceBoardAnalyzer));
                }
                else if (analyzer is IEmgSignalAnalyzer)
                {
                    writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(analyzer as IEmgSignalAnalyzer));
                }
                else
                {
                    writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(analyzer as ISkeletonAnalyzer));
                }

                writeParams(writer, analyzers[analyzer]);

                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
示例#2
0
        private void SerializeDeviceAnalyzers(XmlWriter writer, string deviceName)
        {
            bool sectionStarted = false;


            if (_inputAnalyzers.Count == 0)
            {
                // THIS IS TEMPORARY SOLUTION TO SAVE C3D ANALYZER FOR DEVICE AS DEFAULT
                writer.WriteStartElement("analyzers");
                writer.WriteStartElement("analyzer");
                writer.WriteAttributeString("file", "C3DSerializer.dll");
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
            else
            {
                foreach (InputAnalyzer a in _inputAnalyzers)
                {
                    if (a.Device.Name == deviceName)
                    {
                        if (!sectionStarted)
                        {
                            writer.WriteStartElement("analyzers");
                            sectionStarted = true;
                        }
                        writer.WriteStartElement("analyzer");
                        if (a.Analyzer is ISkeletonAnalyzer)
                        {
                            writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(a.Analyzer as ISkeletonAnalyzer));
                        }
                        else if (a.Analyzer is IAccelerometerAnalyzer)
                        {
                            writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(a.Analyzer as IAccelerometerAnalyzer));
                        }
                        else if (a.Analyzer is IBalanceBoardAnalyzer)
                        {
                            writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(a.Analyzer as IBalanceBoardAnalyzer));
                        }
                        else if (a.Analyzer is IEmgSignalAnalyzer)
                        {
                            writer.WriteAttributeString("file", InputAnalyzerManager.GetAnalyzerModuleName(a.Analyzer as IEmgSignalAnalyzer));
                        }

                        if (a.Parameters.Keys.Count > 0)
                        {
                            writeParams(writer, a.Parameters);
                        }
                        writer.WriteEndElement();
                    }
                }


                if (sectionStarted)
                {
                    writer.WriteEndElement();
                }
            }
        }