Exemple #1
0
        public CKSOperationResult(string cksResponse)
        {
            Source =
                XDocument.Parse(
                    XDocument.Parse(cksResponse)
                    .Element("cksOperationPOSTModel")
                    .Element("xml").Value)
                .Element("cks");
            var elem = Source.Element("return");

            Status = (CKSOperationStatus)Enum.Parse(typeof(CKSOperationStatus), elem.Attribute("Status").Value);
            if (Status == CKSOperationStatus.error)
            {
                XElement xerr = elem.Element("error");
                Error = new CKS.CKSOperationError(
                    (CKSOperationErrorStatus)Enum.Parse(typeof(CKSOperationErrorStatus), xerr.Attribute("Status").Value),
                    xerr.Value);
            }
        }
Exemple #2
0
        public CKSLogin(string loginResponse) : base(loginResponse)
        {
            var elem = Source.Element("return");

            if (Status == CKSOperationStatus.ok)
            {
                UUID = elem.Attribute("UUID").Value;
                foreach (XElement e in Source.Element("session").Element("user").Elements())
                {
                    Properties[e.Name.LocalName] = e.Value;
                }
            }
            else
            {
                XElement xerr = elem.Element("error");
                Error = new CKS.CKSOperationError(
                    (CKSOperationErrorStatus)Enum.Parse(typeof(CKSOperationErrorStatus), xerr.Attribute("Status").Value),
                    xerr.Value);
            }
        }