Exemple #1
0
 public Deployer(IRunner runner, ICompiler compiler, IRequirementSatisfier requirementSatisfier, IFileSystemOperations fileSystemOperations)
 {
     Runner               = runner;
     Compiler             = compiler;
     RequirementSatisfier = requirementSatisfier;
     FileSystemOperations = fileSystemOperations;
 }
Exemple #2
0
        public DeploymentViewModel(
            IDeploymentContext context,
            IOperationContext operationContext,
            IWoaDeployer deployer, UIServices uiServices, AdvancedViewModel advancedViewModel,
            WimPickViewModel wimPickViewModel, IFileSystemOperations fileSystemOperations, IRaspberryPiSettingsService raspberryPiSettingsService,
            IDiskRoot diskRoot)
        {
            this.context                    = context;
            this.deployer                   = deployer;
            this.uiServices                 = uiServices;
            this.advancedViewModel          = advancedViewModel;
            this.wimPickViewModel           = wimPickViewModel;
            this.fileSystemOperations       = fileSystemOperations;
            this.raspberryPiSettingsService = raspberryPiSettingsService;

            var isSelectedWim = wimPickViewModel.WhenAnyObservable(x => x.WimMetadata.SelectedImageObs)
                                .Select(metadata => metadata != null);

            FullInstallWrapper = new CommandWrapper <Unit, Unit>(this,
                                                                 ReactiveCommand.CreateFromTask(Deploy, isSelectedWim), uiServices.ContextDialog, operationContext);
            IsBusyObservable = FullInstallWrapper.Command.IsExecuting;
            isBusyHelper     = IsBusyObservable.ToProperty(this, model => model.IsBusy);

            RefreshDisksCommandWrapper = new CommandWrapper <Unit, IList <IDisk> >(this,
                                                                                   ReactiveCommand.CreateFromTask(diskRoot.GetDisks), uiServices.ContextDialog, operationContext);
            disks = RefreshDisksCommandWrapper.Command
                    .Select(x => x.Select(disk => new DiskViewModel(disk)))
                    .ToProperty(this, x => x.Disks);

            this.WhenAnyValue(x => x.SelectedDisk).Where(x => x != null).Subscribe(x => context.Device = new RaspberryPi(x.IDisk));
        }
        public AdvancedViewModel(ILumiaSettingsService lumiaSettingsService, IFileSystemOperations fileSystemOperations,
                                 UIServices uiServices, IDeploymentContext context, IOperationContext operationContext, IOperationProgress progress,
                                 IList <Meta <IDiskLayoutPreparer> > diskPreparers,
                                 ILogCollector logCollector)
        {
            this.lumiaSettingsService = lumiaSettingsService;
            this.uiServices           = uiServices;
            this.context      = context;
            this.logCollector = logCollector;

            DiskPreparers = diskPreparers;

            DeleteDownloadedWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(() => DeleteDownloaded(fileSystemOperations)), progress, this, uiServices.ContextDialog, operationContext);

            ForceDualBootWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(ForceDualBoot), progress, this, uiServices.ContextDialog, operationContext);

            ForceSingleBootWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(ForceDisableDualBoot), progress, this, uiServices.ContextDialog, operationContext);

            CollectLogsCommmandWrapper = new ProgressViewModel(ReactiveCommand.CreateFromTask(CollectLogs), progress, this, uiServices.ContextDialog, operationContext);

            IsBusyObservable = Observable.Merge(DeleteDownloadedWrapper.Command.IsExecuting,
                                                ForceDualBootWrapper.Command.IsExecuting, ForceSingleBootWrapper.Command.IsExecuting,
                                                CollectLogsCommmandWrapper.Command.IsExecuting);

            preparerUpdater = this.WhenAnyValue(x => x.SelectedPreparer)
                              .Where(x => x != null)
                              .Subscribe(x =>
            {
                context.DiskLayoutPreparer        = x.Value;
                lumiaSettingsService.DiskPreparer = (string)x.Metadata["Name"];
            });

            SelectedPreparer = GetInitialDiskPreparer();
        }
