/// <summary>
        /// Parses the specified item id.
        /// </summary>
        /// <param name="server">The COM server that provided the item id.</param>
        /// <param name="configuration">The COM wrapper configuration.</param>
        /// <param name="itemId">The item id to parse.</param>
        /// <param name="browseName">The name of the item.</param>
        /// <returns>True if the item id could be parsed.</returns>
        public bool Parse(ComObject server, ComClientConfiguration configuration, string itemId, out string browseName)
        {
            browseName = null;

            if (configuration == null || itemId == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(configuration.SeperatorChars))
            {
                return(false);
            }

            for (int ii = 0; ii < configuration.SeperatorChars.Length; ii++)
            {
                int index = itemId.LastIndexOf(configuration.SeperatorChars[ii]);

                if (index >= 0)
                {
                    browseName = itemId.Substring(index + 1);
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
 /// <summary>
 /// Initializes the object with the ProgID of the server being accessed.
 /// </summary>
 public ComClient(ComClientConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     m_url = configuration.ServerUrl;
 }
示例#3
0
        /// <summary>
        /// Initializes the manager by creating the default instance.
        /// </summary>
        public void Initialize(
            ServerSystemContext context,
            ComClientConfiguration configuration,
            ComServerStatusState statusNode,
            object statusNodeLock,
            WaitCallback reconnectCallback)
        {
            m_defaultSystemContext = context;
            m_configuration        = configuration;
            m_statusNode           = statusNode;
            m_statusNodeLock       = statusNodeLock;
            m_statusUpdateInterval = m_configuration.MaxReconnectWait;
            m_reconnectCallback    = reconnectCallback;

            // limit status updates to once per 10 seconds.
            if (m_statusUpdateInterval < 10000)
            {
                m_statusUpdateInterval = 10000;
            }

            StartStatusTimer(OnStatusTimerExpired);
        }