コード例 #1
0
      /// <summary>
      /// Initializes the singleton application object.  This is the first line of authored code
      /// executed, and as such is the logical equivalent of main() or WinMain().
      /// </summary>
      public App()
      {
          // Setup DI
          IServiceCollection serviceCollection = new ServiceCollection();

          serviceCollection.AddApplication();
          serviceCollection.AddInfrastructureCommon();
          serviceCollection.AddInfrastructureKeePass();
          serviceCollection.AddInfrastructureUwp();
          serviceCollection.AddWin81App();
          Services = serviceCollection.BuildServiceProvider();

          _mediator     = Services.GetService <IMediator>();
          _resource     = Services.GetService <IResourceProxy>();
          _settings     = Services.GetService <ISettingsProxy>();
          _navigation   = Services.GetService <INavigationService>();
          _notification = Services.GetService <INotificationService>();
          _log          = Services.GetService <ILogger>();
          _hockey       = Services.GetService <IHockeyClient>();
          _file         = Services.GetService <IFileProxy>();
          _messenger    = Services.GetService <IMessenger>();

          InitializeComponent();
          Suspending         += OnSuspending;
          Resuming           += OnResuming;
          UnhandledException += OnUnhandledException;

          _messenger.Register <SaveErrorMessage>(this, async message => await HandleSaveError(message));
      }
コード例 #2
0
        public Document(IAes aes, ISecureHash hash, ICompression compression, IPassword password, IFileProxy fileProxy)
        {
            if (aes == null)
            {
                throw new ArgumentNullException(nameof(aes));
            }

            if (hash == null)
            {
                throw new ArgumentNullException(nameof(hash));
            }

            if (compression == null)
            {
                throw new ArgumentNullException(nameof(compression));
            }

            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            if (fileProxy == null)
            {
                throw new ArgumentNullException(nameof(fileProxy));
            }

            _aes = aes;
            SecureHashProvider  = hash;
            CompressionProvider = compression;
            _password           = password;
            _fileProxy          = fileProxy;
        }
コード例 #3
0
        public async Task <Guid> UploadAsync(IFileProxy file)
        {
            using (var fileStream = file.OpenRead())
            {
                using (fileStream)
                {
                    var result = await _httpClient.PostAsync(_options.EndpointUrl, new StreamContent(fileStream)
                    {
                        Headers =
                        {
                            ContentDisposition =
                            {
                                FileName = file.FileName,
                                Name     = nameof(file),
                                Size     = file.Size,
                            }
                        }
                    });

                    result.EnsureSuccessStatusCode();

                    var resultContent = await result.Content.ReadAsStringAsync();

                    return(Guid.Parse(resultContent));
                }
            }
        }
コード例 #4
0
ファイル: EntryDetailVm.cs プロジェクト: wismna/ModernKeePass
        public EntryDetailVm(IMediator mediator, INavigationService navigation, IResourceProxy resource, IDialogService dialog, INotificationService notification, IFileProxy file, ICryptographyClient cryptography, IDateTime dateTime)
        {
            _mediator     = mediator;
            _navigation   = navigation;
            _resource     = resource;
            _dialog       = dialog;
            _notification = notification;
            _file         = file;
            _cryptography = cryptography;
            _dateTime     = dateTime;

            SaveCommand             = new RelayCommand(async() => await SaveChanges(), () => Database.IsDirty);
            MoveCommand             = new RelayCommand <string>(async destination => await Move(destination), destination => Parent != null && !string.IsNullOrEmpty(destination) && destination != Parent.Id);
            RestoreCommand          = new RelayCommand(async() => await RestoreHistory());
            DeleteCommand           = new RelayCommand(async() => await AskForDelete());
            AddAdditionalField      = new RelayCommand(AddField, () => IsCurrentEntry);
            DeleteAdditionalField   = new RelayCommand <EntryFieldVm>(async field => await DeleteField(field), field => field != null && IsCurrentEntry);
            OpenAttachmentCommand   = new RelayCommand <Attachment>(async attachment => await OpenAttachment(attachment));
            AddAttachmentCommand    = new RelayCommand(async() => await AddAttachment(), () => IsCurrentEntry);
            DeleteAttachmentCommand = new RelayCommand <Attachment>(async attachment => await DeleteAttachment(attachment), _ => IsCurrentEntry);
            SetCurrentEntryCommand  = new RelayCommand <EntryVm>(SetCurrentEntry, entry => entry != null);

            MessengerInstance.Register <DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
            MessengerInstance.Register <EntryFieldValueChangedMessage>(this, async message => await SetFieldValue(message.FieldName, message.FieldValue, message.IsProtected));
            MessengerInstance.Register <EntryFieldNameChangedMessage>(this, async message => await UpdateFieldName(message.OldName, message.NewName, message.Value, message.IsProtected));
            MessengerInstance.Register <PasswordGeneratedMessage>(this, message => Password = message.Password);
        }
