当前位置: 首页>>代码示例>>C#>>正文


C# Ipc.IpcClientChannel类代码示例

本文整理汇总了C#中System.Runtime.Remoting.Channels.Ipc.IpcClientChannel的典型用法代码示例。如果您正苦于以下问题:C# IpcClientChannel类的具体用法?C# IpcClientChannel怎么用?C# IpcClientChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IpcClientChannel类属于System.Runtime.Remoting.Channels.Ipc命名空间,在下文中一共展示了IpcClientChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        /// <summary>
        /// Start connection with specified engine interface
        /// </summary>
        /// <param name="typeEngineInterface">Type of engine interface</param>
        /// <param name="urlClient">Asscoiated URL</param>
        /// <param name="ensureSecurity">Remoting security attribute</param>
        public void Start(string urlClient, bool ensureSecurity, uint timeOut, Type iProxyType)
        {
            Trace.TraceInformation("Configuring client connection");

            _ensureSecurity = ensureSecurity;

            #if MONO
            _sinkProvider = new BinaryClientFormatterSinkProvider();
            #endif

            IDictionary t = new Hashtable();
            t.Add("timeout", timeOut);
            t.Add("name", urlClient);

            Console.WriteLine("New IPC channel");

            // need to make ChannelNames unique so need to use this
            // constructor even though we dont care about the sink provider
            _channel = new IpcClientChannel(urlClient, _sinkProvider);

            Console.WriteLine("\tRegister");

            ChannelServices.RegisterChannel(_channel, _ensureSecurity);

            Console.WriteLine("\tActivate object proxy to IEngine");

            _base = (IBase)Activator.GetObject(iProxyType, urlClient);

            Console.WriteLine("\tActivated.");
        }
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:36,代码来源:RemotingConnectionIpc.cs

示例2: VisualStudioInstance

        public VisualStudioInstance(Process process, DTE dte)
        {
            _hostProcess = process;
            _dte = dte;

            dte.ExecuteCommandAsync(VisualStudioCommandNames.VsStartServiceCommand).GetAwaiter().GetResult();

            _integrationServiceChannel = new IpcClientChannel($"IPC channel client for {_hostProcess.Id}", sinkProvider: null);
            ChannelServices.RegisterChannel(_integrationServiceChannel, ensureSecurity: true);

            // Connect to a 'well defined, shouldn't conflict' IPC channel
            var serviceUri = string.Format($"ipc://{IntegrationService.PortNameFormatString}", _hostProcess.Id);
            _integrationService = (IntegrationService)(Activator.GetObject(typeof(IntegrationService), $"{serviceUri}/{typeof(IntegrationService).FullName}"));
            _integrationService.Uri = serviceUri;

            // There is a lot of VS initialization code that goes on, so we want to wait for that to 'settle' before
            // we start executing any actual code.
            _integrationService.Execute(typeof(RemotingHelper), nameof(RemotingHelper.WaitForSystemIdle));

            _csharpInteractiveWindow = new Lazy<CSharpInteractiveWindow>(() => new CSharpInteractiveWindow(this));
            _editorWindow = new Lazy<EditorWindow>(() => new EditorWindow(this));
            _solutionExplorer = new Lazy<SolutionExplorer>(() => new SolutionExplorer(this));
            _workspace = new Lazy<Workspace>(() => new Workspace(this));

            // Ensure we are in a known 'good' state by cleaning up anything changed by the previous instance
            Cleanup();
        }
开发者ID:RoryVL,项目名称:roslyn,代码行数:27,代码来源:VisualStudioInstance.cs

