Exemple #1
0
        /// <summary>
        /// This function is deserializing the data provider settings from the string
        /// </summary>
        /// <param name="pSettings">XML settings</param>
        public virtual void SetSettings(string pSettings)
        {
            if (string.IsNullOrEmpty(pSettings))
            {
                return;
            }
            //remove white space from the beginning:
            pSettings = pSettings.TrimStart('\r', ' ', '\n', '\t');
            XmlReaderSettings m_XRS = new XmlReaderSettings();

            m_XRS.ConformanceLevel = ConformanceLevel.Document;
            m_XRS.IgnoreWhitespace = true;
            StringReader m_TR = new StringReader(pSettings);

            using (XmlReader m_XmlTR = XmlReader.Create(m_TR, m_XRS))
            {
                m_XmlTR.Read();
                m_XmlTR.ReadStartElement(m_Tag_TreeElement);
                m_XmlTR.ReadStartElement(m_Tag_DataProviderSettings);
                ReadSettings(m_XmlTR);
                m_XmlTR.ReadEndElement();
                string cTitle = m_XmlTR.ReadElementString(m_Tag_CommunicationLayer);
                m_SelectedCommunicationLayerId = this[cTitle];
                if (m_SelectedCommunicationLayerId == null)
                {
                    return;
                }
                m_XmlTR.ReadStartElement(m_Tag_CmmLayerSettings);
                m_SelectedCommunicationLayerId.SetSettings(m_XmlTR);
                m_XmlTR.ReadEndElement();
                m_XmlTR.ReadEndElement();
            }
        }
Exemple #2
0
 /// <summary>
 /// Adds a communication  <see cref="ICommunicationLayerId"/> item to the list.
 /// </summary>
 /// <param name="value">The <see cref="ICommunicationLayerId"/> object to add to the list.</param>
 /// <returns>The position into which the new element was inserted.</returns>
 protected void Add(ICommunicationLayerId value)
 {
     m_CommunicationLayerIdColl.Add(value.Title, value);
     if (m_SelectedCommunicationLayerId == null)
     {
         m_SelectedCommunicationLayerId = value;
     }
 }
        public void ConstructorTestMethod()
        {
            Assert.AreEqual <int>(1, m_TestingProviderID.Count());
            ICommunicationLayerId _layerDefault = m_TestingProviderID.SelectedCommunicationLayer;

            Assert.IsNotNull(_layerDefault);
            ICommunicationLayerId _layerDefault2 = m_TestingProviderID["Simulator"];

            Assert.IsNotNull(_layerDefault2);
            Assert.AreSame(_layerDefault, _layerDefault);
            Assert.AreEqual <string>("CAS.CommServer.DataProvider.TextReader", m_TestingProviderID.Title);
        }
Exemple #4
0
 private static void Add(ICommunicationLayerId value)
 {
     m_CommunicationLayerIdColl.Add(value.Title, value);
 }