コード例 #5
0
 public NugetDownloadStrategy(IWebRequestProxy webRequestProxy, IDirectoryProxy directoryProxy, IFileProxy fileProxy, string folder, string nugetSource)
 {
     WebRequestProxy = webRequestProxy;
     DirectoryProxy  = directoryProxy;
     FileProxy       = fileProxy;
     Folder          = folder;
     NugetSource     = nugetSource;
 }
コード例 #6
0
 public NugetDownloadStrategy(IWebRequestProxy webRequestProxy, IDirectoryProxy directoryProxy, IFileProxy fileProxy, string folder, string nugetSource)
 {
     WebRequestProxy = webRequestProxy;
     DirectoryProxy = directoryProxy;
     FileProxy = fileProxy;
     Folder = folder;
     NugetSource = nugetSource;
 }
コード例 #7
0
 public AccountController(IFileProxy fileProxy, IOtpProxy otpProxy, ISmsSender smsSender, IStaffMemberProxy staffProxy, IEmailSender emailSender, IAccountProxy accountProxy)
 {
     _fileProxy    = fileProxy;
     _otpProxy     = otpProxy;
     _smsSender    = smsSender;
     _staffProxy   = staffProxy;
     _emailSender  = emailSender;
     _accountProxy = accountProxy;
 }
コード例 #8
0
        public RSA(IFileProxy fileProxy)
        {
            if (fileProxy == null)
            {
                throw new ArgumentNullException("fileProxy");
            }

            this.FileProxy = fileProxy;
        }
コード例 #9
0
        public Document(string fileName, string documentName, IFileProxy fileProxy)
        {
            if (fileProxy == null)
            {
                throw new ArgumentNullException(nameof(fileProxy));
            }

            _fileProxy = fileProxy;
            SetFileProperties(fileName, documentName);
        }
コード例 #10
0
        public CacheDownloadStrategy(IDownloadStrategy effectiveStrategy, IDirectoryProxy directoryProxy, IFileProxy fileProxy)
        {
            if (effectiveStrategy == null)
                throw new ArgumentException("CacheDownloadStrategy needs a non-null effective strategy");
            if (effectiveStrategy.FallbackStrategy != null)
                throw new ArgumentException("CacheDownloadStrategy should not have a fallback strategy");

            EffectiveStrategy = effectiveStrategy;
            DirectoryProxy = directoryProxy;
            FileProxy = fileProxy;
        }
コード例 #11
0
 public MainWindowViewModel(IDialogService dialogService = null, IPersonListViewModel personListVM = null, IPersonParser parser = null, IPersonFactory factory = null, IFileProxy fileProxy = null, IFileWrapper wrapper = null)
 {
     m_dialogService  = dialogService ?? new DialogService.DialogService(null);
     PersonListVM     = personListVM ?? new PersonListViewModel();
     m_factory        = factory ?? new PersonFactory();
     m_fileWrapper    = wrapper ?? new FileWrapper();
     m_fileProxy      = fileProxy;
     m_parser         = parser ?? new PersonParser(factory);
     HaveLoadedPeople = false;
     LoadCommands();
 }
