public void CreateDirectory()
 {
     IsCreateDirectoryModalDisplayed = false;
     directoryService.CreateDirectory(new Folder()
     {
         Parent = CurrentFolder.Id,
         Name   = NewDirectoryName
     });
     NewDirectoryName = null;
     ReloadData();
 }
示例#2
0
 public ActionResult Create(Guid rootId, string directoryName)
 {
     try
     {
         var userId = Identity.GetUserId(User.Identity);
         _directoryService.CreateDirectory(userId, rootId, directoryName);
         return(IndexDetails(rootId));
     }
     catch (Exception ex)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
 }
示例#3
0
        private async Task InitializeDatabase()
        {
#if DEBUG
            if (!await DirectoryService.DirectoryExists(DirectoryService.GetAppRootPath()))
            {
                await DirectoryService.CreateDirectory(DirectoryService.GetAppRootPath());
            }
#endif
            if (!await DirectoryService.InternalFileExists(Constants.DATABASE_FILE_NAME))
            {
                using (var stream = ResouceHelper.GetStreamFromAssembly(Constants.ASSEMBLY_NAME, Constants.INITIAL_DATABASE))
                {
                    using (var ms = new MemoryStream())
                    {
                        await stream.CopyToAsync(ms);

                        await DirectoryService.SaveFileToInternal(Constants.DATABASE_FILE_NAME, ms.ToArray());
                    }
                }
            }
        }
示例#4
0
        public async Task <Library> AddAsync(Library entity)
        {
            // create library folder with images subfolder
            var libraryFolderPath = FileSystemInfo.FileSystemInfo.RootDirectory + entity.Name + '-' + Guid.NewGuid().ToString();

            DirectoryService.CreateDirectory(libraryFolderPath + '\\' + FileSystemInfo.FileSystemInfo.ImagesDirectory);

            // create library file
            var path = libraryFolderPath + '\\' + entity.Name + ".plib";
            await Task.Run(() => FileService.CreateFile(path));

            // write library to file
            var fileStream = await Task.Run(() => FileService.OpenFile(path, FileMode.Open));

            await WriteLibraryToFileStreamAsync(fileStream, entity);

            entity.FullName = path;

            Logger.LogInformation("New added library: " + path);

            return(entity);
        }