public InstancePack CreateInstance(Netool.Logging.InstanceLogger logger, InstanceType type, object settings) { IInstance instance; if (settings == null) { throw new ArgumentNullException("settings"); } switch (type) { case InstanceType.Server: var s = settings as TcpServerSettings; if (s == null) { throw new InvalidSettingsTypeException(); } instance = new CalcServer(s); break; default: throw new NotImplementedException(); } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }
/// <inheritdoc/> public InstancePack CreateInstance(InstanceLogger logger, InstanceType type) { IInstance instance; switch (type) { case InstanceType.Server: instance = createServer(logger); break; case InstanceType.Client: instance = createClient(logger); break; default: instance = createProxy(logger); break; } if (instance == null) { throw new SetupAbortedByUserException(); } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, createChannelViewFactory()); view.SetController(cont); return(new InstancePack(view, cont, type)); }
/// <inheritdoc/> public InstancePack CreateInstance(InstanceLogger logger, InstanceType type) { IInstance instance; switch (type) { case InstanceType.Server: instance = createServer(); break; case InstanceType.Client: instance = createClient(); break; default: instance = createProxy(); break; } if (instance == null) { throw new SetupAbortedByUserException(); } // for now set manual driver to everything var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }
public InstancePack RestoreInstance(Netool.Logging.InstanceLogger logger) { var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, cont.GetInstanceType())); }
/// <inheritdoc/> public InstancePack RestoreInstance(InstanceLogger logger) { var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, logger, createChannelViewFactory(true)); view.SetController(cont); return(new InstancePack(view, cont, cont.GetInstanceType())); }
/// <inheritdoc/> public InstancePack CreateInstance(InstanceLogger logger, InstanceType type, object settings) { IInstance instance; if (settings == null) { throw new ArgumentNullException("settings"); } switch (type) { case InstanceType.Server: var s = settings as HttpServerSettings; if (s == null) { throw new InvalidSettingsTypeException(); } instance = new HttpServer(s, logger); break; case InstanceType.Client: var c = settings as HttpClientSettings; if (c == null) { throw new InvalidSettingsTypeException(); } instance = new HttpClient(c, logger); break; default: var p = settings as DefaultProxySettings; if (p == null) { throw new InvalidSettingsTypeException(); } var srv = p.Server as HttpServer; if (srv != null) { srv.SetLogger(logger); } var factory = p.ClientFactory as HttpClientFactory; if (factory != null) { factory.SetLogger(logger); } instance = new DefaultProxy(p); break; } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, createChannelViewFactory()); view.SetController(cont); return(new InstancePack(view, cont, type)); }
/// <inheritdoc/> public InstancePack CreateInstance(InstanceLogger logger, InstanceType type, object settings) { IInstance instance; if (settings == null) { throw new ArgumentNullException("settings"); } switch (type) { case InstanceType.Server: var s = settings as TcpServerSettings; if (s == null) { throw new InvalidSettingsTypeException(); } instance = new TcpServer(s); break; case InstanceType.Client: var c = settings as TcpClientSettings; if (c == null) { throw new InvalidSettingsTypeException(); } instance = new TcpClient(c); break; default: var p = settings as DefaultProxySettings; if (p == null) { throw new InvalidSettingsTypeException(); } instance = new DefaultProxy(p); break; } // for now set manual driver to everything var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }
public InstancePack CreateInstance(Netool.Logging.InstanceLogger logger, InstanceType type) { IInstance instance; switch (type) { case InstanceType.Server: instance = createServer(); break; default: throw new NotImplementedException(); } if (instance == null) { throw new SetupAbortedByUserException(); } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }