Exemple #1
0
 private void OnBrowseFileOpen(object sender, RoutedEventArgs e)
 {
     if (FileSystemBrowser.BrowseFileOpen(out string path, out int filterIndex, "Test",
                                          FileSystemBrowser.BuildFilterString(new FileFilter("Txt1", "*.txt"),
                                                                              new FileFilter("Txt2", "*.txt"))))
     {
     }
 }
Exemple #2
0
 public PartialViewResult Invoke(FileBrowserViewModel viewModel)
 {
     try
     {
         PSRemoting          ps      = new PSRemoting(viewModel.ComputerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN);
         FileSystemBrowser   browser = new FileSystemBrowser(ps);
         List <FileMetadata> model   = browser.GetDirectoryContent(@"'" + viewModel.Directory + "'");
         return(PartialView("_DirectoryListing", model));
     }
     catch (Exception e)
     {
         return(PartialView("_Error", e.Message));
     }
 }
Exemple #3
0
        public void AddFiles()
        {
            var filter = "";

            if (Filters != null)
            {
                var filters = Filters?.Cast <FileFilter>()?.ToArray();
                filter = FileSystemBrowser.BuildFilterString(filters);
            }

            if (FileSystemBrowser.BrowseFilesOpen(out string[] paths, "Select file to process", filter))
            {
                AddPathsToSource(paths);
            }
        }
        public static void BrowseFile()
        {
            //--- browse-file-filter
            var filters = FileSystemBrowser.BuildFilterString(
                new FileFilter("Text Files", "*.txt", "*.doc", "*.md"),
                FileFilter.ImageFiles,
                FileFilter.AllFiles);

            //---

            //--- browse-file-open
            if (FileSystemBrowser.BrowseFileOpen(out string fileIn, "Select input file", filters))
            {
                Console.WriteLine($"Selected path: {fileIn}");
            }
Exemple #5
0
 public ActionResult Delete(string computerName, string filePath)
 {
     try
     {
         string            file    = System.Text.RegularExpressions.Regex.Replace(filePath, "[|]", "`$1");
         PSRemoting        ps      = new PSRemoting(computerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN);
         FileSystemBrowser browser = new FileSystemBrowser(ps);
         browser.DeleteFile(file);
         Response.StatusCode = (int)HttpStatusCode.OK;
         return(new EmptyResult());
     }
     catch (Exception e)
     {
         throw new HttpException(500, e.Message);
     }
 }
 public PartialViewResult BrowserRefresh(string computerName, string path, string deviceObject)
 {
     try
     {
         PSRemoting          psr     = new PSRemoting(computerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN);
         FileSystemBrowser   browser = new FileSystemBrowser(psr);
         List <FileMetadata> model   = browser.GetDirectoryContent(path);
         ViewBag.DeviceObject = deviceObject.Replace("\\", "\\\\");
         ViewBag.Path         = path;
         ViewBag.ComputerName = computerName;
         return(PartialView("~/Areas/Forensics/Views/SystemRestore/_ShadowCopyData.cshtml", model));
     }
     catch (Exception e)
     {
         Response.StatusCode = 500;
         return(PartialView("_Error", e.Message));
     }
 }
        public PartialViewResult RecoverFile(string computerName, string source, string attributes)
        {
            try
            {
                PSRemoting        psr         = new PSRemoting(computerName, config.FALCON_FORENSICS_USERNAME, config.FALCON_FORENSICS_PASSWORD, config.FALCON_FORENSICS_DOMAIN);
                FileSystemBrowser browser     = new FileSystemBrowser(psr);
                string            destination = source.Replace(@"\shadow", "");

                if (attributes.Contains("Directory"))
                {
                    source += @"\*";
                }
                browser.CopyFile(source, destination);
                return(PartialView("_Success", source + " has been successfully recovered"));
            }
            catch (Exception e)
            {
                Response.StatusCode = 500;
                return(PartialView("_Error", e.Message));
            }
        }
Exemple #8
0
        public MixViewModel(Mix mixModel, IPlaybackController playbackController,
                            IMediaLibraryBrowser mediaLibraryBrowser, IObservable <bool> userLoggedInObservable)
        {
            mixModel.CurrentTrackIndexObservable.Subscribe(x =>
            {
                // if we're playing a track that has already been added
                CurrentTrackIndex = x;
                UpdateCurrentTrackIndicator();
            });
            mixModel.LikedByCurrentUserObservable.Subscribe(x => LikedByCurrentUser = x);

            this.Model = mixModel;

            Play = ReactiveCommand.Create(_ => true);
            Play.Subscribe(_ => playbackController.Play(Model));


            ToggleLike = Model != Mix.NoMixAvailable
                             ? new ReactiveAsyncCommand(userLoggedInObservable, 1)
                             : new ReactiveAsyncCommand(Observable.Return(false), 1);

            ToggleLike.RegisterAsyncAction(_ => mediaLibraryBrowser.ToggleLike(Model));

            this.isUserRequested = ConfigurationManager.AppSettings["AudioPlayer"] == null || !ConfigurationManager.AppSettings["AudioPlayer"].Equals("DirectX WMI 3.14169");
            ReplaySubject <bool> skippingSongAllowed = new ReplaySubject <bool>(1);

            //skipping not allowed if there are no tracks in the mix
            Model.CurrentTrackIndexObservable.Select(trackIndex => trackIndex < Model.Tracks.Count && trackIndex >= 0
                                                                       ? Model.Tracks[trackIndex].IsSkipAllowed
                                                                       : false).Subscribe(skippingSongAllowed.OnNext);

            NextSong = new ReactiveAsyncCommand(skippingSongAllowed, 1);
            NextSong.RegisterAsyncAction(_ =>
            {
                try
                {
                    playbackController.NextSong(isUserRequested);
                }
                catch (Exception e)
                {
                    log.Error("Unable to go to the next song", e);
                }
            });

            Tracks = new DispatchedReactiveCollection <TrackViewModel>();

            // merge current items and future ones
            Observable.Merge(Model.Tracks.ToObservable(), Model.Tracks.ItemsAdded)
            .Select(CreateTrackViewModel)
            .Subscribe(trackViewModel =>
            {
                Tracks.Add(trackViewModel);
                UpdateCurrentTrackIndicator();
            });

            Download = ReactiveCommand.Create(_ => Model != Mix.NoMixAvailable);
            Download.Subscribe(_ =>
            {
                string destinationFolder = FileSystemBrowser.GetSaveToDirectory();

                if (String.IsNullOrEmpty(destinationFolder))
                {
                    return;
                }

                destinationFolder += Path.DirectorySeparatorChar + Model.Name;
                FileSystemBrowser.TryCreateDirectory(destinationFolder);

                Tracks
//                                           .Where(
//                                               trackViewModel =>
//                                               trackViewModel.TrackLocation.Equals(FileLocation.Online.ToString()))
                .ToObservable()
                .Subscribe(trackViewModel => SaveTrack(trackViewModel, destinationFolder));
            });

            FileSystemBrowser = new FileSystemBrowser();
            WebAccessProxy    = new WebAccessProxy();

//            _TotalNumberOfTracks = Tracks.CollectionCountChanged
//                .ToProperty(this, x => x.TotalNumberOfTracks);
            CurrentTrackIndexAsString = "0";

            skippingSongAllowed.OnNext(false);
        }