public void DeleteToDo(string input) { int index = Int32.Parse(input); ThingToDo deleteRecord = repo.db.toDoes.FirstOrDefault(t => t.Id == index); repo.Delete(deleteRecord); }
public async Task <ActionResult <ThingToDo> > PostThingToDo(ThingToDo thingToDo) { _context.ThingsToDo.Add(thingToDo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetThingToDo", new { id = thingToDo.Id }, thingToDo)); }
public async Task <IActionResult> PutThingToDo(int id, ThingToDo thingToDo) { //if (id != thingToDo.Id) //{ // return BadRequest(); //} thingToDo.Id = id; _context.Entry(thingToDo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThingToDoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IEnumerator loseGame(LevelDevil l, ThingToDo ignoredThing) { logger.log(0f, "lost!"); gameRunning = false; updateValence("TETRAZZO INFERNO", currentColor = badColor); nextThing = runLevel; //this might eventually lead to a stack overflow but no one should be playing more than one game of this anyway yield return(null); }
public void CheckToDo(string input) { int index = Int32.Parse(input); ThingToDo updatingThisRecord = repo.db.toDoes.FirstOrDefault(t => t.Id == index); updatingThisRecord.IsDone = updatingThisRecord.IsDone ? false : true; repo.Update(updatingThisRecord); }
public IEnumerator winGame(LevelDevil l, ThingToDo ignoredThing) { gameRunning = false; if (score == maxScore) { updateValence("PERFECT PARADISE", currentColor = Color.white); } yield return(null); }
public void AddToDo(string descirption, int priority) { ThingToDo toDo = new ThingToDo() { Description = descirption, Priority = priority, IsDone = false }; repo.Create(toDo); }
public void AddToDo(string descirption, int priority) { ThingToDo toDo = new ThingToDo() { Description = descirption, Priority = priority, IsDone = true }; thingsToDo.Add(toDo); SortThingsToDo(); }
public IEnumerator runLevel(LevelDevil l, ThingToDo ignoredThing) { gameRunning = true; updateValence("TETRAZZO PARADISO", currentColor = goodColor); linesRemaining = lineTarget; nextThing = blocker.startBlock; gridder.clearGrid(); blocker.reset(gridder.grid_height); score = 0; maxScore = 0; while (gameRunning) { speed = 1 + (int)((((float)(lineTarget - linesRemaining) / (float)lineTarget)) * 10f); logger.log(3f, "next step: {0}", nextThing.Method); yield return(StartCoroutine(nextThing(this, loseGame))); if (linesRemaining <= 0) { nextThing = winGame; } } }
public IEnumerator cleanupRows(LevelDevil level, ThingToDo nextThing) { logger.log(1f, "cleanupRow"); int completeRows = 0; nextThing = level.blocker.startBlock; for (int r = 0; r < grid_height; r = r + 1) { if (checkRowCompletion(r)) { completeRows += 1; grid[r].clear(); } int targetRow = r + completeRows; while (targetRow > r && (targetRow < grid_height) && grid[targetRow].filledCells != 0) { if (checkRowCompletion(targetRow)) { completeRows += 1; grid[targetRow].clear(); targetRow = r + completeRows; continue; } logger.log(3f, "swap rows: {0} and {1}", r, targetRow); swapRows(r, targetRow); break; } } level.processClearedLines(completeRows); level.nextThing = nextThing; yield return(null); }
public static void DoTheThing(ThingToDo thingToDo, bool playOption, bool playlistOption, bool skipBackup) { if (thingToDo == ThingToDo.Null) { throw new Exception("No option was selected of Disable, Remove, or Hide."); } if (!playOption && !playlistOption) { throw new Exception("No option was selected of \"Play with VLC media player\" or \"Add to VLC media player's Playlist\"."); } bool isElevated; WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator); if (!isElevated) { throw new Exception("This program must be run as an administrator."); } if (!skipBackup) { BackupRegistry(); } //Matches strings that begin with VLC then . then some sequence of non-whitespace characters //This includes all VLC.<filename extension> as well as extras like VLC.CDAudio const string VLC_FILE_TYPE_KEY_REGEX = @"VLC\.\S+"; string[] classSubkeysNotOtherwiseMatched = new string[] { "Directory" }; const string SHELL_KEY_NAME = "shell"; const string PLAY_KEY_NAME = "PlayWithVLC"; const string PLAYLIST_KEY_NAME = "AddToPlaylistVLC"; //reference: http://www.howtogeek.com/howto/windows-vista/how-to-clean-up-your-messy-windows-context-menu/ const string DISABLE_MAGIC_WORD = "LegacyDisable"; const string HIDE_MAGIC_WORD = "Extended"; foreach (string subKeyName in Registry.ClassesRoot.GetSubKeyNames()) { if (Regex.Match(subKeyName, VLC_FILE_TYPE_KEY_REGEX).Value == string.Empty && !classSubkeysNotOtherwiseMatched.Contains(subKeyName)) //did not match { continue; } RegistryKey vlcFileTypeKey = Registry.ClassesRoot.OpenSubKey(subKeyName, true); RegistryKey shellKey = vlcFileTypeKey.OpenSubKey(SHELL_KEY_NAME, true); if (shellKey == null) { continue; } //The next section is a little boiler-platey, but I don't anticipate it will //require much expansion. if (thingToDo == ThingToDo.Remove) { if (playOption && shellKey.GetSubKeyNames().Contains(PLAY_KEY_NAME)) { shellKey.DeleteSubKeyTree(PLAY_KEY_NAME); } if (playlistOption && shellKey.GetSubKeyNames().Contains(PLAYLIST_KEY_NAME)) { shellKey.DeleteSubKeyTree(PLAYLIST_KEY_NAME); } continue; } if (thingToDo == ThingToDo.Undo) { if (playOption) { RegistryKey playKey = shellKey.OpenSubKey(PLAY_KEY_NAME, true); if (playKey != null) { if (playKey.GetValue(DISABLE_MAGIC_WORD) != null) { playKey.DeleteValue(DISABLE_MAGIC_WORD); } if (playKey.GetValue(HIDE_MAGIC_WORD) != null) { playKey.DeleteValue(HIDE_MAGIC_WORD); } } } if (playlistOption) { RegistryKey playlistKey = shellKey.OpenSubKey(PLAYLIST_KEY_NAME, true); if (playlistKey != null) { if (playlistKey.GetValue(DISABLE_MAGIC_WORD) != null) { playlistKey.DeleteValue(DISABLE_MAGIC_WORD); } if (playlistKey.GetValue(HIDE_MAGIC_WORD) != null) { playlistKey.DeleteValue(HIDE_MAGIC_WORD); } } } continue; } string magicWordToAdd = string.Empty; string magicWordToRemove = string.Empty; //if present if (thingToDo == ThingToDo.Disable) { magicWordToAdd = DISABLE_MAGIC_WORD; magicWordToRemove = HIDE_MAGIC_WORD; } else if (thingToDo == ThingToDo.Hide) { magicWordToAdd = HIDE_MAGIC_WORD; magicWordToRemove = DISABLE_MAGIC_WORD; } if (magicWordToAdd == string.Empty) { throw new Exception("Expected a magic word, but somehow the options failed to produce one."); //shouldn't be possible, but who knows. } if (playOption) { RegistryKey playKey = shellKey.OpenSubKey(PLAY_KEY_NAME, true); if (playKey != null) { playKey.SetValue(magicWordToAdd, string.Empty, RegistryValueKind.String); if (playKey.GetValue(magicWordToRemove) != null) { playKey.DeleteValue(magicWordToRemove); } } } if (playlistOption) { RegistryKey playlistKey = shellKey.OpenSubKey(PLAYLIST_KEY_NAME, true); if (playlistKey != null) { playlistKey.SetValue(magicWordToAdd, string.Empty, RegistryValueKind.String); if (playlistKey.GetValue(magicWordToRemove) != null) { playlistKey.DeleteValue(magicWordToRemove); } } } } }
public IEnumerator startBlock(LevelDevil level, ThingToDo nextThing) { yield return(new WaitForFixedUpdate()); GameObject block = makeBlock(3, spawnOffset, blockColors[nextSpawnRow]); float dropRate; bool vertical = true; Vector3 newPosition; int leftRightMove; GameObject top = getBlockParent(getBlockParent(getBlockParent(block))); GridDevil gridder = level.gridder; InputDevil player = level.player; nextSpawnRow = (nextSpawnRow + 1) % gridder.grid_width; nextSpawnOffset.x = nextSpawnRow; while (gridder.checkRange(top.transform.position, 4, vertical ? Vector3.up : Vector3.right)) { dropRate = regularDropRate * level.speed; if (player.checkOngoing(Signals.DROP)) { dropRate += fastDropRate; } dropRate = Mathf.Clamp(dropRate, .1f, maxDropRate); top.transform.Translate(0f, -dropRate, 0f); if (player.checkStarting(Signals.ROTATE) && (gridder.checkRange(top.transform.position, 4, !vertical ? Vector3.up : Vector3.right))) { if (doAcrossChain(tryRotateChain, block)) { level.logger.log(2.5f, "rotate worked"); vertical = !vertical; } } yield return(null); leftRightMove = 0; if (player.checkStarting(Signals.RIGHT)) { ++leftRightMove; } if (player.checkStarting(Signals.LEFT)) { --leftRightMove; } if (leftRightMove == 0) { continue; } newPosition = top.transform.position; newPosition.x += leftRightMove; newPosition.y += 0.6f; if (gridder.checkRange(newPosition, 4, vertical ? Vector3.up : Vector3.right)) { top.transform.Translate(leftRightMove, 0f, 0f); } } if (doAcrossChain(gridder.fixBlock, block)) { nextThing = gridder.cleanupRows; } level.nextThing = nextThing; yield return(null); }
public void RemoveThing(ThingToDo thingToRemove) { ThingsToDo.Remove(thingToRemove); }