Exemple #1
0
 internal static string GetPipeName(Uri uri)
 {
     string[] strArray   = new string[] { "+", uri.Host, "*" };
     bool[]   flagArray2 = new bool[2];
     flagArray2[0] = true;
     bool[] flagArray = flagArray2;
     for (int i = 0; i < strArray.Length; i++)
     {
         for (int j = 0; j < flagArray.Length; j++)
         {
             for (string str = PipeUri.GetPath(uri); str.Length > 0; str = PipeUri.GetParentPath(str))
             {
                 string sharedMemoryName = PipeUri.BuildSharedMemoryName(strArray[i], str, flagArray[j]);
                 try
                 {
                     PipeSharedMemory memory = PipeSharedMemory.Open(sharedMemoryName, uri);
                     if (memory != null)
                     {
                         try
                         {
                             string pipeName = memory.PipeName;
                             if (pipeName != null)
                             {
                                 return(pipeName);
                             }
                         }
                         finally
                         {
                             memory.Dispose();
                         }
                     }
                 }
                 catch (AddressAccessDeniedException exception)
                 {
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new EndpointNotFoundException(System.ServiceModel.SR.GetString("EndpointNotFound", new object[] { uri.AbsoluteUri }), exception));
                 }
             }
         }
     }
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new EndpointNotFoundException(System.ServiceModel.SR.GetString("EndpointNotFound", new object[] { uri.AbsoluteUri }), new PipeException(System.ServiceModel.SR.GetString("PipeEndpointNotFound", new object[] { uri.AbsoluteUri }))));
 }