Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Drawing;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Serialization.Formatters;
using RxMouseService;
namespace RxMouseServer
{
partial class Program
{
const string SERVICENAME = "MouseService";
static IObserver<Point> Remoting(int port)
{
ConfigureRemoting(port);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MouseService), SERVICENAME, WellKnownObjectMode.Singleton);
var ms = (IMouseService)Activator.GetObject(typeof(IMouseService), string.Format("tcp://{0}:{1}/{2}", "localhost", port, SERVICENAME));
return (IObserver<Point>)ms;
}
private static void ConfigureRemoting(int port)
{
var serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
var clientProvider = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = port;
props["name"] = SERVICENAME;
props["typeFilterLevel"] = TypeFilterLevel.Full;
ChannelServices.RegisterChannel(new TcpChannel(props, clientProvider, serverProvider), false);
}
}
}