Beispiel #1
0
        public LoggerServerConfigurationImplement Copy()
        {
            var res = new LoggerServerConfigurationImplement();

            res._tcpServerConfig  = TcpServerConfigImplement.CopyInh(this._tcpServerConfig);
            res._pipeServerConfig = PipeServerConfigImplement.CopyInh(this._pipeServerConfig);

            return(res);
        }
Beispiel #2
0
        private ILoggerServerConfiguration DeserializeILoggerServerConfigurationElem(System.Xml.XmlReader reader)
        {
            var res = new LoggerServerConfigurationImplement();

            HashSet <string> parsedElements = new HashSet <string>();


            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                string initialName = reader.Name;
                reader.ReadStartElement();
                do
                {
                    if (reader.NodeType != System.Xml.XmlNodeType.Element)
                    {
                        reader.Skip();
                    }
                    else
                    {
                        switch (reader.Name)
                        {
                        case "add":
                            string addKey = reader.GetAttribute("key");
                            if (addKey == null)
                            {
                                throw new System.Configuration.ConfigurationErrorsException("Key not found for 'add' inside element 'ILoggerServerConfiguration'", reader);
                            }

                            switch (addKey)
                            {
                            default:
                                throw new System.Configuration.ConfigurationErrorsException("Unknown key " + addKey + " inside element 'ILoggerServerConfiguration'", reader);
                            }

                        case "tcpServerConfig":
                            res.SetTcpServerConfigVal(DeserializeITcpServerConfigElem(reader));
                            parsedElements.Add("tcpServerConfig");
                            break;

                        case "pipeServerConfig":
                            res.SetPipeServerConfigVal(DeserializeIPipeServerConfigElem(reader));
                            parsedElements.Add("pipeServerConfig");
                            break;

                        default:
                            throw new System.Configuration.ConfigurationErrorsException("Unknown element inside 'ILoggerServerConfiguration': " + reader.Name, reader);
                        }
                    }
                }while (reader.NodeType != System.Xml.XmlNodeType.EndElement || reader.Name != initialName);

                reader.ReadEndElement();
            }

            HashSet <string> restElems = new HashSet <string>();

            restElems.Add("tcpServerConfig");
            restElems.Add("pipeServerConfig");
            restElems.RemoveWhere(o => parsedElements.Contains(o));
            if (restElems.Count > 0)
            {
                throw new System.Configuration.ConfigurationErrorsException("Not all required properties readed: " + string.Join(", ", restElems));
            }
            return(res);
        }
Beispiel #3
0
 public ILoggerServerConfiguration ExtractConfigData()
 {
     return(LoggerServerConfigurationImplement.CopyInh(_configData));
 }