void onOptionsLoaded() { currentState = SceneState.MENU; OptionsHandler optionsHandler = GameController.FindObjectOfType <OptionsHandler>(); optionsHandler.startOptionsMenu(myPrefs, this); }
// Start is called before the first frame update void Start() { S = this; toggleMusicBackground = GameObject.FindGameObjectWithTag("ToggleMusicBackground").GetComponent <Toggle>(); print("toggleMusicBackground.isOn" + toggleMusicBackground.isOn); sliderVolume = GameObject.FindGameObjectWithTag("SliderVolume").GetComponent <Slider>(); print("sliderVolume.value=" + sliderVolume.value); clickCountTextGO.text = "ClickCount:" + clickCount.ToString(); }
private void Awake() { if (instace == null) { instace = this; } else if (instace != this) { Destroy(gameObject); } }
public OptionsHandlerTest() { var request = new Request { Method = "OPTIONS", Path = "/method_options", Version = "HTTP/1.1" }; var handler = new OptionsHandler(); _response = handler.Handle(request); }
public Handler CreateAndAttachHandlers() { var headHandler = new HeadHandler(); var optionsHandler = new OptionsHandler(); var fileHandler = new StaticFileHandler(); var controllerHandler = new ControllerHandler(); headHandler.SetSuccessor(optionsHandler); optionsHandler.SetSuccessor(fileHandler); fileHandler.SetSuccessor(controllerHandler); return headHandler; }
public static IHandler Build() { var okHandler = new OkHandler(); var putHandler = new PutHandler(); var notFoundHandler = new NotFoundHandler(putHandler); var methodIsSupportedHandler = new MethodIsSupportedHandler(okHandler); var resourceExistsHandler = new ResourceExistsHandler(methodIsSupportedHandler, notFoundHandler); var endpointExistsHandler = new EndpointExistsHandler(resourceExistsHandler); var optionsHandler = new OptionsHandler(endpointExistsHandler); var authorizationHandler = new AuthorizationHandler(optionsHandler); var authenticationHandler = new AuthenticationHandler(authorizationHandler); return authenticationHandler; }
public Handler CreateAndAttachHandlers() { var headHandler = new HeadHandler(); var optionsHandler = new OptionsHandler(); var fileHandler = new StaticFileHandler(); var controllerHandler = new ControllerHandler(); headHandler.SetSuccessor(optionsHandler); optionsHandler.SetSuccessor(fileHandler); fileHandler.SetSuccessor(controllerHandler); return(headHandler); }
private static void AddData(string timestamp, string method, string data) { switch (method) { case "GameState.DebugPrintPower": DataHandler.Handle(timestamp, data, State); break; case "GameState.SendChoices": SendChoicesHandler.Handle(timestamp, data, State); break; case "GameState.DebugPrintChoices": case "GameState.DebugPrintEntityChoices": ChoicesHandler.Handle(timestamp, data, State); break; case "GameState.DebugPrintEntitiesChosen": EntityChosenHandler.Handle(timestamp, data, State); break; case "GameState.DebugPrintOptions": OptionsHandler.Handle(timestamp, data, State); break; case "GameState.SendOption": SendOptionHandler.Handle(timestamp, data, State); break; case "GameState.OnEntityChoices": // Spectator mode noise break; case "ChoiceCardMgr.WaitThenShowChoices": // Not needed for replays break; case "GameState.DebugPrintChoice": Console.WriteLine("Warning: DebugPrintChoice was removed in 10357. Ignoring."); break; default: if (!method.StartsWith("PowerTaskList.") && !method.StartsWith("PowerProcessor.") && !method.StartsWith("PowerSpellController")) { Console.WriteLine("Warning: Unhandled method: " + method); } break; } }
internal CheckCommand( OptionsHandler handler) : base("check", DescriptionText) { AddAlias("c"); AddArgument(new SourceArgument()); Handler = CommandHandler.Create <string[]>(srcPaths => handler( new OptionArgs( new SourcePaths( srcPaths)))); }
private void CreateInfoPane(float x, float y) { GetGameObject(new Vector3(x, y), "infoPane", Resources.Load <Sprite>(SpritePaths.BigOptionInfoBox)); goBack = GetGoBackImage(x, y); goBack.SetActive(false); FontData font = PD.mostCommonFont.Clone(); font.scale = 0.06f; headerText = GetMeshText(new Vector3(x, y + 1.7f), "honk", font); font.scale = 0.035f; funFactText = GetMeshText(new Vector3(x, y + 1.0f), "honk", font); optionsScreen = gameObject.AddComponent <OptionsHandler>(); optionsScreen.InitializeMembers(headerText, PD); controlsScreen = gameObject.AddComponent <ControlsHandler>(); controlsScreen.InitializeMembers(headerText, PD); accessibilityScreen = gameObject.AddComponent <AccessibilityHandler>(); accessibilityScreen.InitializeMembers(headerText, PD); }
protected AbstractTransferImageFilesCommand( string name, string description, OptionsHandler handler) : base(name, description) { AddArgument(new SourceArgument()); AddArgument(new DestinationArgument()); AddOption(new DryRunOption()); AddOption(new KeepGoingOption()); AddOption(new SkipDateSubdirOption()); AddOption(new OverwriteOption()); Handler = CommandHandler.Create <string, string, bool, bool, bool, bool>( (srcPath, dstDir, dryRun, keepGoing, skipDateSubdir, overwrite) => handler( new OptionArgs( new SourcePath(srcPath), new DestinationDirectory(dstDir), new DryRun(dryRun), new KeepGoing(keepGoing), new SkipDateSubdirectory(skipDateSubdir), new Overwrite(overwrite)))); }
public void PrintOptions() { var cmd = Assembly.GetEntryAssembly().GetName().Name; var info = OptionsHandler.ExtractInfo(); var actions = info.SingleOrDefault(x => x.Definition.IsNameless); var arguments = info.Where(x => !x.Definition.IsNameless); PrintLine("PackDm (", Program.Version, ")"); PrintLine("Gerenciamento simplificado de dependências."); PrintLine("Por padrão os artefatos são baixados e publicados na URL:"); PrintLine(" ", Settings.DefaultSourceUri); PrintLine("a menos que configurado de outra forma no arquivo `pack.conf`."); PrintLine("Uso:"); PrintLine(" ", cmd, " AÇÕES [ OPÇÕES ]"); if (actions != null) { foreach (var line in actions.Description.TextLines) { PrintLine(line); } } var categories = from a in arguments group a by a.Definition.Category into category select new { Name = category.Key, Arguments = category }; foreach (var category in categories) { var name = string.IsNullOrWhiteSpace(category.Name) ? "Opções" : category.Name; PrintLine(name, ":"); foreach (var argument in category.Arguments) { Print(" --"); Print(argument.Definition.LongName); if (argument.Definition.ShortName != default(char)) { Print(", -"); Print(argument.Definition.ShortName); } if (argument.HasValue) { Print(" VALOR"); } PrintLine(); foreach (var line in argument.Description.TextLines) { PrintLine(" ", line); } } } PrintCopyright(); }
public static void Prefix(OptionsV11 options) { OptionsHandler.Push(options); }
public MoveCommand( OptionsHandler handler) : base("move", DescriptionText, handler) { AddAlias("mv"); }
public static void Prefix(SavedProfile __instance) { OptionsHandler.Pull(__instance); }
private static Options ParseOptions(string[] args) { return(OptionsHandler.Parse(args)); }
public CopyCommand( OptionsHandler handler) : base("copy", DescriptionText, handler) { AddAlias("cp"); }
private void HandleConnection(Socket sock) { NetworkStream stream = new NetworkStream(sock); string line = null; bool error = false; bool keepAlive = false; DateTime startTime = DateTime.Now; sock.ReceiveTimeout = RequestHandler.Timeout * 100; sock.Blocking = false; sock.NoDelay = true; sock.SendBufferSize = 16 * 1024; sock.UseOnlyOverlappedIO = true; string type = ""; string path = ""; do { bool first = true; RequestHandler handler = null; do { line = null; try { line = ReadLine(stream); BytesReadHeader += line.Length + 2; } catch (ThreadAbortException e) { keepAlive = false; error = true; break; } catch (IOException e) { keepAlive = false; error = true; break; } catch (Exception e) { keepAlive = false; error = true; break; } /* connection timed out or closed */ if (line == null) { sock.Close(); LogRequest(" (Socket closed)"); return; } if (first) { LogRequest(" (Connection from " + sock.RemoteEndPoint + ")"); } LogRequest("< " + line); /* not an empty line? */ if (line != "") { /* the first line contains the request */ if (first) { if (line.Contains(' ')) { type = line.Substring(0, line.IndexOf(' ')); path = line.Substring(line.IndexOf(' ')).Trim(); try { switch (type) { case "OPTIONS": handler = new OptionsHandler(this, path); break; case "PROPFIND": handler = new PropFindHandler(this, path); break; case "GET": handler = new GetHandler(this, path); break; case "HEAD": handler = new HeadHandler(this, path); break; case "PUT": handler = new PutHandler(this, path); break; case "LOCK": handler = new LockHandler(this, path); break; case "UNLOCK": handler = new UnlockHandler(this, path); break; case "DELETE": handler = new DeleteHandler(this, path); break; case "MOVE": handler = new MoveHandler(this, path); break; case "COPY": handler = new CopyHandler(this, path); break; case "MKCOL": handler = new MkColHandler(this, path); break; case "PROPPATCH": handler = new PropPatchHandler(this, path); break; default: handler = new RequestHandler(this, "/"); break; } } catch (IOException e) { Log("[i] Connection from " + sock.RemoteEndPoint + " (" + type + ") had IOException"); } catch (Exception e) { Log("[E] '" + e.GetType().ToString() + "' in connection from " + sock.RemoteEndPoint + " (" + type + ")"); } } first = false; } else { try { handler.AddHeaderLine(line); } catch (IOException e) { /* just close */ sock.Close(); LogRequest(" (Socket closed)"); return; } catch (Exception e) { Log("[E] '" + e.GetType().ToString() + "' in connection from " + sock.RemoteEndPoint + " (AddHeaderLine)"); } //stream.Flush(); } } } while (line != ""); if (handler == null) { Log("[E] Empty request in connection from " + sock.RemoteEndPoint + " (HandleContent/HandleRequest)"); handler.KeepAlive = false; return; } if (!error) { try { if (handler.RequestContentLength > 0) { handler.HandleContent(stream); } handler.HandleRequest(stream); stream.Flush(); } catch (FileNotFoundException e) { Log("[E] 404 '" + e.GetType().ToString() + ": " + e.Message + "' in connection from " + sock.RemoteEndPoint + " (HandleContent/HandleRequest)"); /* respond with error */ handler = new RequestHandler(this, "/"); handler.StatusCode = RequestHandler.GetStatusCode(404); handler.KeepAlive = false; handler.HandleRequest(stream); stream.Flush(); } catch (SocketException e) { Log("[E] '" + e.GetType().ToString() + ": " + e.Message + "' in connection from " + sock.RemoteEndPoint + " (HandleContent/HandleRequest)"); handler.KeepAlive = false; return; } catch (UnauthorizedAccessException e) { Log("[i] 403 '" + e.GetType().ToString() + ": " + e.Message + "' in connection from " + sock.RemoteEndPoint + " (HandleContent/HandleRequest)"); /* respond with error */ handler = new RequestHandler(this, "/"); handler.StatusCode = RequestHandler.GetStatusCode(403); handler.KeepAlive = false; handler.HandleRequest(stream); stream.Flush(); } catch (Exception e) { Log("[E] 500 '" + e.GetType().ToString() + ": " + e.Message + "' in connection from " + sock.RemoteEndPoint + " (HandleContent/HandleRequest)"); /* respond with error */ handler = new RequestHandler(this, "/"); handler.StatusCode = RequestHandler.GetStatusCode(500); handler.KeepAlive = false; handler.HandleRequest(stream); stream.Flush(); } if (EnableRequestLog) { DateTime endTime = DateTime.Now; Log("[i] Connection from " + sock.RemoteEndPoint + " (" + type + " " + path + ") took " + (endTime - startTime).TotalMilliseconds + " ms (" + handler.StatusCode + ")"); } LogRequest(""); lock (StatisticsLock) { BytesWrittenHeader += handler.BytesWrittenHeader; BytesWrittenData += handler.BytesWrittenData; BytesReadHeader += handler.BytesReadHeader; BytesReadData += handler.BytesReadData; } keepAlive = handler.KeepAlive; /* windows isnt really using keepalive :( */ keepAlive = false; } } while (keepAlive); sock.Close(); LogRequest(" (Socket closed)"); }
public OptionsHandlerTests() { _requestMediatorMock = new Mock <IConsoleMediator>(); _loggerMock = new Mock <ILogger <OptionsHandler> >(); _optionsHandler = new OptionsHandler(_requestMediatorMock.Object, _loggerMock.Object); }