コード例 #12
0
 public DownloadExpression(IAppLog appLog, IPageParser parser, IAppController appController, IFileDownloader downloader, IComicPath comicPath, IFileProxy file, IWebClientProxy webClient, IAppSettings appSettings, IComicStore comicStore)
     : base(appLog, webClient)
 {
     this.parser        = parser;
     this.comicStore    = comicStore;
     this.appSettings   = appSettings;
     this.file          = file;
     this.comicPath     = comicPath;
     this.downloader    = downloader;
     this.appController = appController;
 }
コード例 #13
0
 public OpenDatabaseControlVm(IMediator mediator, IResourceProxy resource, INotificationService notification, IFileProxy file, IDialogService dialog)
 {
     _mediator           = mediator;
     _resource           = resource;
     _notification       = notification;
     _file               = file;
     _dialog             = dialog;
     OpenKeyFileCommand  = new RelayCommand(async() => await OpenKeyFile());
     OpenDatabaseCommand = new RelayCommand <string>(async databaseFilePath => await TryOpenDatabase(databaseFilePath), _ => IsValid);
     _keyFileText        = _resource.GetResourceValue("CompositeKeyDefaultKeyFile");
 }
 public SolutionModeConfigurationRepository(
     IPathProxy pathProxy,
     IFileProxy fileProxy,
     IDirectoryProxy directoryProxy,
     IMapper mapper)
 {
     _pathProxy      = pathProxy;
     _fileProxy      = fileProxy;
     _directoryProxy = directoryProxy;
     _mapper         = mapper;
 }
コード例 #15
0
        public Waifu2xVulkan(UpscaleSettings upscaleSettings, Waifu2xSettings waifu2XSettings, IFileProxy fileProxy, ILogger <Waifu2xVulkan> logger)
        {
            this._waifu2XSettings = waifu2XSettings;
            this._fileProxy       = fileProxy;
            this._logger          = logger;
            if (string.IsNullOrEmpty(waifu2XSettings.OutputPath))
            {
                throw new ArgumentNullException(nameof(waifu2XSettings.OutputPath));
            }

            this._outputPath = Path.Combine(upscaleSettings.TempPath, waifu2XSettings.OutputPath);
        }
コード例 #16
0
ファイル: PlayDateCalculator.cs プロジェクト: missymessa/dogs
        public PlayDateCalculator(IDogDataDAO dogDataDAO, IFileProxy fileProxy, string dogFilePath)
        {
            _dogDataDAO   = dogDataDAO;
            _fileProxy    = fileProxy;
            _dogBreedData = _dogDataDAO.GetDogData();

            var jsonSerializerOptions = new JsonSerializerOptions();

            jsonSerializerOptions.PropertyNameCaseInsensitive = true;
            jsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
            _teamDogs = JsonSerializer.Deserialize <TeamDogs>(_fileProxy.ReadAllText(dogFilePath), jsonSerializerOptions);
        }
コード例 #17
0
        public NewVm(IMediator mediator, ISettingsProxy settings, INavigationService navigation, IFileProxy file, IResourceProxy resource) : base(file)
        {
            _mediator   = mediator;
            _settings   = settings;
            _navigation = navigation;
            _file       = file;
            _resource   = resource;

            CreateDatabaseFileCommand = new RelayCommand(async() => await CreateDatabaseFile());

            MessengerInstance.Register <CredentialsSetMessage>(this, async m => await TryCreateDatabase(m));
        }
コード例 #18
0
ファイル: SaveVm.cs プロジェクト: wismna/ModernKeePass
        public SaveVm(IMediator mediator, INavigationService navigation, IFileProxy file, IResourceProxy resource)
        {
            _mediator   = mediator;
            _navigation = navigation;
            _file       = file;
            _resource   = resource;

            SaveAsCommand = new RelayCommand(async() => await SaveAs());
            SaveCommand   = new RelayCommand(async() => await Save(), () => IsSaveEnabled);
            CloseCommand  = new RelayCommand(async() => await Close());

            MessengerInstance.Register <DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
        }
