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 PipeServerConfigImplement Copy()
        {
            var res = new PipeServerConfigImplement();

            res._isEnabled   = this._isEnabled;
            res._pipeName    = this._pipeName;
            res._serviceName = this._serviceName;

            return(res);
        }
Exemplo n.º 3
0
        private IPipeServerConfig DeserializeIPipeServerConfigElem(System.Xml.XmlReader reader)
        {
            var res = new PipeServerConfigImplement();

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

            string attribGenTempVal = null;

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

            attribGenTempVal = reader.GetAttribute("pipeName");
            if (attribGenTempVal != null)
            {
                res.SetPipeNameVal(Parse <String>(attribGenTempVal));
            }
            else
            {
                throw new System.Configuration.ConfigurationErrorsException("Attribute 'pipeName for element 'IPipeServerConfig' 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 'IPipeServerConfig'", reader);
                            }

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

                        default:
                            throw new System.Configuration.ConfigurationErrorsException("Unknown element inside 'IPipeServerConfig': " + 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);
        }