//Awake is called before Start() void Awake() { //Get a component reference to ShowPanels attached to this object, store in showPanels variable showPanels = GetComponent<ShowPanels>(); //Get a component reference to StartButton attached to this object, store in startScript variable startScript = GetComponent<StartOptions>(); }
public void ParametersCanSerializeBetweenDomainsWithDifferentHostingAssemblies() { // var applicationBase = Path.GetDirectoryName(typeof(StartParametersTests).Assembly.Location); string applicationBase = Directory.GetCurrentDirectory(); var info = new AppDomainSetup { ApplicationBase = applicationBase, PrivateBinPath = "bin", PrivateBinPathProbe = "*", ConfigurationFile = Path.Combine(applicationBase, "web.config") }; AppDomain domain = AppDomain.CreateDomain("Test", null, info); try { var target = (SimpleTarget)domain.CreateInstanceFromAndUnwrap( typeof(SimpleTarget).Assembly.Location, typeof(SimpleTarget).FullName); target.LoadWhenNeeded(applicationBase); StartOptions options = new StartOptions("alpha://localhost/beta") { AppStartup = "x", }; options.Settings.Add("1", "2"); string result = target.PassParameters(options); result.ShouldBe("alpha://localhost/betax2"); } finally { AppDomain.Unload(domain); } }
// Use this for initialization void Start () { mySprites = (Sprite[])Resources.LoadAll<Sprite>("worldsprites"); showPanels = GetComponent<ShowPanels>(); startoptions = GetComponent<StartOptions>(); }
/// <summary> /// Create a new StartContext with the given options. /// If the given options do not define any settings, then settings will be loaded from the config. /// </summary> /// <param name="options"></param> public StartContext(StartOptions options) { if (options == null) { throw new ArgumentNullException("options"); } SettingsLoader.LoadFromConfig(options.Settings); Options = options; EnvironmentData = new List<KeyValuePair<string, object>>(); }
public void LoadOptionsFromFile_CaseInsensitive() { var options = new StartOptions(); SettingsLoader.LoadFromSettingsFile("Settings.txt", options.Settings); IDictionary<string, string> settings = options.Settings; string value; Assert.True(settings.TryGetValue("UpperCase", out value)); Assert.True(string.Equals("UpperCaseValue", value, StringComparison.Ordinal)); Assert.True(settings.TryGetValue("uppercase", out value)); Assert.True(string.Equals("UpperCaseValue", value, StringComparison.Ordinal)); }
public virtual IDisposable Start(StartOptions options) { StartContext context = new StartContext(options); IServiceProvider services = ServicesFactory.Create(context.Options.Settings); IHostingEngine engine = services.GetService<IHostingEngine>(); IDisposable disposable = engine.Start(context); return new Disposable(disposable.Dispose); }
public virtual void Start(StartOptions options) { var context = new StartContext(options); IServiceProvider services = ServicesFactory.Create(context.Options.Settings); var engine = services.GetService<IHostingEngine>(); _runningApp = engine.Start(context); _lease = (ILease)RemotingServices.GetLifetimeService(this); _lease.Register(this); }
public virtual IDisposable Start(StartOptions options) { if (options == null) { throw new ArgumentNullException("options"); } string directory; if (!options.Settings.TryGetValue("directory", out directory) || string.IsNullOrWhiteSpace(directory)) { directory = Directory.GetCurrentDirectory(); // If there are no /bin/ subdirs, and the current directory is called /bin/, move the current directory up one. // This fixes the case where a web app was run by katana.exe from the wrong directory. var directoryInfo = new DirectoryInfo(directory); if (directoryInfo.GetDirectories() .Where(subDirInfo => subDirInfo.Name.Equals("bin", StringComparison.OrdinalIgnoreCase)).Count() == 0 && directoryInfo.Name.Equals("bin", StringComparison.OrdinalIgnoreCase)) { directory = directoryInfo.Parent.FullName; } } string privateBin; if (options.Settings.TryGetValue("privatebin", out privateBin) && !string.IsNullOrWhiteSpace(privateBin)) { privateBin = "bin;" + privateBin; } else { privateBin = "bin"; } var info = new AppDomainSetup { ApplicationBase = directory, PrivateBinPath = privateBin, PrivateBinPathProbe = "*", ConfigurationFile = Path.Combine(directory, "web.config") }; AppDomain domain = AppDomain.CreateDomain("OWIN", null, info); DomainHostingStarterAgent agent = CreateAgent(domain); agent.ResolveAssembliesFromDirectory(AppDomain.CurrentDomain.SetupInformation.ApplicationBase); return agent.Start(options); }
/// <summary> /// Determines the which IHostingStarter instance to use via the IHostingSterterFactory. /// </summary> /// <param name="options"></param> /// <returns></returns> public virtual IDisposable Start(StartOptions options) { if (options == null) { throw new ArgumentNullException("options"); } string boot; options.Settings.TryGetValue("boot", out boot); IHostingStarter hostingStarter = _hostingStarterFactory.Create(boot); return hostingStarter.Start(options); }
static IDisposable StartOwinHost(IBus bus) { string baseUrl = "http://localhost:12345/"; StartOptions startOptions = new StartOptions(baseUrl) { ServerFactory = "Microsoft.Owin.Host.HttpListener", }; return WebApp.Start(startOptions, builder => { builder.UseCors(CorsOptions.AllowAll); MapToBus(builder, bus); MapToMsmq(builder); }); }
private void Form1_Load(object sender, EventArgs e) { try { char[] delimeter = { ';' }; string[] urls = ConfigurationManager.AppSettings[Urls].Split(delimeter); _options = new StartOptions(); foreach (var url in urls) { _options.Urls.Add(url); } _server = WebApp.Start <Startup>(_options); //service.Start(); } catch (Exception exp) { LogManager.CurrentInstance.ErrorLogger.LogError( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exp.Message, exp, System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public static void Main(string[] args) { var eventStore = new JsonFileEventStore("ExampleEvents.zip", 100); var store = new InMemorySqLiteDatabaseBuilder().Build(); var dispatcher = new Dispatcher(eventStore.Subscribe); var projector = new CountsProjector(dispatcher, store.SessionFactory.OpenSession); var startOptions = new StartOptions($"http://localhost:9000"); using (WebApp.Start(startOptions, builder => builder.UseStatisticsApi(() => store.SessionFactory.OpenSession()))) { projector.Start(); Console.WriteLine($"HTTP endpoint available at http://localhost:9000/api/Statistics/CountsPerState"); Console.ReadLine(); } }
public void Start() { log.Info("Starting api polling service..."); DeployStatusState.Instance.Value.Start(deployConfiguration); var webAppUrl = deployConfiguration.WebAppUrl; log.Info($"Starting web app service on {webAppUrl}..."); var startOptions = new StartOptions(); foreach (var url in webAppUrl.Split(',')) { startOptions.Urls.Add(url); } webApp = WebApp.Start <Startup>(startOptions); log.Info("Started."); }
static void Main(string[] args) { var rOptions = new StartOptions(); rOptions.Urls.Add("http://+:81"); var host = WebApp.Start <Ticketmaster.Dsc.WebRepository.OwinStartup>(rOptions); var options = new StartOptions(); options.Urls.Add("http://+:80/"); var dscOptions = Ticketmaster.Dsc.DscManager.OwinStartup.GetDscManagerOptions(); dscOptions.UseHangfireJobServer = true; dscOptions.UseSlackLogging = false; using (var app = WebApp.Start <OwinStartup>(options)) { Console.WriteLine("Launching website..."); Console.ReadLine(); host.Dispose(); } }
private static string GetDisplayUrl(StartOptions options) { IList <string> urls = options.Urls; if (urls.Count > 0) { return("urls: " + string.Join(", ", urls)); } int port; string message = "port: "; if (!HostingEngine.TryDetermineCustomPort(options, out port)) { port = HostingEngine.DefaultPort; message = "the default " + message; } return(message + port + " (http://localhost:" + port + "/)"); }
static void Main(string[] args) { //Microsoft.Owin.Hosting // Includere anche // per evitare: // The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener const string baseUrl = "http://localhost:5000/"; StartOptions options = new StartOptions(); options.Urls.Add(baseUrl); using (WebApp.Start <Startup>(options)) { Console.WriteLine("...Microsoft.Owin.Hosting..."); Console.WriteLine("...Microsoft.Owin.Host.HttpListener..."); Console.WriteLine("Press Enter to quit."); Console.ReadKey(); } }
public bool Start() { if (IsRunning) { return(false); } var options = new StartOptions { ServerFactory = "Nowin", Port = Port }; Startup.Content = content; host = WebApp.Start <Startup>(options); IsRunning = true; return(true); }
/// <summary> /// Start the component /// </summary> public void Start() { this.AssertBackendAddressIsValid(); var services = (ServiceProvider)ServicesFactory.Create(); var options = new StartOptions() { Urls = { this.configuration.BackendAddress }, AppStartup = typeof(Startup).FullName }; // Pass through the IJobbrServiceProvider to allow Startup-Classes to let them inject this dependency services.Add(typeof(IJobbrServiceProvider), () => this.dependencyResolver); var hostingStarter = services.GetService <IHostingStarter>(); this.webHost = hostingStarter.Start(options); Logger.InfoFormat($"Started OWIN-Host for WebAPI at '{this.configuration.BackendAddress}'."); }
private static string DetermineApplicationName(StartContext context) { StartOptions options = context.Options; IDictionary <string, string> settings = context.Options.Settings; if (options != null && !string.IsNullOrWhiteSpace(options.AppStartup)) { return(options.AppStartup); } string appName; if (settings.TryGetValue(Constants.SettingsOwinAppStartup, out appName) && !string.IsNullOrWhiteSpace(appName)) { return(appName); } return(null); }
private static void Main(string[] args) { var port = ConfigurationManager.AppSettings["Port"]; var options = new StartOptions($"http://*:{port}") { ServerFactory = "Microsoft.Owin.Host.HttpListener" }; // Start OWIN host using (WebApp.Start <Startup>(options)) { foreach (var url in options.Urls) { Console.WriteLine($"Service listening on {url}"); } Console.ReadLine(); } }
public bool Start(HostControl hctrl) { Log.Debug("Rhino system directory: {Path}", RhinoInside.Resolver.RhinoSystemDirectory); Log.Information("Launching RhinoCore library as {User}", Environment.UserName); Program.RhinoCore = new Rhino.Runtime.InProcess.RhinoCore(null, Rhino.Runtime.InProcess.WindowStyle.NoWindow); Rhino.Runtime.HostUtils.OnExceptionReport += (source, ex) => { Log.Error(ex, "An exception occured while processing request"); if (Config.Debug) { Logging.LogExceptionData(ex); } }; StartOptions options = new StartOptions(); foreach (var url in _bind) { options.Urls.Add(url); } Log.Information("Starting listener(s): {Urls}", _bind); // start listener and unpack HttpListenerException if thrown // (missing urlacl or lack of permissions) try { _host = WebApp.Start <Startup>(options); } catch (TargetInvocationException ex) when(ex.InnerException is HttpListenerException hle) { throw hle; } catch { throw; } Log.Information("Listening on {Urls}", _bind); return(true); }
public void Start() { Log.Information("Launching RhinoCore library as {User}", Environment.UserName); Program.RhinoCore = new Rhino.Runtime.InProcess.RhinoCore(null, Rhino.Runtime.InProcess.WindowStyle.NoWindow); StartOptions options = new StartOptions(); foreach (var url in _bind) { options.Urls.Add(url); } // disable built-in owin tracing by using a null traceoutput // otherwise we get some of rhino's diagnostic traces showing up options.Settings.Add( typeof(Microsoft.Owin.Hosting.Tracing.ITraceOutputFactory).FullName, typeof(NullTraceOutputFactory).AssemblyQualifiedName); Log.Information("Starting listener(s): {Urls}", _bind); // start listener and unpack HttpListenerException if thrown // (missing urlacl or lack of permissions) try { _host = WebApp.Start <Startup>(options); } catch (TargetInvocationException ex) { if (ex.InnerException is HttpListenerException hle) { throw hle; // TODO: add link to troubleshooting } throw ex; } catch { throw; } Log.Information("Listening on {Urls}", _bind); }
private int RunWebServerViaEngine(string serverName, string applicationName, string configFileName, bool https) { int port = GetAvailablePort(https); string scheme = https ? "https" : "http"; string sourceDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string targetDirectory = BuildTargetDirectory( sourceDirectory, configFileName, applicationName, scheme, port); Directory.SetCurrentDirectory(targetDirectory); StartOptions options = new StartOptions(scheme + "://localhost:" + port + "/") { ServerFactory = serverName, AppStartup = applicationName, }; options.Settings["boot"] = "Domain"; IDisposable server = WebApp.Start(options); _disposing.Token.Register(() => { server.Dispose(); try { Directory.Delete(targetDirectory, true); } catch (Exception ex) { Trace.WriteLine(string.Format("Cleanup error {0}", ex.Message)); } }); return(port); }
static void Main(string[] args) { string baseAddress = "http://localhost:9000/"; StartOptions options = new StartOptions(); options.Urls.Add("http://localhost:9000"); options.Urls.Add("http://10.1.0.115:9000"); options.Urls.Add(string.Format("http://{0}:9000", Environment.MachineName)); // Start OWIN host using (WebApp.Start <Startup>(options)) { // Create HttpCient and make a request to api/values HttpClient client = new HttpClient(); var response = client.GetAsync(baseAddress + "api/upload").Result; Console.ReadLine(); } }
public static void Main() { var baseAddress = "https://*:9001/"; var so = new StartOptions(baseAddress); using (WebApp.Start(so, appBuilder => { var config = new HttpConfiguration(); config.Routes.MapHttpRoute("default", "api/{controller}/{action}"); appBuilder.Use <ClientCertificateAuthMiddleware>(new ClientCertificateAuthenticationOptions(), new DefaultClientCertificateValidator()); //appBuilder.Use<ClientCertificateAuthorizationMiddleware>(); appBuilder.UseWebApi(config); })) { WriteLine("Listenning to " + baseAddress); WriteLine("Press RETURN to exit"); ReadLine(); } }
static void Main(string[] args) { XmlConfigurator.Configure(new FileInfo("log4net.config")); StartOptions options = new StartOptions(); options.Urls.Add("http://localhost:4004"); options.Urls.Add("http://127.0.0.1:4004"); options.Urls.Add(string.Format("http://{0}:4004", Environment.MachineName)); options.Urls.Add("http://+:4004"); options.Urls.Add("http://localhost:80"); options.Urls.Add("http://127.0.0.1:80"); options.Urls.Add(string.Format("http://{0}:80", Environment.MachineName)); options.Urls.Add("http://+:80"); WebApp.Start <Startup>(options); while (true) { Console.ReadLine(); } }
private void StartWeb() { StartOptions options = new StartOptions(); options.Urls.Add("http://localhost:8080"); //options.Urls.Add("http://192.168.2.53:8080"); options.Urls.Add("http://+:8080"); var server = WebApp.Start <Startup>(options); //keep webserver alive. Task.Factory.StartNew(() => { while (true) { //Console.WriteLine(string.Format("Server running at {0}", url)); // Console.ReadLine(); Thread.Sleep(1); } }); }
private static void Main() { string baseAddress = "http://localhost:9000/"; StartOptions options = new StartOptions(baseAddress) { ServerFactory = "Microsoft.Owin.Host.HttpListener" }; options.Urls.Add("http://localhost:9000"); options.Urls.Add("http://127.0.0.1:9000"); //options.Urls.Add(string.Format("http://{0}:9000", Environment.MachineName)); using (WebApp.Start <Startup>(options)) { Console.WriteLine("Betting API service started..."); Console.WriteLine("Available services: "); Console.WriteLine("http://localhost:9000/Api/BettingRisk/Customer/Api/BettingRisk/Customer"); Console.WriteLine("http://localhost:9000/Api/BettingRisk/Customer/Api/BettingRisk/UnsettledBet"); Console.WriteLine("Press enter to shutdown the service"); Console.ReadLine(); } }
static void Main(string[] args) { StartOptions startOptions = new StartOptions(); startOptions.Urls.Add("http://+:8090"); try { using (WebApp.Start <Startup>(startOptions)) { Logger.Log.InfoFormat("Started host!!!"); Console.ReadKey(); Logger.Log.Debug("SHUT DOWN!"); } } catch (Exception ex) { Logger.LogException(ex, "Crashed!"); } Console.Read(); }
/// <summary> /// 开始用owin做容器提供web api /// </summary> public static IDisposable InitHosting() { IDisposable service = null; try { StartOptions options = new StartOptions(); options.Urls.Add("http://localhost:" + ConfigHelper.ApiPort); options.Urls.Add("http://127.0.0.1:" + ConfigHelper.ApiPort); options.Urls.Add(string.Format("http://{0}:" + ConfigHelper.ApiPort, Environment.MachineName)); ConfigHelper.ApiIpAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(p => p.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToString(); options.Urls.Add(string.Format("http://{0}:" + ConfigHelper.ApiPort, ConfigHelper.ApiIpAddress)); service = WebApp.Start <StartUp>(options); System.Diagnostics.Debug.WriteLine(options.ToString() + "就绪"); } catch (Exception er) { Common.Logging.LogManager.GetLogger <HostingHelper>().Error(er); } return(service); }
static void Main(string[] args) { Console.Title = "SignalR服务程序"; StartOptions options = new StartOptions { Urls = { "http://192.168.1.2:4421/" } }; using (WebApp.Start <Startup>(options))//启动服务,访问路径在这里配置。 { Console.WriteLine("SignalR服务启动中..."); Console.WriteLine("服务启动成功! " + DateTime.Now); foreach (string url in options.Urls) { Console.WriteLine("服务地址:" + url); } Console.WriteLine("=================================\r\n"); Console.ReadLine(); } }
public async Task <bool> Start(Intent intent, StartOptions options = StartOptions.None, int repeatCount = -1, InUser?user = null, CancellationToken cancellationToken = default(CancellationToken)) { string optionsString = string.Empty; if ((options & StartOptions.EnableDebugging) != 0) { optionsString += " -D"; } if ((options & StartOptions.WaitForLaunchComplete) != 0) { optionsString += " -W"; } if ((options & StartOptions.ForceStop) != 0) { optionsString += " -S"; } var output = await new Adb(this, "start {0} {1} {2}", optionsString, GetUserString(user), intent.ToString()).RunAsync(cancellationToken: cancellationToken).ConfigureAwait(false); return(!output.Contains("Error:")); }
public static void StartServer() { //todo C:\<Path\To\Solution>\.vs\config\applicationhost.config const string baseAddress = "http://*:8008/"; var options = new StartOptions(baseAddress) { ServerFactory = "Microsoft.Owin.Host.HttpListener" }; using (WebApp.Start <Startup>(options)) { Console.WriteLine("Server started"); // Create HttpCient and make a request to api/values : just a test var client = new HttpClient(); var response = client.GetAsync(baseAddress.Replace("*", "localhost") + "api/values").Result; Console.WriteLine(response); Console.WriteLine(response.Content.ReadAsStringAsync().Result); RunAuthenticationSample(); Console.ReadLine(); } }
static void Main(string[] args) { var options = new StartOptions(); foreach (var url in AppSettings.HostUrls) { RegisterHostUrl(url, AppSettings.HostDefaultPort, options.Urls); } if (AppSettings.HostAutoRegisterIp) { RegisterLocalIpAsHostUrl(AppSettings.HostDefaultPort, options.Urls); } using (WebApp.Start <Startup>(options)) { Console.WriteLine("Running on {0}", string.Join(" || ", options.Urls)); Console.WriteLine("Press enter to exit"); Console.ReadLine(); } }
public Boolean Start(LogViewerConfiguration config) { try { _serverAddressList = config .ServerAddressList.Split(',') .ToList(); BuildContainer(config); ContainerAccessor.Instance = _container; if (_logger.IsDebugEnabled) { _logger.Debug("Log viewer starting"); } _container.Install(new ApiInstaller()); var url = new MongoUrl(config.MongoDbConnection); var client = new MongoClient(url); var mongoDb = client.GetServer().GetDatabase(url.DatabaseName); _container.Register(Component.For <MongoDatabase>().Instance(mongoDb)); _container.Register( Component.For <MongoCollection>().Instance(mongoDb.GetCollection(config.MongoDbDefaultCollectionLog))); StartOptions options = new StartOptions(); foreach (var address in _serverAddressList) { options.Urls.Add(address); } _webApplication = WebApp.Start <LogViewerApplication>(options); _logger.InfoFormat("Started server @ {0}", _serverAddressList.Aggregate((s1, s2) => s1 + ", " + s2)); } catch (Exception ex) { Console.Error.WriteLine("Exception: " + ex.ToString()); Console.Error.WriteLine("Press a key to continue"); Console.ReadKey(); throw; } return(true); }
public Task Init(string name, IProviderRuntime providerRuntime, IProviderConfiguration config) { this.g_Logger = providerRuntime.GetLogger(name); this.Name = name; var m_StartOptions = new StartOptions { ServerFactory = "Nowin", Port = config.Properties.ContainsKey("Port") ? int.Parse(config.Properties["Port"]) : 9186, }; #region 生成Swagger文档 GenerationDocProvider.CreationAssemblyMethodCache("Orleans.UniteExtension.Framework.Interfaces.dll"); GenerationDocProvider.GenerationDocument(string.Empty); #endregion this.OwinHost = WebApp.Start(m_StartOptions, app => new OwinServiceStartup(null).Configure(app)); return(Task.CompletedTask); }
private void startServer(IList <RouteBase> routes, string physicalPath, int port) { var parameters = new StartOptions { Port = port }; parameters.Urls.Add("http://*:" + port); //for netsh http add urlacl FubuMvcPackageFacility.PhysicalRootPath = physicalPath ?? AppDomain.CurrentDomain.BaseDirectory; Action <IAppBuilder> startup = FubuOwinHost.ToStartup(routes); var context = new StartContext(parameters) { Startup = startup }; var engine = new HostingEngine(new AppBuilderFactory(), new TraceOutputFactory(), new AppLoader(new IAppLoaderFactory[0]), new ServerFactoryLoader(new ServerFactoryActivator(new ServiceProvider()))); _server = engine.Start(context); }
private void InvokeStart(StartOptions start) { var password = new SecureString(); if (start.Password != null) { foreach (char c in start.Password) { password.AppendChar(c); } } var process = Process.Start(start.FileName, start.Arguments, start.UserName, password, start.Domain); HelpView.Message(ErrorInfo.Info($"Started {start.FileName}.")).Render(); if (process == null) { return; } switch (start.Operation) { case StartOperation.WaitForExit: process.WaitForExit(); break; case StartOperation.WaitForIdle: process.WaitForInputIdle(); break; case StartOperation.Kill: process.Kill(); break; case StartOperation.DisplayFullName: HelpView.Message(ErrorInfo.Info(process.MainModule.FileName)).Render(); break; } }
public static StartOptions CreateOptions(int port) { var options = new StartOptions(); options.Urls.Add(string.Format("http://{0}:{1}", "localhost", port)); var ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); if (ipHostInfo != null) { options.Urls.Add(string.Format("http://{0}:{1}", ipHostInfo.HostName, port)); foreach (var address in ipHostInfo.AddressList) { if (address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6) { options.Urls.Add(string.Format("http://{0}:{1}", address, port)); } } } return(options); }
void Start() { script = masterUI.gameObject.GetComponent <StartOptions>(); stsc = masterUI.GetComponent <StartOptions>(); qa = masterUI.GetComponent <QuitApplication>(); sp = masterUI.GetComponent <ShowPanels>(); Quit = quit.GetComponent <Button>(); unhighlighted.normalColor = Color.white; unhighlighted.highlightedColor = Color.red; unhighlighted.pressedColor = Color.white; unhighlighted.selectedColor = Color.white; unhighlighted.disabledColor = Color.white; hightlighted.normalColor = Color.red; hightlighted.highlightedColor = Color.red; hightlighted.pressedColor = Color.white; hightlighted.selectedColor = Color.white; hightlighted.disabledColor = Color.white; }
private void Awake() { showPanels = GetComponent<ShowPanels>(); startScript = GetComponent<StartOptions>(); }
public string PassParameters(StartOptions options) { return options.Urls[0] + options.AppStartup + options.Settings["1"]; }
//Call this function and pass in the float parameter musicLvl to set the volume of the AudioMixerGroup Music in mainMixer public void SetMultiplayer(float multiMode) { Debug.Log("multiMode = " + multiMode); startOptions = UI.GetComponent<StartOptions>(); startOptions.multiplayerMode = multiMode; }
/// <summary> /// Tries to determine a custom port setting from the startup options or the port environment variable. /// </summary> /// <param name="options">The OWIN application startup options.</param> /// <param name="port">The port number.</param> /// <returns>True if a valid custom port was set, false if not.</returns> public static bool TryDetermineCustomPort(StartOptions options, out int port) { string portString; if (options != null) { if (options.Port.HasValue) { port = options.Port.Value; return true; } IDictionary<string, string> settings = options.Settings; if (settings == null || !settings.TryGetValue(Constants.SettingsPort, out portString)) { portString = GetPortEnvironmentVariable(); } } else { portString = GetPortEnvironmentVariable(); } return int.TryParse(portString, NumberStyles.Integer, CultureInfo.InvariantCulture, out port); }
/// <summary> /// Executes the IHostingEngine without making any changes to the current execution environment. /// </summary> /// <param name="options"></param> /// <returns></returns> public virtual IDisposable Start(StartOptions options) { return _engine.Start(new StartContext(options)); }
public IDisposable Start(StartOptions options) { throw new NotImplementedException(); }
// Use this for initialization void Start() { UI = GameObject.FindGameObjectWithTag("UI"); score = GameObject.FindGameObjectsWithTag("Score").Length; firstPlayerRespawn = GameObject.FindGameObjectWithTag("firstPlayerRespawn"); secondPlayerRespawn = GameObject.FindGameObjectWithTag("secondPlayerRespawn"); mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); firstPlayerLastCheckpoint = firstPlayerRespawn; secondPlayerLastCheckpoint = secondPlayerRespawn; startOptions = UI.GetComponent<StartOptions>(); isMultiplayer = false; if(levelNumber > 1) { CreatePlayers(startOptions.multiplayerMode); } }
public void MultipleUrlsSpecified() { StartOptions startOptions = new StartOptions(); startOptions.Urls.Add("beta://localhost:3333"); startOptions.Urls.Add("delta://foo/"); startOptions.Urls.Add("gama://*:4444/"); startOptions.Port = 1111; // Ignored because of Url(s) var serverFactory = new ServerFactoryAlpha(); var startInfo = new StartContext(startOptions); startInfo.ServerFactory = new ServerFactoryAdapter(serverFactory); startInfo.App = new AppFunc(env => TaskHelpers.Completed()); var engine = ServicesFactory.Create().GetService<IHostingEngine>(); serverFactory.InitializeCalled.ShouldBe(false); serverFactory.CreateCalled.ShouldBe(false); IDisposable server = engine.Start(startInfo); serverFactory.InitializeProperties["host.Addresses"].ShouldBeTypeOf<IList<IDictionary<string, object>>>(); var addresses = (IList<IDictionary<string, object>>)serverFactory.InitializeProperties["host.Addresses"]; Assert.Equal(3, addresses.Count); string[][] expectedAddresses = new[] { new[] { "beta", "localhost", "3333", string.Empty }, new[] { "delta", "foo", string.Empty, "/" }, new[] { "gama", "*", "4444", "/" }, }; for (int i = 0; i < addresses.Count; i++) { var addressDictionary = addresses[i]; var expectedValues = expectedAddresses[i]; Assert.Equal(expectedValues.Length, addressDictionary.Count); Assert.Equal(expectedValues[0], (string)addressDictionary["scheme"]); Assert.Equal(expectedValues[1], (string)addressDictionary["host"]); Assert.Equal(expectedValues[2], (string)addressDictionary["port"]); Assert.Equal(expectedValues[3], (string)addressDictionary["path"]); } server.Dispose(); }
// Use this for initialization void Start() { m_GameUI = GameObject.Find ("UI"); m_startOptions = m_GameUI.GetComponent<StartOptions> (); }
void Awake() { //Get a reference to ShowPanels attached to UI object showPanels = GetComponent<ShowPanels> (); //Get a reference to PlayMusic attached to UI object playMusic = GetComponent<PlayMusic> (); dontDestroy = GetComponent<DontDestroy> (); //Check if there is an existing instance of this object if((instance) && (instance.GetInstanceID() != GetInstanceID())) DestroyImmediate(gameObject); //Delete duplicate else { instance = this; //Make this object the only instance DontDestroyOnLoad (gameObject); //Set as do not destroy } }