示例3: GetMessager

		/// <summary>
		/// Gets an instance of a <see cref="Messager"/> to use to talk to the running instance of the client.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_gmdGameModeInfo">The descriptor of the game mode for which mods are being managed.</param>
		/// <returns>An instance of a <see cref="Messager"/> to use to talk to the running instance of the client,
		/// or <c>null</c> if no valid <see cref="Messager"/> could be created.</returns>
		public static IMessager GetMessager(EnvironmentInfo p_eifEnvironmentInfo, IGameModeDescriptor p_gmdGameModeInfo)
		{
			if (m_cchMessagerChannel == null)
			{
				System.Collections.IDictionary properties = new System.Collections.Hashtable();
				properties["exclusiveAddressUse"] = false;
				m_cchMessagerChannel = new IpcClientChannel();
				ChannelServices.RegisterChannel(m_cchMessagerChannel, true);
			}
			else
				throw new InvalidOperationException("The IPC Channel has already been created as a CLIENT.");

			string strMessagerUri = String.Format("ipc://{0}-{1}IpcServer/{1}Listener", p_eifEnvironmentInfo.Settings.ModManagerName, p_gmdGameModeInfo.ModeId);
			IMessager msgMessager = null;
			try
			{
				Trace.TraceInformation(String.Format("Getting listener on: {0}", strMessagerUri));
				msgMessager = (IMessager)Activator.GetObject(typeof(IMessager), strMessagerUri);

				//Just because a messager has been returned, dosn't mean it exists.
				//All you've really done at this point is create an object wrapper of type "Messager" which has the same methods, properties etc...
				//You wont know if you've got a real object, until you invoke something, hence the post (Power on self test) method.
				msgMessager.Post();
			}
			catch (RemotingException e)
			{
				Trace.TraceError("Could not get Messager: {0}", strMessagerUri);
				TraceUtil.TraceException(e);
				return null;
			}
			return new MessagerClient(msgMessager);
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:39,代码来源:MessagerClient.cs

示例4: PtAccClient

 /// <summary>
 /// Register remoting channel and types
 /// </summary>
 private PtAccClient()
 {
     IpcClientChannel clientChannel = new IpcClientChannel();
     ChannelServices.RegisterChannel(clientChannel, true);
     RemotingConfiguration.RegisterWellKnownClientType(typeof(PtAccRemoteType), "ipc://remote/PtAcc");
     _remoteType = new PtAccRemoteType();
 }
开发者ID:Raggles,项目名称:HC.PtAcc,代码行数:10,代码来源:PtAccClient.cs

示例5: Send

        public static void Send(Program.AppMessage msg, int lParam,
            bool bWaitWithTimeout)
        {
            if(!KeePassLib.Native.NativeLib.IsUnix()) // Windows
            {
                if(bWaitWithTimeout)
                {
                    IntPtr pResult = new IntPtr(0);
                    NativeMethods.SendMessageTimeout((IntPtr)NativeMethods.HWND_BROADCAST,
                        Program.ApplicationMessage, (IntPtr)msg,
                        (IntPtr)lParam, NativeMethods.SMTO_ABORTIFHUNG, 5000, ref pResult);
                }
                else
                    NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST,
                        Program.ApplicationMessage, (IntPtr)msg, (IntPtr)lParam);
            }
            else // Unix
            {
                if(m_chClient == null)
                {
                    m_chClient = new IpcClientChannel();
                    ChannelServices.RegisterChannel(m_chClient, false);
                }

                try
                {
                    IpcBroadcastSingleton ipc = (Activator.GetObject(typeof(
                        IpcBroadcastSingleton), "ipc://" + GetPortName() + "/" +
                        IpcObjectName) as IpcBroadcastSingleton);
                    if(ipc != null) ipc.Call((int)msg, lParam);
                }
                catch(Exception) { } // Server might not exist
            }
        }
开发者ID:elitak,项目名称:keepass,代码行数:34,代码来源:IpcBroadcast.cs

示例6: Main

		public static void Main (string [] args)
		{
			IpcClientChannel channel = new IpcClientChannel ();
			ChannelServices.RegisterChannel (channel, false);
			IFoo foo = (IFoo) Activator.GetObject (typeof (IFoo), "ipc://Foo/Foo");
			foo.Foo ();
		}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:client.cs

示例7: RegisterProxy

        /// <summary>
        /// Register the ipc client proxy
        /// </summary>
        internal void RegisterProxy()
        {
            try
            {
                string uri = "ipc://NetOffice.SampleChannel/NetOffice.WebTranslationService.DataService";

                //Create an IPC client channel.
                _channel = new IpcClientChannel();

                //Register the channel with ChannelServices.
                ChannelServices.RegisterChannel(_channel, true);

                //Register the client type.
                WellKnownClientTypeEntry[] entries = RemotingConfiguration.GetRegisteredWellKnownClientTypes();
                if (null == GetEntry(entries, uri))
                {
                    RemotingConfiguration.RegisterWellKnownClientType(
                                        typeof(WebTranslationService),
                                        uri);
                }
                DataService = new WebTranslationService();

                // try to do some action to see the server is alive
                string[] dumy = DataService.AvailableTranslations;
            }
            catch (RemotingException exception)
            {
                // rethrow the exception with a friendly message
                throw new RemotingException("Unable to connect the local translation service.", exception);
            }
            catch (Exception)
            {
                throw;
            }
        }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:38,代码来源:TranslationClient.cs

