コード例 #1
0
ファイル: LaunchController.cs プロジェクト: preethik-94/new
        public ActionResult DeleteConfirmed(int id)
        {
            LaunchEntry launchEntry = db.Launches.Find(id);

            db.Launches.Remove(launchEntry);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
ファイル: LaunchController.cs プロジェクト: preethik-94/new
        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));
        }
コード例 #3
0
ファイル: LaunchController.cs プロジェクト: preethik-94/new
        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));
        }
コード例 #4
0
ファイル: LaunchController.cs プロジェクト: preethik-94/new
        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));
        }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: DatabaseUpdater.cs プロジェクト: akx/lauo
        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);
                            }
                        }
                    }
                }
            }
        }
コード例 #8
0
 private void Launch(LaunchEntry entry)
 {
     MainForm.LaunchImage(entry.ImageFile, entry.DebugFile, entry.BreakpointFile, entry.WatchFile);
 }
コード例 #9
0
ファイル: ScoredSearchResult.cs プロジェクト: akx/lauo
 public ScoredSearchResult(LaunchEntry entry, int score, IEnumerable<int> highlightPositions)
 {
     Entry = entry;
     Score = score;
     HighlightPositions = highlightPositions != null ? highlightPositions.ToArray() : new int[0]{};
 }