/// <summary> /// Gets the item id. /// </summary> /// <param name="name">The name of the item.</param> private string GetItemId(string name) { string methodName = "IOPCHDA_Browser.GetItemID"; string itemId = null; try { IOPCHDA_Browser server = BeginComCall <IOPCHDA_Browser>(methodName, true); server.GetItemID(name, out itemId); } catch (Exception e) { ComCallError(methodName, e); return(null); } finally { EndComCall(methodName); } return(itemId); }
private ArrayList FetchElements(EnumString enumerator, int maxElements, bool isBranch) { ArrayList arrayList = new ArrayList(); while (arrayList.Count < maxElements) { int num = 10; if (arrayList.Count + num > maxElements) { num = maxElements - arrayList.Count; } string[] array = enumerator.Next(num); if (array == null || array.Length == 0) { break; } string[] array2 = array; foreach (string text in array2) { BrowseElement browseElement = new BrowseElement(); browseElement.Name = text; browseElement.ItemPath = null; browseElement.HasChildren = isBranch; string pszItemID = null; try { if (isBranch) { pszItemID = GetFullBranchName(text); } else { m_browser.GetItemID(text, out pszItemID); } } catch { pszItemID = null; } browseElement.ItemName = pszItemID; arrayList.Add(browseElement); } } IdentifiedResult[] array3 = m_server.ValidateItems((ItemIdentifier[])arrayList.ToArray(typeof(ItemIdentifier))); if (array3 != null) { for (int j = 0; j < array3.Length; j++) { if (array3[j].ResultID.Succeeded()) { ((BrowseElement)arrayList[j]).IsItem = true; } } } return(arrayList); }