示例8: Bug81653

		public void Bug81653 ()
		{
			IpcClientChannel c = new IpcClientChannel ();
			ChannelDataStore cd = new ChannelDataStore (new string[] { "foo" });
			string objectUri;
			c.CreateMessageSink (null, cd, out objectUri);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:IpcChannelTest.cs

示例9: MonitorVdmClient

 public MonitorVdmClient()
 {
     // Set up communication with the virtual desktop monitoring server.
     _channel = new IpcClientChannel();
     ChannelServices.RegisterChannel( _channel, false );
     _monitorVdm = (IMonitorVdmService)Activator.GetObject( typeof( IMonitorVdmService ), "ipc://VirtualDesktopManagerAPI/MonitorVdmService" );
 }
开发者ID:Whathecode,项目名称:ABC,代码行数:7,代码来源:MonitorVdmClient.cs

示例10: ChromePersistence

 public ChromePersistence()
     : base("chrome", "Google Inc.")
 {
     // Set up communication with the Chrome ABC extension.
     _channel = new IpcClientChannel();
     ChannelServices.RegisterChannel( _channel, false );
     _chromeService = (IChromeAbcService)Activator.GetObject( typeof( IChromeAbcService ), "ipc://ChromeAbcConnection/ChromeAbcService" );
 }
开发者ID:Whathecode,项目名称:ABC,代码行数:8,代码来源:ChromePersistence.cs

示例11: CreateClientChannel

        private static void CreateClientChannel(String arg)
        {
            IpcClientChannel channel = new IpcClientChannel();
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownClientType(typeof(Ipc), "ipc://" + ipcPortName + "/" + ipcServername);

            Ipc ipc = new Ipc();
            ipc.OpenFile(arg);
        }
开发者ID:Traderain,项目名称:coldemoplayer,代码行数:9,代码来源:Program.cs

示例12: Main

        static void Main(string[] args)
        {
            if (args == null)
                throw new ArgumentNullException("args");

            if (args.Length != 1)
                throw new ArgumentException("Arguments number doesn't match!", "args");

            var name = args[0];

            if (string.IsNullOrEmpty(name))
                throw new Exception("Name cannot be null or empty.");

            name = name.Trim('"');

            var channelPort = string.Format(ProcessAppConst.PortNameTemplate, name, Process.GetCurrentProcess().Id);

            var currentDomain = AppDomain.CurrentDomain;
            var root = Path.Combine(Path.Combine(currentDomain.BaseDirectory, ProcessAppConst.WorkingDir), name);

            //Hack to change the default AppDomain's root
            if (NDockEnv.IsMono) //for Mono
            {
                var pro = typeof(AppDomain).GetProperty("SetupInformationNoCopy", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
                var setupInfo = (AppDomainSetup)pro.GetValue(currentDomain, null);
                setupInfo.ApplicationBase = root;
            }
            else // for .NET
            {
                currentDomain.SetData("APPBASE", root);
            }

            currentDomain.SetData(typeof(IsolationMode).Name, IsolationMode.Process);

            try
            {
                var serverChannel = new IpcServerChannel("IpcAgent", channelPort, new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full });
                var clientChannel = new IpcClientChannel();
                ChannelServices.RegisterChannel(serverChannel, false);
                ChannelServices.RegisterChannel(clientChannel, false);
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(ManagedAppWorker), ProcessAppConst.WorkerRemoteName, WellKnownObjectMode.Singleton);

                Console.WriteLine("Ok");

                var line = Console.ReadLine();

                while (!"quit".Equals(line, StringComparison.OrdinalIgnoreCase))
                {
                    line = Console.ReadLine();
                }
            }
            catch
            {
                Console.Write("Failed");
            }
        }
开发者ID:huoxudong125,项目名称:NDock,代码行数:56,代码来源:Program.cs

示例13: Sounds

        static Sounds()
        {
            //クライアントのチャンネルを生成
            IpcClientChannel channel = new IpcClientChannel();
            //チャンネルを登録
            ChannelServices.RegisterChannel(channel, true);

            //リモートオブジェクトの取得
            midObject = Activator.GetObject(typeof(IPCSound), "ipc://HoppoAlphaSound/SoundData") as IPCSound;
        }
开发者ID:CoRelaxuma,项目名称:HoppoAlpha,代码行数:10,代码来源:Sounds.cs

示例14: IpcClient

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public IpcClient()
        {
            // クライアントチャンネルの生成
            IpcClientChannel channel = new IpcClientChannel();

            // チャンネルを登録
            ChannelServices.RegisterChannel(channel, true);

            // リモートオブジェクトを取得
            RemoteObject = Activator.GetObject(typeof(IpcRemoteObj), "ipc://" + IpcRemoteObj.ipcAddr + "/" + IpcRemoteObj.ipcAddrCom) as IpcRemoteObj;
        }
开发者ID:terakenxx,项目名称:TukubaChallenge,代码行数:14,代码来源:IpcRemoteObj.cs

示例15: IpcClientTransportSink

 internal IpcClientTransportSink(string channelURI, IpcClientChannel channel)
 {
     string str;
     this.portCache = new ConnectionCache();
     this._tokenImpersonationLevel = TokenImpersonationLevel.Identification;
     this._timeout = 0x3e8;
     this._channel = channel;
     string str2 = IpcChannelHelper.ParseURL(channelURI, out str);
     int startIndex = str2.IndexOf("://") + 3;
     this._portName = str2.Substring(startIndex);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:IpcClientTransportSink.cs


注:本文中的System.Runtime.Remoting.Channels.Ipc.IpcClientChannel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。