Exemple #4
0
        public AdvancedViewModel(ISettingsService settingsService, IFileSystemOperations fileSystemOperations,
                                 UIServices uiServices, IProviderBasedWindowsDeployer deployer,
                                 IDiskLayoutPreparer preparer,
                                 IWindowsOptionsProvider optionsProvider, IDeviceProvider deviceProvider, IDownloadProgress progress, StatusViewModel statusViewModel, IPhone phone)
        {
            StatusViewModel      = statusViewModel;
            this.settingsService = settingsService;
            this.uiServices      = uiServices;
            this.deployer        = deployer;
            this.preparer        = preparer;
            this.optionsProvider = optionsProvider;
            this.deviceProvider  = deviceProvider;
            this.progress        = progress;
            this.phone           = phone;

            sizeReservedForWindows =
                this.WhenAnyValue(x => x.GbsReservedForWindows, ByteSize.FromGigaBytes)
                .ToProperty(this, x => x.SizeReservedForWindows);

            DeleteDownloadedWrapper     = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(() => DeleteDownloaded(fileSystemOperations)), uiServices.Dialog);
            ForceDualBootWrapper        = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(ForceDualBoot), uiServices.Dialog);
            ForceDisableDualBootWrapper = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(ForceDisableDualBoot), uiServices.Dialog);

            BackupCommandWrapper  = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(Backup), uiServices.Dialog);
            RestoreCommandWrapper = new CommandWrapper <Unit, Unit>(this, ReactiveCommand.CreateFromTask(Restore), uiServices.Dialog);

            IsBusyObservable = Observable.Merge(new []
            {
                DeleteDownloadedWrapper.Command.IsExecuting,
                BackupCommandWrapper.Command.IsExecuting,
                RestoreCommandWrapper.Command.IsExecuting,
                ForceDualBootWrapper.Command.IsExecuting,
                ForceDisableDualBootWrapper.Command.IsExecuting,
            });
        }
        public static async Task DeleteAllUnusedDataOnDisk(IFileSystemOperations fileSystemOperations,
                                                           IMessagingService messagingService, ILoggerService loggerService)
        {
            var dateTimeNow = DateTime.Now;
            var timeElapsed = new TimeSpan((dateTimeNow - Properties.Settings.Default.ConvertingDataFolderCheck).Ticks);

            if (timeElapsed.TotalHours > ProjectSettings.IntervalHoursToDeleteUnusedPackages)
            {
                messagingService.ShowMessage("Очистка пространства на жестком диске...");
                loggerService.DebugLog("Очистка пространства на жестком диске...");

                KillPreviousRunProcesses();
                var result = await Task.Run(
                    () => fileSystemOperations.DeleteAllDataInDirectory(ProjectSettings.ConvertingDirectory, DateTime.Now,
                                                                        ProjectSettings.IntervalHoursToDeleteUnusedPackages));

                if (result.HasErrors)
                {
                    messagingService.ShowAndLogErrors(result.Errors);
                }

                Properties.Settings.Default.ConvertingDataFolderCheck = new TimeSpan(dateTimeNow.Ticks);
                Properties.Settings.Default.Save();
            }
        }
Exemple #6
0
 public RunScript(string scriptPath, IFileSystemOperations fileSystemOperations,
                  IDeploymentContext deploymentContext, IOperationContext operationContext, IScriptRunner scriptRunner, IScriptParser scriptParser) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.scriptPath   = scriptPath;
     this.scriptRunner = scriptRunner;
     this.scriptParser = scriptParser;
 }
Exemple #7
0
 public InjectDrivers(IWindowsImageService imageService,
                      IFileSystemOperations fileSystemOperations,
                      IOperationContext operationContext) : base(fileSystemOperations, operationContext)
 {
     this.imageService         = imageService;
     this.fileSystemOperations = fileSystemOperations;
 }
Exemple #8
0
 protected DeploymentTask(IDeploymentContext deploymentContext, IFileSystemOperations fileSystemOperations,
                          IOperationContext operationContext)
 {
     DeploymentContext    = deploymentContext;
     FileSystemOperations = fileSystemOperations;
     OperationContext     = operationContext;
 }
Exemple #9
0
 public Flash(IFileSystem fileSystem, IImageFlasher flasher,
              IOperationContext operationContext, IFileSystemOperations fileSystemOperations, IOperationProgress progress) : base(fileSystemOperations, operationContext)
 {
     this.fileSystem = fileSystem;
     this.flasher    = flasher;
     this.progress   = progress;
 }
 public CopyDirectory(string origin, string destination, IFileSystemOperations fileSystemOperations,
                      IDeploymentContext deploymentContext, IOperationContext operationContext) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.origin               = origin;
     this.destination          = destination;
     this.fileSystemOperations = fileSystemOperations;
 }