コード例 #19
0
        public Document(IPassword password)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }

            _aes = new Aes();
            SecureHashProvider  = new BCryptHash();
            _password           = password;
            _fileProxy          = new FileProxy();
            CompressionProvider = new GZipCompression();
        }
コード例 #20
0
 public SaveConfigurationOperation(
     IConverterOptions options,
     IDirectoryHelper directoryHelper,
     IFileProxy fileProxy,
     IFolderProxy folderProxy,
     IOutputConfigurationFileHelper outputConfigurationHelper)
 {
     this.options                   = options;
     this.directoryHelper           = directoryHelper;
     this.fileProxy                 = fileProxy;
     this.folderProxy               = folderProxy;
     this.outputConfigurationHelper = outputConfigurationHelper;
 }
コード例 #21
0
        public CacheDownloadStrategy(IDownloadStrategy effectiveStrategy, IDirectoryProxy directoryProxy, IFileProxy fileProxy)
        {
            if (effectiveStrategy == null)
            {
                throw new ArgumentException("CacheDownloadStrategy needs a non-null effective strategy");
            }
            if (effectiveStrategy.FallbackStrategy != null)
            {
                throw new ArgumentException("CacheDownloadStrategy should not have a fallback strategy");
            }

            EffectiveStrategy = effectiveStrategy;
            DirectoryProxy    = directoryProxy;
            FileProxy         = fileProxy;
        }
コード例 #22
0
 public ExtractSaveOperation(
     IConverterOptions options,
     ICompressedSaveChecker saveChecker,
     IZipFileHelper zipFileHelper,
     IEnvironmentProxy environmentProxy,
     IFileProxy fileProxy,
     IFolderProxy folderProxy)
 {
     this.options          = options;
     this.saveChecker      = saveChecker;
     this.zipFileHelper    = zipFileHelper;
     this.environmentProxy = environmentProxy;
     _fileProxy            = fileProxy;
     _folderProxy          = folderProxy;
 }
コード例 #23
0
        public Task <Guid> UploadAsync(IFileProxy file)
        {
            var uuid = Guid.NewGuid();

            using (var inputStream = file.OpenRead())
            {
                var storedFilePath = GetFilePath(uuid);
                using (var outputStream = File.Create(storedFilePath))
                {
                    inputStream.CopyTo(outputStream);
                }
            }

            return(Task.FromResult(uuid));
        }
コード例 #24
0
 public ExtractSaveOperation(
     IConverterOptions options,
     ICompressedSaveChecker saveChecker,
     IZipFileHelper zipFileHelper,
     IEnvironmentProxy environmentProxy,
     IFileProxy fileProxy,
     IFolderProxy folderProxy)
 {
     this.options = options;
     this.saveChecker = saveChecker;
     this.zipFileHelper = zipFileHelper;
     this.environmentProxy = environmentProxy;
     _fileProxy = fileProxy;
     _folderProxy = folderProxy;
 }
コード例 #25
0
 public SolutionSwitchingService(
     IInformationPublishingService informationPublishingService,
     ISolutionModeSwitchingService solutionModeSwitchingService,
     IProjectConfigurationDocumentFactory projectConfigurationFileDocumentService,
     ISolutionConfigurationDataFactory solutionConfigDataFactory,
     IFileProxy fileProxy,
     IMapper mapper)
 {
     _informationPublishingService            = informationPublishingService;
     _solutionModeSwitchingService            = solutionModeSwitchingService;
     _projectConfigurationFileDocumentService = projectConfigurationFileDocumentService;
     _solutionConfigDataFactory = solutionConfigDataFactory;
     _fileProxy = fileProxy;
     _mapper    = mapper;
 }
