Exemplo n.º 1
0
        public LoggerServerConfigurationImplement Copy()
        {
            var res = new LoggerServerConfigurationImplement();

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

            return(res);
        }
Exemplo n.º 2
0
        public TcpServerConfigImplement Copy()
        {
            var res = new TcpServerConfigImplement();

            res._isEnabled   = this._isEnabled;
            res._port        = this._port;
            res._serviceName = this._serviceName;

            return(res);
        }
Exemplo n.º 3
0
        private ITcpServerConfig DeserializeITcpServerConfigElem(System.Xml.XmlReader reader)
        {
            var res = new TcpServerConfigImplement();

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

            string attribGenTempVal = null;

            attribGenTempVal = reader.GetAttribute("isEnabled");
            if (attribGenTempVal != null)
            {
                res.SetIsEnabledVal(Parse <Boolean>(attribGenTempVal));
            }

            attribGenTempVal = reader.GetAttribute("port");
            if (attribGenTempVal != null)
            {
                res.SetPortVal(Parse <Int32>(attribGenTempVal));
            }
            else
            {
                throw new System.Configuration.ConfigurationErrorsException("Attribute 'port for element 'ITcpServerConfig' not defined", reader);
            }

            attribGenTempVal = reader.GetAttribute("serviceName");
            if (attribGenTempVal != null)
            {
                res.SetServiceNameVal(Parse <String>(attribGenTempVal));
            }


            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 'ITcpServerConfig'", reader);
                            }

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

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

                reader.ReadEndElement();
            }

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

            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);
        }