public ICsiDocument CreateDocument(string name) { lock (this) { string str; if (!StringUtil.IsEmptyString(name)) { try { if (this.FindDocument(name) == null) { ICsiDocument document = new CsiDocument(this); this.mDocuments[name] = document; ICsiXmlElement parent = new CsiXmlElement(document, "__session", ((CsiDocument)document).GetRootElement()); if (string.IsNullOrEmpty(this.mPassword)) { this.CreateConnectWithoutPassword(this.mUserName, this.mSessionId, parent); return(document); } this.CreateConnect(this.mUserName, this.mPassword, parent); return(document); } str = base.GetType().FullName + ".createDocument()"; throw new CsiClientException(0x2e0015L, str); } catch (Exception exception) { throw new CsiClientException(-1L, exception, base.GetType().FullName + ".createDocument()"); } } str = base.GetType().FullName + ".createDocument()"; throw new CsiClientException(0x2e0016L, str); } }
public ICsiXmlElement RemoveChild(ICsiXmlElement child) { CsiXmlElement impl = (CsiXmlElement)child; this.mDOMElement.RemoveChild(impl.GetDomElement()); return(impl); }
public ICsiRevisionedObject GetItemByRef(string itemName, string revision, bool useROR) { foreach (object allChild in this.GetAllChildren()) { CsiXmlElement csiXmlElementImpl = allChild as CsiXmlElement; if (!(csiXmlElementImpl.FindChildByName("__name") is CsiXmlElement childByName1) || !itemName.Equals(CsiXmlHelper.GetFirstTextNodeValue(childByName1))) { continue; } if (!(csiXmlElementImpl.FindChildByName("__useROR") is CsiXmlElement childByName2) || XmlConvert.ToBoolean(CsiXmlHelper.GetFirstTextNodeValue(childByName2)) != useROR) { continue; } if (useROR || Util.StringUtil.IsEmptyString(revision)) { return((ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement())); } if (!(csiXmlElementImpl.FindChildByName("__rev") is CsiXmlElement childByName3) || !revision.Equals(CsiXmlHelper.GetFirstTextNodeValue(childByName3))) { continue; } return((ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement())); } return(null); }
public CsiXmlElement(ICsiDocument document, string tagName, ICsiXmlElement parentElement) { this.mDocument = null; if (StringUtil.IsEmptyString(tagName)) { throw new Exceptions.CsiClientException(0x2e0016L, base.GetType().FullName + ".csiXMLElement()"); } this.mDocument = document; string str = tagName; ICsiXmlElement element = parentElement; CsiXmlElement child = null; while (str != null) { int index = str.IndexOf("."); if (index > 0) { tagName = str.Substring(0, index); str = str.Substring(index + 1); } else { tagName = str; str = null; } this.mDOMElement = (document as CsiDocument).CreateDomElement(tagName); child = new CsiXmlElement(document, this.mDOMElement); element.AppendChild(child); element = child; } }
public virtual void DeleteItemByIndex(int index) { ICsiXmlElement sourceElement = new CsiXmlElement(this.GetOwnerDocument(), "__listItem", this); sourceElement.SetAttribute("__listItemAction", "delete"); CsiXmlHelper.FindCreateSetValue(sourceElement, "__index", Convert.ToString(index)); }
public void SetExecute() { if (this.FindChildByName("__execute") != null) { return; } CsiXmlElement csiXmlElementImpl = new CsiXmlElement(this.GetOwnerDocument(), "__execute", (ICsiXmlElement)this); }
public ICsiNamedObject GetItemByIndex(int index) { CsiXmlElement impl = this.GetItem(index); if (impl == null) { return(null); } return(new CsiNamedObject(this.GetOwnerDocument(), impl.GetDomElement())); }
public ICsiNamedObject GetItemByName(string name) { CsiXmlElement impl = this.GetItem(name); if (impl == null) { return(null); } return(new CsiNamedObject(this.GetOwnerDocument(), impl.GetDomElement())); }
private ICsiXmlElement GetAllFieldElement() { ICsiXmlElement element = base.FindChildByName("__allFields"); if (element == null) { element = new CsiXmlElement(this.GetOwnerDocument(), "__allFields", this); } return(element); }
public ICsiNamedSubentity GetItemByName(string name) { CsiXmlElement csiXmlElementImpl = this.GetItem(name); if (csiXmlElementImpl == null) { return((ICsiNamedSubentity)null); } return((ICsiNamedSubentity) new CsiNamedSubentity(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement())); }
public static ICsiXmlElement FindCreateSetValue2(ICsiXmlElement sourceElement, string firstLevelTag, string secondLevelTag, string val, bool isCdata) { ICsiXmlElement element = sourceElement.FindChildByName(firstLevelTag); if (element == null) { element = new CsiXmlElement(sourceElement.GetOwnerDocument(), firstLevelTag, sourceElement); } return(FindCreateSetValue(element, secondLevelTag, val, isCdata)); }
public ICsiRevisionedObject GetItemByIndex(int index) { CsiXmlElement csiXmlElementImpl = this.GetItem(index); if (csiXmlElementImpl == null) { return((ICsiRevisionedObject)null); } return((ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement())); }
public ICsiSubentity GetItemByIndex(int index) { CsiXmlElement csiXmlElementImpl = this.GetItem(index); if (csiXmlElementImpl == null) { return((ICsiSubentity)null); } return((ICsiSubentity) new CsiSubentity(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement())); }
public ICsiDataField GetItemByIndex(int index) { CsiXmlElement impl = this.GetItem(index); if (impl == null) { return(null); } return(new CsiDataField(this.GetOwnerDocument(), impl.GetDomElement())); }
private void CreateConnect(string userName, string password, ICsiXmlElement parent) { ICsiDocument document = parent.GetOwnerDocument(); ICsiXmlElement element = new CsiXmlElement(document, "__connect", parent); ICsiNamedObject obj2 = new CsiNamedObject(document, "user", element); obj2.SetRef(userName); ICsiDataField field = new CsiDataField(document, "password", element); field.SetEncryptedValue(password); }
public virtual string GetName() { CsiXmlElement csiElement = (CsiXmlElement)base.FindChildByName("__name"); string str = string.Empty; if (csiElement != null) { str = CsiXmlHelper.GetFirstTextNodeValue(csiElement); } return(str); }
private void CreateConnectWithoutPassword(string userName, string sessionId, ICsiXmlElement parent) { ICsiDocument document = parent.GetOwnerDocument(); ICsiXmlElement element = new CsiXmlElement(document, "__useSession", parent); ICsiNamedObject obj2 = new CsiNamedObject(document, "user", element); obj2.SetRef(userName); ICsiDataField field = new CsiDataField(document, "sessionId", element); field.SetAttribute("__encrypted", "no"); field.SetValue(sessionId); }
public virtual string GetLevel() { CsiXmlElement impl = base.FindChildByName("__level") as CsiXmlElement; string str = string.Empty; if (impl != null) { CsiXmlElement csiElement = (CsiXmlElement)impl.FindChildByName("__name"); if (csiElement != null) { str = CsiXmlHelper.GetFirstTextNodeValue(csiElement); } } return(str); }
protected virtual CsiXmlElement GetItem(string name) { IEnumerator enumerator = this.GetListItems().GetEnumerator(); while (enumerator.MoveNext()) { CsiXmlElement current = (CsiXmlElement)enumerator.Current; CsiXmlElement impl2 = (CsiXmlElement)current.FindChildByName("__name"); if ((impl2 != null) && name.Equals(impl2.GetElementValue())) { return(current); } } return(null); }
protected internal virtual CsiXmlElement GetItem(int index) { IEnumerator enumerator = this.GetListItems().GetEnumerator(); int num = 0; while (enumerator.MoveNext()) { CsiXmlElement current = enumerator.Current as CsiXmlElement; if (num++ == index) { return(current); } } return(null); }
public virtual long GetCount() { long num = 0L; IEnumerator enumerator = this.GetAllChildren().GetEnumerator(); while (enumerator.MoveNext()) { CsiXmlElement current = enumerator.Current as CsiXmlElement; if (current.GetDomElement().NodeType == XmlNodeType.Element) { num += 1L; } } return(num); }
public static string GetFirstTextNodeValue(CsiXmlElement csiElement) { string str = string.Empty; if (csiElement != null) { for (XmlNode node = csiElement.GetDomElement().FirstChild; node != null; node = node.NextSibling) { if ((node.NodeType == XmlNodeType.Text) || (node.NodeType == XmlNodeType.CDATA)) { str = node.Value; } } } return(str); }
public static ICsiXmlElement FindCreateSetValue(ICsiXmlElement sourceElement, string tagName, string val, bool isCdata = false) { CsiXmlElement impl = (CsiXmlElement)sourceElement.FindChildByName(tagName); if (impl == null) { impl = new CsiXmlElement(sourceElement.GetOwnerDocument(), tagName, sourceElement); } if (!(!isCdata || StringUtil.IsEmptyString(val))) { SetCdataNode(impl.GetDomElement(), val); return(impl); } SetTextNode(impl.GetDomElement(), val); return(impl); }
public ICsiXmlElement AppendChild(ICsiXmlElement child) { CsiXmlElement impl = (CsiXmlElement)child; try { if (this.mDOMElement.OwnerDocument == impl.GetDomElement().OwnerDocument) { this.mDOMElement.AppendChild(impl.GetDomElement()); } } catch (Exception exception) { throw new Exceptions.CsiClientException(-1L, exception, base.GetType().FullName + ".appendChild()"); } return(child); }
public ICsiRequestField RequestListItemByIndex(int index, string fieldName, string cdoTypeName) { if (index < 0) { string src = base.GetType().FullName + ".requestListItemByIndex()"; throw new CsiClientException(0x2e001aL, src); } CsiXmlElement parent = null; IEnumerator enumerator = base.GetChildrenByName("__listItem").GetEnumerator(); while (enumerator.MoveNext()) { parent = enumerator.Current as CsiXmlElement; if (int.Parse(parent.GetAttribute("__index")) == index) { break; } parent = null; } if (parent == null) { parent = new CsiXmlElement(this.GetOwnerDocument(), "__listItem", this); parent.SetAttribute("__index", Convert.ToString(index)); } CsiXmlElement child = parent; if (!StringUtil.IsEmptyString(fieldName) && (fieldName != null)) { child = base.FindChildByName(fieldName) as CsiXmlElement; if (child != null) { base.RemoveChild(child); } child = new CsiRequestField(this.GetOwnerDocument(), fieldName, parent); parent.AppendChild(child); } return(child as ICsiRequestField); }
protected ICsiRequestField RequestForField(string fieldName) { CsiRequestField child = null; string[] stringList = StringUtil.GetStringList(fieldName, '.'); CsiXmlElement parent = this; for (int i = 0; i < stringList.Length; i++) { XmlElement requestField = this.GetElement(parent.GetDomElement(), stringList[i]); if (requestField != null) { child = new CsiRequestField(this.GetOwnerDocument(), requestField); } else { child = new CsiRequestField(this.GetOwnerDocument(), stringList[i], parent); parent.AppendChild(child); } parent = child; } return(child); }
public virtual void RequestAllFieldsRecursive() { ICsiXmlElement element = new CsiXmlElement(this.GetOwnerDocument(), "__allFields", this); element.SetAttribute("__recursive", "true"); }
public virtual Array GetUserDefinedFields() { CsiXmlElement impl = base.FindChildByName("__userDefinedFields") as CsiXmlElement; return(impl?.GetAllChildren(false)); }
public virtual string GetRef() { CsiXmlElement csiElement = base.FindChildByName("__name") as CsiXmlElement; return(CsiXmlHelper.GetFirstTextNodeValue(csiElement)); }