コード例 #26
0
 public ModCopier(
     IConverterOptions options,
     IFileProxy fileProxy,
     IFolderProxy folderProxy,
     IDirectoryHelper directoryHelper,
     IMessageBoxProxy messageBoxProxy,
     IDirectoryCopyHelper directoryCopyHelper,
     ISaveGameNameTranslator nameTranslator)
 {
     this.options             = options;
     this.fileProxy           = fileProxy;
     this.folderProxy         = folderProxy;
     this.directoryHelper     = directoryHelper;
     this.messageBoxProxy     = messageBoxProxy;
     this.directoryCopyHelper = directoryCopyHelper;
     this.nameTranslator      = nameTranslator;
 }
コード例 #27
0
        public TemporarilyIgnoreUpdatesDownloadStrategy(
            IDownloadStrategy effectiveStrategy, 
            IFileProxy fileProxy,
            string target,
            int maxFileAgeOfPaketExeInMinutes)
        {
            if (effectiveStrategy == null)
                throw new ArgumentException("TemporarilyIgnoreUpdatesDownloadStrategy needs a non-null effective strategy");

            if (string.IsNullOrEmpty(target))
                throw new ArgumentException("TemporarilyIgnoreUpdatesDownloadStrategy needs a non-empty target");

            _effectiveStrategy = effectiveStrategy;
            _maxFileAgeOfPaketExeInMinutes = maxFileAgeOfPaketExeInMinutes;
            _fileProxy = fileProxy;

            _target = target;
        }
コード例 #28
0
        public SetCredentialsVm(IMediator mediator, IResourceProxy resource, IFileProxy file)
        {
            _mediator = mediator;
            _resource = resource;
            _file     = file;

            OpenKeyFileCommand         = new RelayCommand(async() => await OpenKeyFile(), () => HasKeyFile);
            CreateKeyFileCommand       = new RelayCommand(async() => await CreateKeyFile(), () => HasKeyFile);
            GenerateCredentialsCommand = new RelayCommand(GenerateCredentials, () => IsValid);

            _keyFileText = resource.GetResourceValue("CompositeKeyDefaultKeyFile");

            MessengerInstance.Register <PasswordGeneratedMessage>(this, message =>
            {
                Password        = message.Password;
                ConfirmPassword = message.Password;
            });
        }
コード例 #29
0
        public TemporarilyIgnoreUpdatesDownloadStrategy(
            IDownloadStrategy effectiveStrategy,
            IFileProxy fileProxy,
            string target,
            int maxFileAgeOfPaketExeInMinutes)
        {
            if (effectiveStrategy == null)
            {
                throw new ArgumentException("TemporarilyIgnoreUpdatesDownloadStrategy needs a non-null effective strategy");
            }

            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentException("TemporarilyIgnoreUpdatesDownloadStrategy needs a non-empty target");
            }

            _effectiveStrategy             = effectiveStrategy;
            _maxFileAgeOfPaketExeInMinutes = maxFileAgeOfPaketExeInMinutes;
            _fileProxy = fileProxy;

            _target = target;
        }
コード例 #30
0
        public void SetUp()
        {
            var dateTime = Substitute.For <IDateTime>();

            _fileProxy = Substitute.For <IFileProxy>();
            _fileProxy.OpenBinaryFile(Arg.Any <string>()).Returns(async parameters =>
            {
                await using var stream = File.Open((string)parameters[0], FileMode.OpenOrCreate);
                var contents           = new byte[stream.Length];
                await stream.ReadAsync(contents, 0, (int)stream.Length);
                return(contents);
            });
            _fileProxy.WriteBinaryContentsToFile(Arg.Any <string>(), Arg.Any <byte[]>()).Returns(async parameters =>
            {
                await using var stream = File.Open((string)parameters[0], FileMode.OpenOrCreate);
                var contents           = (byte[])parameters[1];
                await stream.WriteAsync(contents, 0, contents.Length);
            });
            var mapper = new Mapper(new MapperConfiguration(cfg => { cfg.AddProfile(typeof(EntryMappingProfile)); }));

            _database = new KeePassDatabaseClient(mapper, dateTime);
        }
