/// <summary>
        /// Opens channel for reading. Channel must be created by process running without app container and it must be visible from all user sessions.
        /// </summary>
        /// <param name="name">Channel name.</param>
        /// <returns>
        /// OperationResult with InboundChannel and OperationStatus.Completed, OperationStatus.ObjectAlreadyInUse (when channel is already in use by another reader),
        /// OperationStatus.ObjectDoesNotExist or OperationStatus.AccessDenied
        /// </returns>
        public static OperationResult <InboundChannel> OpenInboundGlobalNoncontainerized(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.Length == 0)
            {
                throw new ArgumentException("Channel name required to find shared memory channel");
            }

            return(InboundChannel.Open(LifecycleHelper.GlobalVisibilityPrefix + "\\" + name, name));
        }
Beispiel #2
0
        /// <summary>
        /// Opens channel for reading. Channel must be created by process running in app container and it must be visible only from current user session.
        /// </summary>
        /// <param name="name">Channel name.</param>
        /// <param name="sid">SID of the app container of the process that created this channel.</param>
        /// <returns>
        /// OperationResult with InboundChannel and OperationStatus.Completed, OperationStatus.ObjectAlreadyInUse (when channel is already in use by another writer),
        /// OperationStatus.ObjectDoesNotExist or OperationStatus.AccessDenied
        /// </returns>
        public static OperationResult <InboundChannel> OpenInboundLocalContainerized(string name, string sid)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.Length == 0)
            {
                throw new ArgumentException("Channel name required to find shared memory channel");
            }

            if (sid == null)
            {
                throw new ArgumentNullException(nameof(sid));
            }

            if (sid.Length == 0)
            {
                throw new ArgumentException("Container's security identifier cannot be empty string");
            }

            return(InboundChannel.Open($"{LifecycleHelper.LocalVisibilityPrefix}\\AppContainerNamedObjects\\{sid}\\{name}", name));
        }