Exemple #11
0
 public CopyToBoot(string origin, string destination, IFileSystemOperations fileSystemOperations, IPhone phone)
 {
     this.origin               = origin;
     this.destination          = destination;
     this.fileSystemOperations = fileSystemOperations;
     this.phone = phone;
 }
Exemple #12
0
 public InstallDevMenu(string rootFilesPath, IPhone phone, IBcdInvokerFactory bcdInvokerFactory, IFileSystemOperations fileSystemOperations)
 {
     this.rootFilesPath        = rootFilesPath;
     this.phone                = phone;
     this.bcdInvokerFactory    = bcdInvokerFactory;
     this.fileSystemOperations = fileSystemOperations;
 }
 /// <summary>
 /// Test the existence of a file or directory object specified by the file path.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='accountName'>
 /// The Azure Data Lake Store account to execute filesystem operations on.
 /// </param>
 /// <param name='getFilePath'>
 /// The Data Lake Store path (starting with '/') of the file or directory for
 /// which to test the existence of.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <bool> PathExistsAsync(this IFileSystemOperations operations, string accountName, string getFilePath, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PathExistsWithHttpMessagesAsync(accountName, getFilePath, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemple #14
0
 public ApplyWindowsImage(IFileSystemOperations fileSystemOperations, IOperationContext operationContext,
                          IWindowsImageService windowsImageService, IOperationProgress progress) : base(fileSystemOperations,
                                                                                                        operationContext)
 {
     this.windowsImageService = windowsImageService;
     this.progress            = progress;
 }
Exemple #15
0
 public DownloadUefi(string destination, IFileSystemOperations fileSystemOperations, IZipExtractor extractor, IObserver <double> progressObserver)
 {
     this.destination          = destination;
     this.fileSystemOperations = fileSystemOperations;
     this.extractor            = extractor;
     this.progressObserver     = progressObserver;
 }
Exemple #16
0
 public FetchGitHubBranch(string repositoryUrl, string branchName,
                          IZipExtractor zipExtractor, IDownloader downloader, IGitHubClient gitHubClient,
                          IOperationProgress progressObserver, IDeploymentContext deploymentContext,
                          IFileSystemOperations fileSystemOperations, IOperationContext operationContext) :
     base(repositoryUrl, branchName, zipExtractor, downloader, gitHubClient, progressObserver, deploymentContext, fileSystemOperations, operationContext)
 {
 }
 public DeployWindows(IDeploymentContext deploymentContext, IWindowsDeployer deployer, IOperationProgress progressObserver,
                      IFileSystemOperations fileSystemOperations, IOperationContext operationContext) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.deploymentContext = deploymentContext;
     this.deployer          = deployer;
     this.progressObserver  = progressObserver;
 }
Exemple #18
0
 /// <summary>
 /// Создать папку для сохранения отконвертированных файлов по типу расширения
 /// </summary>
 public static string CreateSavingPath(string filePathServer, FileExtensionType fileExtensionType,
                                       IFileSystemOperations fileSystemOperations) =>
 Path.GetDirectoryName(filePathServer).
 Map(directory => fileSystemOperations.CreateFolderByName(Path.Combine(directory, Path.GetFileNameWithoutExtension(filePathServer)),
                                                          fileExtensionType.ToString())).
 Map(serverDirectory => FilePathOperations.CombineFilePath(serverDirectory,
                                                           Path.GetFileNameWithoutExtension(filePathServer),
                                                           fileExtensionType.ToString().ToLowerCaseCurrentCulture()));