コード例 #31
0
ファイル: Program.cs プロジェクト: pombredanne/Paket
        public static void StartPaketBootstrapping(IDownloadStrategy downloadStrategy, DownloadArguments dlArgs, IFileProxy fileProxy)
        {
            Action <Exception> handleException = exception =>
            {
                if (!File.Exists(dlArgs.Target))
                {
                    Environment.ExitCode = 1;
                }
                ConsoleImpl.WriteError(String.Format("{0} ({1})", exception.Message, downloadStrategy.Name));
            };

            try
            {
                string versionRequested;
                if (!dlArgs.IgnorePrerelease)
                {
                    versionRequested = "prerelease requested";
                }
                else if (String.IsNullOrWhiteSpace(dlArgs.LatestVersion))
                {
                    versionRequested = "downloading latest stable";
                }
                else
                {
                    versionRequested = string.Format("version {0} requested", dlArgs.LatestVersion);
                }

                ConsoleImpl.WriteDebug("Checking Paket version ({0})...", versionRequested);

                var localVersion = fileProxy.GetLocalFileVersion(dlArgs.Target);

                var specificVersionRequested = true;
                var latestVersion            = dlArgs.LatestVersion;

                if (latestVersion == String.Empty)
                {
                    latestVersion            = downloadStrategy.GetLatestVersion(dlArgs.IgnorePrerelease);
                    specificVersionRequested = false;
                }

                if (dlArgs.DoSelfUpdate)
                {
                    ConsoleImpl.WriteDebug("Trying self update");
                    downloadStrategy.SelfUpdate(latestVersion);
                }
                else
                {
                    var currentSemVer = String.IsNullOrEmpty(localVersion) ? new SemVer() : SemVer.Create(localVersion);
                    if (currentSemVer.PreRelease != null && dlArgs.IgnorePrerelease)
                    {
                        currentSemVer = new SemVer();
                    }
                    var latestSemVer = SemVer.Create(latestVersion);
                    var comparison   = currentSemVer.CompareTo(latestSemVer);

                    if ((comparison > 0 && specificVersionRequested) || comparison < 0)
                    {
                        downloadStrategy.DownloadVersion(latestVersion, dlArgs.Target);
                        ConsoleImpl.WriteDebug("Done.");
                    }
                    else
                    {
                        ConsoleImpl.WriteDebug("Paket.exe {0} is up to date.", localVersion);
                    }
                }
            }
            catch (WebException exn)
            {
                var shouldHandleException = true;
                if (!File.Exists(dlArgs.Target))
                {
                    if (downloadStrategy.FallbackStrategy != null)
                    {
                        var fallbackStrategy = downloadStrategy.FallbackStrategy;
                        ConsoleImpl.WriteDebug("'{0}' download failed. If using Mono, you may need to import trusted certificates using the 'mozroots' tool as none are contained by default. Trying fallback download from '{1}'.", downloadStrategy.Name, fallbackStrategy.Name);
                        StartPaketBootstrapping(fallbackStrategy, dlArgs, fileProxy);
                        shouldHandleException = !File.Exists(dlArgs.Target);
                    }
                }
                if (shouldHandleException)
                {
                    handleException(exn);
                }
            }
            catch (Exception exn)
            {
                handleException(exn);
            }
        }
