예제 #1
0
파일: Plug.cs 프로젝트: bjorg/DReAM
 /// <summary>
 /// Manually remove a plug endpoint from the handler pool.
 /// </summary>
 /// <param name="endpoint">Factory instance to remove.</param>
 public static void RemoveEndpoint(IPlugEndpoint endpoint) {
     lock(_endpoints) {
         _endpoints.Remove(endpoint);
     }
 }
예제 #2
0
파일: Plug.cs 프로젝트: bjorg/DReAM
        private static int FindPlugEndpoint(XUri uri, out IPlugEndpoint match, out XUri normalizedUri) {
            match = null;
            normalizedUri = null;

            // determine which plug factory has the best match
            int maxScore = 0;
            lock(_endpoints) {

                // loop over all plug factories to determine best transport mechanism
                foreach(IPlugEndpoint factory in _endpoints) {
                    XUri newNormalizedUri;
                    int score = factory.GetScoreWithNormalizedUri(uri, out newNormalizedUri);
                    if(score > maxScore) {
                        maxScore = score;
                        normalizedUri = newNormalizedUri;
                        match = factory;
                    }
                }
            }
            return maxScore;
        }
예제 #3
0
파일: Plug.cs 프로젝트: bjorg/DReAM
 /// <summary>
 /// Manually add a plug endpoint for handling invocations.
 /// </summary>
 /// <param name="endpoint">Factory instance to add.</param>
 public static void AddEndpoint(IPlugEndpoint endpoint) {
     lock(_endpoints) {
         _endpoints.Add(endpoint);
     }
 }