本文整理汇总了C#中System.Runtime.Remoting.Channels.Ipc.IpcServerChannel类的典型用法代码示例。如果您正苦于以下问题:C# IpcServerChannel类的具体用法?C# IpcServerChannel怎么用?C# IpcServerChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IpcServerChannel类属于System.Runtime.Remoting.Channels.Ipc命名空间,在下文中一共展示了IpcServerChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main (string [] args)
{
IpcServerChannel channel = new IpcServerChannel ("Foo");
ChannelServices.RegisterChannel (channel, false);
RemotingConfiguration.RegisterWellKnownServiceType (typeof (Fooo), "Foo", WellKnownObjectMode.Singleton);
Console.ReadLine ();
}
示例2: Main
static void Main(string[] args)
{
if ((args.Length == 2) && (args[0].Equals("-iphonepackager")))
{
// We were run as a 'child' process, quit when our 'parent' process exits
// There is no parent-child relationship WRT windows, it's self-imposed.
int ParentPID = int.Parse(args[1]);
IpcServerChannel Channel = new IpcServerChannel("iPhonePackager");
ChannelServices.RegisterChannel(Channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentImplementation), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton);
Process ParentProcess = Process.GetProcessById(ParentPID);
while (!ParentProcess.HasExited)
{
System.Threading.Thread.Sleep(1000);
}
}
else
{
// Run directly by some intrepid explorer
Console.WriteLine("Note: This program should only be started by iPhonePackager");
Console.WriteLine(" This program cannot be used on it's own.");
DeploymentImplementation Deployer = new DeploymentImplementation();
var DeviceList = Deployer.EnumerateConnectedDevices();
foreach (var Device in DeviceList)
{
Console.WriteLine(" - Found device named {0} of type {1} with UDID {2}", Device.DeviceName, Device.DeviceType, Device.UDID);
}
Console.WriteLine("Exiting.");
}
}
示例3: EntryPoint
public EntryPoint(
EasyHook.RemoteHooking.IContext context,
String channelName,
CaptureConfig config)
{
// Get reference to IPC to host application
// Note: any methods called or events triggered against _interface will execute in the host process.
_interface = EasyHook.RemoteHooking.IpcConnectClient<CaptureInterface>(channelName);
// We try to ping immediately, if it fails then injection fails
_interface.Ping();
#region Allow client event handlers (bi-directional IPC)
// Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
System.Collections.IDictionary properties = new System.Collections.Hashtable();
properties["name"] = channelName;
properties["portName"] = channelName + Guid.NewGuid().ToString("N"); // random portName so no conflict with existing channels of channelName
System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider binaryProv = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider();
binaryProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
System.Runtime.Remoting.Channels.Ipc.IpcServerChannel _clientServerChannel = new System.Runtime.Remoting.Channels.Ipc.IpcServerChannel(properties, binaryProv);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_clientServerChannel, false);
#endregion
}
示例4: EyesarServer
protected EyesarServer(EyesarSharedObject sharedObject)
{
if (ChannelServices.RegisteredChannels.Any(channel => channel.ChannelName == "Eyesar"))
throw new InvalidOperationException();
_channel = new IpcServerChannel("Eyesar", "eyesar");
ChannelServices.RegisterChannel(_channel, false);
RemotingServices.Marshal(SharedObject = sharedObject, "shared", typeof (EyesarSharedObject));
}
示例5: PtAccServer
public PtAccServer()
{
// Create and register an IPC channel
serverChannel = new IpcServerChannel("remote");
ChannelServices.RegisterChannel(serverChannel, true);
// Expose an object
RemotingConfiguration.RegisterWellKnownServiceType(typeof(PtAccRemoteType), "PtAcc", WellKnownObjectMode.Singleton);
}
示例6: RegisterIpcChannel
public static void RegisterIpcChannel(EventHandler<NewInstanceDetectedEventArgs> handler)
{
IChannel ipcChannel = new IpcServerChannel(String.Format(CultureInfo.InvariantCulture, "hfm-{0}-{1}", Environment.UserName, AssemblyGuid));
ChannelServices.RegisterChannel(ipcChannel, false);
var obj = new IpcObject(handler);
RemotingServices.Marshal(obj, ObjectName);
}
示例7: Start
public static Server Start(ApplicationCore applicationCore)
{
var serverChannel = new IpcServerChannel("SassTray");
ChannelServices.RegisterChannel(serverChannel, true);
var server = new Server(applicationCore);
RemotingServices.Marshal(server, "Server", typeof(Server));
return server;
}
示例8: StartServer
static void StartServer(AssemblyService service, string name, string uri) {
var props = new Hashtable();
props["portName"] = name;
var provider = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
var channel = new IpcServerChannel(props, provider);
ChannelServices.RegisterChannel(channel, false);
RemotingServices.Marshal(service, uri);
}
示例9: 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");
}
}
示例10: ListenForLaunches
public void ListenForLaunches()
{
if (!IsFirstInstance)
{
throw new InvalidOperationException();
}
IpcServerChannel channel = new IpcServerChannel(ApplicationId);
ChannelServices.RegisterChannel(channel, true);
RemotingServices.Marshal(this, ApplicationId, typeof (IFirstInstanceServer));
}
示例11: ProcessBootstrap
static ProcessBootstrap()
{
// Create the channel.
var clientChannel = new IpcClientChannel();
// Register the channel.
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(clientChannel, false);
var serverChannel = new IpcServerChannel("Bootstrap", BootstrapIpcPort);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(serverChannel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(ProcessBootstrapProxy), "Bootstrap.rem", WellKnownObjectMode.Singleton);
}
示例12: HookProcess
public HookProcess(Process process, OverlayConfig overlayConfig, OverlayInterface overlayInterface)
{
if (HookManager.IsHooked(process.Id))
{
throw new ProcessAlreadyHookedException();
}
overlayInterface.ProcessID = process.Id;
OverlayInterface = overlayInterface;
Server = RemoteHooking.IpcCreateServer<OverlayInterface>(ref ChannelName, WellKnownObjectMode.Singleton, OverlayInterface);
try
{
var libraryName = typeof (OverlayInterface).Assembly.GetName()
.Name + ".dll";
var location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, libraryName);
RemoteHooking.Inject(process.Id, InjectionOptions.NoService | InjectionOptions.DoNotRequireStrongName, location, location, ChannelName, overlayConfig);
}
catch (Exception ex)
{
throw new InjectionFailedException(ex);
}
HookManager.AddHookedProcess(process.Id);
InjectedProcess = process;
}
示例13: Setup
public static void Setup()
{
// Reset the channel name.
ChannelName = null;
// Start an Ipc server for the DLL to connect to.
InjectionServer = RemoteHooking.IpcCreateServer<ChatInterface>(ref ChannelName, WellKnownObjectMode.Singleton);
}
示例14: FormMain_Load
private void FormMain_Load(object sender, EventArgs e)
{
channel = RemoteHooking.IpcCreateServer(
ref channelName,
WellKnownObjectMode.Singleton,
IpcInterface,
WellKnownSidType.WorldSid);
}
示例15: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
// Initialise the IPC server
ScreenshotServer = RemoteHooking.IpcCreateServer<ScreenshotInterface.ScreenshotInterface>(
ref ChannelName,
WellKnownObjectMode.Singleton);
ScreenshotManager.OnScreenshotDebugMessage += new ScreenshotDebugMessage(ScreenshotManager_OnScreenshotDebugMessage);
}