Exemple #19
0
        public DirectorySwitch(IFileSystemOperations operations, string directory)
        {
            this.operations = operations;
            Log.Debug($"Switching to {directory}");

            oldDirectory = operations.WorkingDirectory;
            operations.WorkingDirectory = directory;
        }
 public WoaDeployer(IScriptRunner scriptRunner, IScriptParser parser, ITooling tooling,
                    IFileSystemOperations fileSystemOperations)
 {
     this.scriptRunner         = scriptRunner;
     this.parser               = parser;
     this.tooling              = tooling;
     this.fileSystemOperations = fileSystemOperations;
 }
 public ConvertingFileData(IMessagingService messagingService, IApplicationConverting applicationConverting,
                           IFileSystemOperations fileSystemOperations, IFilePathOperations filePathOperations)
 {
     _messagingService      = messagingService;
     _applicationConverting = applicationConverting;
     _fileSystemOperations  = fileSystemOperations;
     _filePathOperations    = filePathOperations;
 }
 public DownloadUefi(string destination, IFileSystemOperations fileSystemOperations, IZipExtractor extractor, IOperationProgress progress, IDownloader downloader)
 {
     this.destination          = destination;
     this.fileSystemOperations = fileSystemOperations;
     this.extractor            = extractor;
     this.progress             = progress;
     this.downloader           = downloader;
 }
Exemple #23
0
 public Flash(string imagePath, IImageFlasher flasher, IDeploymentContext deploymentContext,
              IOperationContext operationContext, IFileSystemOperations fileSystemOperations, IOperationProgress progress) : base(deploymentContext,
                                                                                                                                  fileSystemOperations, operationContext)
 {
     this.imagePath = imagePath;
     this.flasher   = flasher;
     this.progress  = progress;
 }
Exemple #24
0
 public WoaDeployer(ICompiler compiler, IRunner runner, IFileSystemOperations fileSystemOperations,
                    IEnumerable <IContextualizer> contextualizers, IRequirementSatisfier requirementSatisfier)
 {
     this.compiler             = compiler;
     this.runner               = runner;
     this.fileSystemOperations = fileSystemOperations;
     this.contextualizers      = contextualizers;
     this.requirementSatisfier = requirementSatisfier;
 }
 public InjectDrivers(string origin, IDeploymentContext context, IWindowsImageService imageService,
                      IDeploymentContext deploymentContext, IFileSystemOperations fileSystemOperations,
                      IOperationContext operationContext) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.origin               = origin;
     this.context              = context;
     this.imageService         = imageService;
     this.fileSystemOperations = fileSystemOperations;
 }
 public LumiaDiskLayoutPreparer(IWindowsOptionsProvider optionsProvider, IFileSystemOperations fileOperations,
                                IEnumerable <ISpaceAllocator <IPhone> > spaceAllocators, IPartitionCleaner cleaner, IPhone phone)
 {
     this.optionsProvider = optionsProvider;
     this.fileOperations  = fileOperations;
     this.spaceAllocators = spaceAllocators;
     this.cleaner         = cleaner;
     this.phone           = phone;
 }
        public ProjectSignatureSettings(IFileSystemOperations fileSystemOperations, IFilePathOperations filePathOperations,
                                        IMessagingService messagingService)
        {
            _fileSystemOperations = fileSystemOperations;
            _filePathOperations   = filePathOperations;
            _messagingService     = messagingService;

            PutSignatureTemplateToDataFolder();
        }
        public MainViewModel(IFileSystemOperations fileSystemOperations, IEnumerable <IBusy> busies)
        {
            this.fileSystemOperations = fileSystemOperations;
            var isBusyObs = busies.Select(x => x.IsBusyObservable).Merge();

            DonateCommand = ReactiveCommand.Create(() => { Process.Start(DonationLink); });
            HelpCommand   = ReactiveCommand.Create(() => { Process.Start(HelpLink); });
            isBusyHelper  = isBusyObs.ToProperty(this, model => model.IsBusy);
        }
Exemple #29
0
 public Fetch(string url, string destination, IZipExtractor extractor,
              IFileSystemOperations fileSystemOperations, IDownloader downloader, IDownloadProgress progressObserver)
 {
     this.url                  = url;
     this.destination          = destination;
     this.extractor            = extractor;
     this.fileSystemOperations = fileSystemOperations;
     this.downloader           = downloader;
     this.progressObserver     = progressObserver;
 }
 public MakeWindowsBootable(IFileSystem fileSystem, IFileSystemOperations fileSystemOperations,
                            IBootCreator bootCreator,
                            IOperationContext operationContext, IWindowsImageService windowsImageService, IOperationProgress progress) : base(fileSystemOperations, operationContext)
 {
     this.fileSystem           = fileSystem;
     this.fileSystemOperations = fileSystemOperations;
     this.bootCreator          = bootCreator;
     this.windowsImageService  = windowsImageService;
     this.progress             = progress;
 }