DirectoryAccess contains a number of static methods that manipulate directories. Directories can be created, deleted, moved, enumerated, and the like. Instances of the Directory object maintain directory state information and can be persisted.
コード例 #1
0
        public MediaPickerService()
        {
            IDirectory directory = new FoodMarkerPendingImageDirectory();

            _directoryAccess = new DirectoryAccess(directory);
            _index           = 1;
        }
コード例 #2
0
        public FoodMarkerPhotosFileSystemService(FoodMarker marker)
        {
            IDirectory directory = new FoodMarkerImageDirectory();

            _marker          = marker;
            _directoryAccess = new DirectoryAccess(directory);
            _path            = directory.GetDir();
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            DirectoryAccess directoryAccess = db.DirectoryAccesses.Find(id);

            db.DirectoryAccesses.Remove(directoryAccess);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "UserId,DirectoryId,AccessType,Permissions")] DirectoryAccess directoryAccess)
 {
     if (ModelState.IsValid)
     {
         db.Entry(directoryAccess).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DirectoryId = new SelectList(db.Directories, "Id", "Name", directoryAccess.DirectoryId);
     ViewBag.UserId      = new SelectList(db.Users, "Id", "Login", directoryAccess.UserId);
     return(View(directoryAccess));
 }
コード例 #5
0
        public void da_returns_files()
        {
            // arrange
            var location   = Assembly.GetExecutingAssembly().Location;
            var installDir = Path.GetDirectoryName(location);

            //act
            var files = DirectoryAccess.GetDirContent(installDir, "*");


            //assert
            Assert.NotEmpty(files);
        }
コード例 #6
0
        public int KphOpenDirectoryObject(DirectoryAccess access, ObjectAttributes objectAttributes)
        {
            byte *inData = stackalloc byte[0xc];
            int   directoryObjectHandle;

            *(int *)inData         = (int)&directoryObjectHandle;
            *(int *)(inData + 0x4) = (int)access;
            *(int *)(inData + 0x8) = (int)&objectAttributes;

            _fileHandle.IoControl(CtlCode(Control.KphOpenDirectoryObject), inData, 0xc, null, 0);

            return(directoryObjectHandle);
        }
コード例 #7
0
        // GET: DirectoryAccesses/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DirectoryAccess directoryAccess = db.DirectoryAccesses.Find(id);

            if (directoryAccess == null)
            {
                return(HttpNotFound());
            }
            return(View(directoryAccess));
        }
コード例 #8
0
        public void da_finds_files()
        {
            // arrange
            var fileStoreLocations = new FileStorageLocations();
            var fileStoreLocation  = fileStoreLocations.Locations.First();

            // act


            var files = DirectoryAccess.GetDirContent(fileStoreLocation.Location, fileStoreLocation.Filter);

            // assert
            Assert.NotEmpty(files);
            Assert.True(files.Count > 0);
        }
コード例 #9
0
        // GET: DirectoryAccesses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DirectoryAccess directoryAccess = db.DirectoryAccesses.Find(id);

            if (directoryAccess == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DirectoryId = new SelectList(db.Directories, "Id", "Name", directoryAccess.DirectoryId);
            ViewBag.UserId      = new SelectList(db.Users, "Id", "Login", directoryAccess.UserId);
            return(View(directoryAccess));
        }
コード例 #10
0
        public LogFileViewModel(IInputBox inputBox)
        {
            InputBox = inputBox;

            FileStoreLocations = FileStorageLocations.Create();



            OpenFileCommand = new DelegateCommand <FileInfo>(new Action <FileInfo>(fi =>
            {
                FileText = DirectoryAccess.GetFileContent(fi.FullName);

                this.OnDisplayPopupWindow(FileText);
                OnPropertyChanged("FileText");
            }));
        }
コード例 #11
0
        private void GetFiles()
        {
            if (DirectoryAccess.Password == null)
            {
                var pw = this.InputBox.RequestPassword();
                if (pw == null)
                {
                    return;
                }
                DirectoryAccess.Password = pw;
            }


            Files = new ObservableCollection <FileInfo>(
                DirectoryAccess.GetDirContent(SelectedFileStoreLocation.Location, SelectedFileStoreLocation.Filter));
            OnPropertyChanged("Files");
        }
コード例 #12
0
        public int KphOpenDirectoryObject(DirectoryAccess access, ObjectAttributes objectAttributes)
        {
            byte* inData = stackalloc byte[0xc];
            int directoryObjectHandle;

            *(int*)inData = (int)&directoryObjectHandle;
            *(int*)(inData + 0x4) = (int)access;
            *(int*)(inData + 0x8) = (int)&objectAttributes;

            _fileHandle.IoControl(CtlCode(Control.KphOpenDirectoryObject), inData, 0xc, null, 0);

            return directoryObjectHandle;
        }
コード例 #13
0
        public AnnotationService()
        {
            IDirectory directory = new TempDirectory();

            _directoryAccess = new DirectoryAccess(directory);
        }