Ejemplo n.º 1
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            isValid isValidField = ((isValid)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                if (WriteChildElement(writer, "mac", true, false, isValidField.mac))
                {
                    writer.WriteString(isValidField.mac);
                    writer.WriteEndElement();
                }
                if (WriteChildElement(writer, "pin", true, false, isValidField.pin))
                {
                    string pin_List = "";
                    if (this._CompressByteArrays)
                    {
                        if ((isValidField.pin != null))
                        {
                            pin_List = Convert.ToBase64String(isValidField.pin);
                        }
                        writer.WriteString(pin_List);
                    }
                    else
                    {
                        for (int i = 0; (i < isValidField.pin.Length); i = (i + 1))
                        {
                            pin_List = (pin_List + XmlConvert.ToString(isValidField.pin[i]));
                            if ((i
                                 < (isValidField.pin.Length - 1)))
                            {
                                pin_List = (pin_List + " ");
                            }
                        }
                        writer.WriteString(pin_List);
                    }
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
            return;
        }
Ejemplo n.º 2
0
        public override object ReadObject(XmlReader reader)
        {
            isValid isValidField = null;

            if (IsParentStartElement(reader, false, true))
            {
                isValidField = new isValid();
                reader.Read();
                if (IsChildStartElement(reader, "mac", true, false))
                {
                    reader.Read();
                    isValidField.mac = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "pin", true, false))
                {
                    reader.Read();
                    string[] pin_List = reader.ReadString().Split();
                    if ((this._CompressByteArrays ||
                         ((pin_List.Length == 1) &&
                          (pin_List[0].Length > 2))))
                    {
                        isValidField.pin = Convert.FromBase64String(pin_List[0]);
                    }
                    else
                    {
                        isValidField.pin = new byte[pin_List.Length];
                        for (int i = 0; (i < pin_List.Length); i = (i + 1))
                        {
                            isValidField.pin[i] = XmlConvert.ToByte(pin_List[i]);
                        }
                    }
                    reader.ReadEndElement();
                }
                reader.ReadEndElement();
            }
            return(isValidField);
        }
Ejemplo n.º 3
0
        public virtual isValidResponse isValid(isValid req)
        {
            // Create request header
            String action;

            action = "http://tempuri.org/IService1/isValid";
            WsWsaHeader header;

            header = new WsWsaHeader(action, null, EndpointAddress, m_version.AnonymousUri, null, null);
            WsMessage request = new WsMessage(header, req, WsPrefix.None);

            // Create request serializer
            isValidDataContractSerializer reqDcs;

            reqDcs             = new isValidDataContractSerializer("isValid", "http://tempuri.org/");
            request.Serializer = reqDcs;
            request.Method     = "isValid";


            // Send service request
            m_requestChannel.Open();
            WsMessage response = m_requestChannel.Request(request);

            m_requestChannel.Close();

            // Process response
            isValidResponseDataContractSerializer respDcs;

            respDcs = new isValidResponseDataContractSerializer("isValidResponse", "http://tempuri.org/");
            isValidResponse resp;

            resp = ((isValidResponse)(respDcs.ReadObject(response.Reader)));
            response.Reader.Dispose();
            response.Reader = null;
            return(resp);
        }