コード例 #32
0
ファイル: Program.cs プロジェクト: jschiefer/Paket
        public static void StartPaketBootstrapping(IDownloadStrategy downloadStrategy, DownloadArguments dlArgs, IFileProxy fileProxy)
        {
            Action<Exception> handleException = exception =>
            {
                if (!File.Exists(dlArgs.Target))
                    Environment.ExitCode = 1;
                ConsoleImpl.WriteError(String.Format("{0} ({1})", exception.Message, downloadStrategy.Name));
            };
            try
            {
                string versionRequested;
                if (!dlArgs.IgnorePrerelease)
                    versionRequested = "prerelease requested";
                else if (String.IsNullOrWhiteSpace(dlArgs.LatestVersion))
                    versionRequested = "downloading latest stable";
                else
                    versionRequested = string.Format("version {0} requested", dlArgs.LatestVersion);

                ConsoleImpl.WriteDebug("Checking Paket version ({0})...", versionRequested);

                var localVersion = fileProxy.GetLocalFileVersion(dlArgs.Target);

                var specificVersionRequested = true;
                var latestVersion = dlArgs.LatestVersion;

                if (latestVersion == String.Empty)
                {
                    latestVersion = downloadStrategy.GetLatestVersion(dlArgs.IgnorePrerelease);
                    specificVersionRequested = false;
                }

                if (dlArgs.DoSelfUpdate)
                {
                    ConsoleImpl.WriteDebug("Trying self update");
                    downloadStrategy.SelfUpdate(latestVersion);
                }
                else
                {
                    var currentSemVer = String.IsNullOrEmpty(localVersion) ? new SemVer() : SemVer.Create(localVersion);
                    if (currentSemVer.PreRelease != null && dlArgs.IgnorePrerelease)
                        currentSemVer = new SemVer();
                    var latestSemVer = SemVer.Create(latestVersion);
                    var comparison = currentSemVer.CompareTo(latestSemVer);

                    if ((comparison > 0 && specificVersionRequested) || comparison < 0)
                    {
                        downloadStrategy.DownloadVersion(latestVersion, dlArgs.Target);
                        ConsoleImpl.WriteDebug("Done.");
                    }
                    else
                    {
                        ConsoleImpl.WriteDebug("Paket.exe {0} is up to date.", localVersion);
                    }
                }
            }
            catch (WebException exn)
            {
                var shouldHandleException = true;
                if (!File.Exists(dlArgs.Target))
                {
                    if (downloadStrategy.FallbackStrategy != null)
                    {
                        var fallbackStrategy = downloadStrategy.FallbackStrategy;
                        ConsoleImpl.WriteDebug("'{0}' download failed. If using Mono, you may need to import trusted certificates using the 'mozroots' tool as none are contained by default. Trying fallback download from '{1}'.", downloadStrategy.Name, fallbackStrategy.Name);
                        StartPaketBootstrapping(fallbackStrategy, dlArgs, fileProxy);
                        shouldHandleException = !File.Exists(dlArgs.Target);
                    }
                }
                if (shouldHandleException)
                    handleException(exn);
            }
            catch (Exception exn)
            {
                handleException(exn);
            }
        }
コード例 #33
0
 public AppLogEntriesToFile(IComicPath comicPath, IFileProxy file)
 {
     this.comicPath = comicPath;
     this.file      = file;
 }
コード例 #34
0
 public ConvertSaveOperation(IConverterOptions options, IFileProxy fileProxy, IDirectoryHelper directoryHelper)
 {
     this.options = options;
     this.fileProxy = fileProxy;
     this.directoryHelper = directoryHelper;
 }
コード例 #35
0
 public SolutionConfigDataFactory(ISolutionProjectBlockHandler solutionProjectBlockHandler, IFileProxy fileProxy)
 {
     _solutionProjectBlockHandler = solutionProjectBlockHandler;
     _fileProxy = fileProxy;
 }
コード例 #36
0
 public GitHubDownloadStrategy(IWebRequestProxy webRequestProxy, IFileProxy fileProxy)
 {
     WebRequestProxy = webRequestProxy;
     FileProxy = fileProxy;
 }
コード例 #37
0
 public OutputConfigurationFileHelper(IFileProxy fileProxy, IEnvironmentProxy environmentProxy)
 {
     this.fileProxy        = fileProxy;
     this.environmentProxy = environmentProxy;
 }
コード例 #38
0
 public bool Elevate(IPluginProcess process)
 {
     if (process == null)
     {
         throw new ArgumentNullException();
     }
     if (RemotingServices.IsTransparentProxy(this.Proxy))
     {
         return false;
     }
     IPluginActivator activator = process as IPluginActivator;
     if (activator == null)
     {
         return false;
     }
     if (!(process.IsAlive || process.Start()))
     {
         return false;
     }
     this.FProxy = activator.Create<IFileProxy>("filesystemproxy");
     return true;
 }