public ActionResult DeleteConfirmed(int id) { LaunchEntry launchEntry = db.Launches.Find(id); db.Launches.Remove(launchEntry); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,LaunchInfo,PostedByUserName")] LaunchEntry launchEntry) { launchEntry.PostedByUserName = this.User.Identity.Name; if (ModelState.IsValid) { db.Entry(launchEntry).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(launchEntry)); }
public ActionResult Create([Bind(Include = "Id,LaunchInfo,PostedByUserName")] LaunchEntry launchEntry) { launchEntry.PostedByUserName = this.User.Identity.Name; if (ModelState.IsValid) { db.Launches.Add(launchEntry); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(launchEntry)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LaunchEntry launchEntry = db.Launches.Find(id); if (launchEntry == null) { return(HttpNotFound()); } return(View(launchEntry)); }
private static void GenerateChildren(TreeNode current, LaunchEntry entry) { foreach (LaunchEntry child in entry.Children) { if (child.IsGroup) { TreeNode group = new TreeNode(child.Name); current.Nodes.Add(group); GenerateChildren(group, child); continue; } TreeNode item = new TreeNode(child.Name) { Tag = child }; current.Nodes.Add(item); } }
private LaunchEntry CreateEntry(string imagefile) { if (!File.Exists(imagefile)) { return(null); } string directory = Path.GetDirectoryName(imagefile); string imagefileWithException = Path.GetFileNameWithoutExtension(imagefile); var debugFile = Path.Combine(directory, imagefileWithException + ".debug"); var breakpointFile = Path.Combine(directory, imagefileWithException + ".breakpoints"); var watchFile = Path.Combine(directory, imagefileWithException + ".watches"); if (!File.Exists(debugFile)) { debugFile = null; } if (!File.Exists(breakpointFile)) { breakpointFile = null; } if (!File.Exists(watchFile)) { watchFile = null; } var entry = new LaunchEntry() { ImageFile = imagefile, DebugFile = debugFile, WatchFile = watchFile, BreakpointFile = breakpointFile }; return(entry); }
private void FindFiles() { var allowedExtensions = Settings.Instance.AllowedExtensions; var disallowedPathFragments = Settings.Instance.DisallowedPathFragments.ToArray(); foreach (var basePath in config.SearchPaths) { var searchPaths = new Queue<string>(); searchPaths.Enqueue(basePath); while (searchPaths.Count > 0) { var path = searchPaths.Dequeue(); string[] entries = null; //Debug.Print(path); try { entries = Directory.GetFileSystemEntries(path); } catch { // XXX: Log exception! continue; } foreach (var dirent in entries) { if (disallowedPathFragments.Any(s => dirent.Contains(s))) continue; if (Directory.Exists(dirent)) { searchPaths.Enqueue(dirent); continue; } else { var ext = Path.GetExtension(dirent).ToLowerInvariant(); if (allowedExtensions.Contains(ext)) { var namePath = Path.GetFileNameWithoutExtension(dirent); // .Replace(basePath, "") var le = new LaunchEntry {FullPath = dirent, NamePath = namePath}; foundFiles.Add(le); } } } } } }
private void Launch(LaunchEntry entry) { MainForm.LaunchImage(entry.ImageFile, entry.DebugFile, entry.BreakpointFile, entry.WatchFile); }
public ScoredSearchResult(LaunchEntry entry, int score, IEnumerable<int> highlightPositions) { Entry = entry; Score = score; HighlightPositions = highlightPositions != null ? highlightPositions.ToArray() : new int[0]{}; }