Exemplo n.º 1
0
 public FileAnalyzer(IFileSizeComparator fileSizeComparator, IFileNameCreator fileNameCreator,
                     IDirectoryWrapper directoryWrapper)
 {
     _fileSizeComparator = fileSizeComparator;
     _fileNameCreator    = fileNameCreator;
     _directoryWrapper   = directoryWrapper;
 }
        private string CreateCollectionPath(IDirectoryWrapper directoryWrapper, params String[] pathChunks)
        {
            string pathResult = Path.Combine(pathChunks);

            directoryWrapper.CreateWhenNonExists(pathResult);
            return(pathResult);
        }
Exemplo n.º 3
0
 public POFileService(IGetTextCatalogService catalog, IDirectoryWrapper directoryWrapper, IFileWrapper fileWrapper, ILogger <POFileService> logger)
 {
     _catalog          = catalog;
     _directoryWrapper = directoryWrapper;
     _fileWrapper      = fileWrapper;
     _logger           = logger;
 }
Exemplo n.º 4
0
 public AudioLocalRepositoryBuilder()
 {
     _pathWrapper = Substitute.For<IPathWrapper>();
     _streamFactory = Substitute.For<IFileStreamFactory>();
     _directoryWrapper = Substitute.For<IDirectoryWrapper>();
     _fileWrapper = Substitute.For<IFileWrapper>();
 }
 public VirtualArsenalFilesLocatorService(IConfigurationService configurationService, IDirectoryWrapper directoryWrapper, IEnvironmentWrapper environmentWrapper, IFileWrapper fileWrapper)
 {
     _configurationService = configurationService;
     _directoryWrapper     = directoryWrapper;
     _environmentWrapper   = environmentWrapper;
     _fileWrapper          = fileWrapper;
 }
Exemplo n.º 6
0
 public StaticLoader(IAttributesLoader attributesLoader, IDirectoryWrapper directoryWrapper)
 {
     _stepRegistry     = new StepRegistry();
     _attributesLoader = attributesLoader;
     _directoryWrapper = directoryWrapper;
     LoadImplementations();
 }
Exemplo n.º 7
0
 public /*for testing*/ TargetsInstaller(ILogger logger, IMsBuildPathsSettings msBuildPathsSettings,
                                         IFileWrapper fileWrapper, IDirectoryWrapper directoryWrapper)
 {
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.msBuildPathsSettings = msBuildPathsSettings ?? throw new ArgumentNullException(nameof(msBuildPathsSettings));
     this.fileWrapper          = fileWrapper ?? throw new ArgumentNullException(nameof(fileWrapper));
     this.directoryWrapper     = directoryWrapper ?? throw new ArgumentNullException(nameof(directoryWrapper));
 }
Exemplo n.º 8
0
 public TxtHandler(IFileWrapper file, IFileInfoWrapper fileInfo, IConsoleWrapper console, IDirectoryWrapper directory)
     : base(file, fileInfo, console, directory)
 {
     _file      = file;
     _fileInfo  = fileInfo;
     _console   = console;
     _directory = directory;
 }
Exemplo n.º 9
0
 public ScriptLoader(IFileWrapper file, IDirectoryWrapper directory, IScriptAnalyser analyser, IBuildScriptLocator buildScriptLocator, ILogger <ScriptLoader> log)
 {
     _file               = file;
     _directory          = directory;
     _analyser           = analyser;
     _log                = log;
     _buildScriptLocator = buildScriptLocator;
 }
Exemplo n.º 10
0
 public I18nParserService(IDirectoryWrapper directoryWrapper, IFileWrapper fileWrapper, IHtmlParserService htmlParser, ILogger <I18nParserService> logger, IPOFileService poFileService, IPOTFileService potFileService)
 {
     _directoryWrapper = directoryWrapper;
     _fileWrapper      = fileWrapper;
     _htmlParser       = htmlParser;
     _logger           = logger;
     _poFileService    = poFileService;
     _potFileService   = potFileService;
 }
Exemplo n.º 11
0
 public XmlFileService(
     IPathUtility pathUtility,
     IFileWrapper file,
     IDirectoryWrapper directory)
 {
     this.pathUtility = pathUtility;
     this.file        = file;
     this.directory   = directory;
 }
Exemplo n.º 12
0
        public void SetUp()
        {
            var services = new Hero6ServicesProvider();

            file      = services.File;
            directory = Substitute.For <IDirectoryWrapper>();

            userSettings = MakeUserSettings();
        }
Exemplo n.º 13
0
        protected override void SetUp()
        {
            base.SetUp();

            pathUtility = NewMock <IPathUtility>();
            file        = NewMock <IFileWrapper>();
            directory   = NewMock <IDirectoryWrapper>();

            xmlFileService = new XmlFileService(pathUtility, file, directory);
        }
Exemplo n.º 14
0
 public AudioLocalRepositoryImpl(
     IPathWrapper pathWrapper,
     IDirectoryWrapper directoryWrapper,
     IFileStreamFactory streamFactory,
     IFileWrapper fileWrapper)
 {
     _directoryWrapper = directoryWrapper;
     _streamFactory    = streamFactory;
     _fileWrapper      = fileWrapper;
     _pathWrapper      = pathWrapper;
 }
Exemplo n.º 15
0
        protected AbstractHandler(IFileWrapper file,
                                  IFileInfoWrapper fileInfo,
                                  IConsoleWrapper console,
                                  IDirectoryWrapper directory)

        {
            _file      = file;
            _fileInfo  = fileInfo;
            _console   = console;
            _directory = directory;
        }
 public WebPageLoader(string rootUrl, List <string> extensions = null,
                      bool isVerbose = true, DomainLimit domainLimit = DomainLimit.WithoutLimits)
 {
     _rootUrl             = rootUrl;
     _availableExtensions = extensions;
     _parser           = new WebPageParser();
     _reader           = new WebPageReader();
     _directoryWrapper = new DirectoryWrapper(rootUrl);
     _fileWrapper      = new FileWrapper(rootUrl);
     _isVerbose        = isVerbose;
     _domainLimit      = domainLimit;
 }
Exemplo n.º 17
0
        public UserSettings(IFileWrapper file, IDirectoryWrapper directory, IGameSettings gameSettings)
        {
            this.file         = file;
            this.directory    = directory;
            this.gameSettings = gameSettings;

            data = file.Exists(Filename)
                ? JsonConvert.DeserializeObject <UserSettingsData>(file.ReadAllText(Filename))
                : new UserSettingsData();

            GameStartedCount++;

            Save();
        }
Exemplo n.º 18
0
        public FileManagerTests()
        {
            _environment      = A.Fake <IHostingEnvironment>();
            _formFile         = A.Fake <IFormFile>();
            _fileSystem       = A.Fake <IFileSystemWrapper>();
            _pathWrapper      = A.Fake <IPathWrapper>();
            _fileWrapper      = A.Fake <IFileWrapper>();
            _directoryWrapper = A.Fake <IDirectoryWrapper>();

            A.CallTo(() => _fileSystem.File).Returns(_fileWrapper);
            A.CallTo(() => _fileSystem.Directory).Returns(_directoryWrapper);
            A.CallTo(() => _fileSystem.Path).Returns(_pathWrapper);

            sut = new FileManager(_environment, _fileSystem);
        }
Exemplo n.º 19
0
 protected BundleBase(IFileWriterFactory fileWriterFactory, IFileReaderFactory fileReaderFactory, IDebugStatusReader debugStatusReader, IDirectoryWrapper directoryWrapper, IHasher hasher, IBundleCache bundleCache)
 {
     this.fileWriterFactory = fileWriterFactory;
     this.fileReaderFactory = fileReaderFactory;
     this.debugStatusReader = debugStatusReader;
     this.directoryWrapper  = directoryWrapper;
     this.hasher            = hasher;
     bundleState            = new BundleState
     {
         DebugPredicate = Configuration.Instance.DefaultDebugPredicate(),
         ShouldRenderOnlyIfOutputFileIsMissing = false,
         HashKeyName = "r"
     };
     this.bundleCache = bundleCache;
 }
        public UnifiToFileSystemExporter(
            IBlacklist blacklist,
            IDirectoryWrapper directoryWrapperInstance,
            IFileWrapper fileWrapper,
            ICustomLogger customLogger,
            string rootPath)
        {
            _directoryWrapper = directoryWrapperInstance;
            _fileWrapper      = fileWrapper;
            _customLogger     = customLogger;
            _rootPath         = rootPath;

            CheckRootPath(directoryWrapperInstance);
            _dateTimeStamp = DateTime.Now.ToString("dd_MM_yyyy_HH-mm-ss");
            _blacklist     = blacklist;
        }
Exemplo n.º 21
0
 public ScriptLoader(
     IFileWrapper file,
     IDirectoryWrapper directory,
     IProjectFileAnalyzer projectFileAnalyzer,
     IScriptAnalyzer scriptAnalyzer,
     IBuildScriptLocator buildScriptLocator,
     INugetPackageResolver nugetPackageResolver,
     ILogger <ScriptLoader> log)
 {
     _file                = file;
     _directory           = directory;
     _projectFileAnalyzer = projectFileAnalyzer;
     _scriptAnalyzer      = scriptAnalyzer;
     _log = log;
     _buildScriptLocator   = buildScriptLocator;
     _nugetPackageResolver = nugetPackageResolver;
 }
Exemplo n.º 22
0
        public UserSettings(IFileWrapper file, IDirectoryWrapper directory)
        {
            this.file      = file;
            this.directory = directory;

            if (file.Exists(Filename))
            {
                data = JsonConvert.DeserializeObject <UserSettingsData>(file.ReadAllText(Filename));
            }
            else
            {
                data = new UserSettingsData();
            }

            GameStartedCount++;

            Save();
        }
Exemplo n.º 23
0
 public PostCodeService(IFileIo fileIo, IDirectoryWrapper directory, IPostCodeValidationService postCodeValidationService)
 {
     if (fileIo == null)
     {
         throw new ArgumentNullException(nameof(fileIo));
     }
     if (directory == null)
     {
         throw new ArgumentNullException(nameof(directory));
     }
     if (postCodeValidationService == null)
     {
         throw new ArgumentNullException(nameof(postCodeValidationService));
     }
     _fileIo    = fileIo;
     _directory = directory;
     _postCodeValidationService = postCodeValidationService;
 }
Exemplo n.º 24
0
        public void Init()
        {
            _mockFileInfo = Substitute.For <IFileInfoWrapper>();
            _mockFileInfo.Name.Returns("fileInfoName");
            _mockFileInfo.FullName.Returns("fullFileName");
            _mockFileInfo.CreationTime.Returns(new DateTime(2020, 12, 31));
            _mockFileInfo.Extension.Returns(".txt");

            _mockConsole = Substitute.For <IConsoleWrapper>();

            _mockFile = Substitute.For <IFileWrapper>();
            _mockFile.ReadAllText(_mockFileInfo.Name).Returns("5545");

            _mockDirectory = Substitute.For <IDirectoryWrapper>();
            _mockDirectory.CreateDirectory(_mockFileInfo.Name);
            _mockDirectory.GetCreationTime(_mockFileInfo.CreationTime.ToString(CultureInfo.InvariantCulture));

            _target = new TxtHandler(_mockFile, _mockFileInfo, _mockConsole, _mockDirectory);
        }
Exemplo n.º 25
0
        private const int MAX_PHOTO_SIZE_IN_BYTES = 30 * 1024 * 1024; // 30 MB

        public UploadApiController(
            IPathUtil pathUtil,
            IDirectoryWrapper directoryWrapper,
            IFileHelper fileHelper,
            IFileWrapper fileWrapper,
            IPhotoService photoService,
            IAlbumService albumService,
            ICryptoProvider cryptoProvider,
            IPhotoProcessor photoProcessor,
            ICollageProcessor collageProcessor)
        {
            _pathUtil         = pathUtil;
            _directoryWrapper = directoryWrapper;
            _fileHelper       = fileHelper;
            _fileWrapper      = fileWrapper;
            _photoService     = photoService;
            _albumService     = albumService;
            _cryptoProvider   = cryptoProvider;
            _photoProcessor   = photoProcessor;
            _collageProcessor = collageProcessor;
        }
Exemplo n.º 26
0
        public WorkspacesManagerVm(WindsorContainer applicationWindsorContainer,
                                   IWorkspacesManagerView workspacesManagerView,
                                   IDetectiveMessenger messenger,
                                   ISerializationPersistor <Workspace> workspaceSerializationPersistor,
                                   IDirectoryWrapper directoryWrapper,
                                   IWorkspacePathSerializationPersistor workspacePathSerializationPersistor)
            : base(applicationWindsorContainer)
        {
            this._workspacePathSerializationPersistor = workspacePathSerializationPersistor;
            this._directoryWrapper = directoryWrapper;
            this._workspaceSerializationPersistor = workspaceSerializationPersistor;
            this.View       = workspacesManagerView;
            this.IsHidden   = false;
            this.IsSelected = true;

            this.LoadWorkspacesFromLastSession();

            this._messenger = messenger;
            this._messenger.Register <LoadedWorkspaceMessage>(this, this.LoadedWorkspaceMessageReceived);
            this._messenger.Register <ExitedApplicationMessage>(this, this.ExitedApplicationMessageReceived);
            this._messenger.Register <CreatedWorkspaceMessage>(this, this.CreatedWorkspaceMessageReceived);
        }
        public void BackupDatabase(IWrapperProvider wrapperProvider, string path)
        {
            IPathWrapper      pathWrapper      = wrapperProvider.GetWrapper <IPathWrapper>();
            IDirectoryWrapper directoryWrapper = wrapperProvider.GetWrapper <IDirectoryWrapper>();
            IFileWrapper      fileWrapper      = wrapperProvider.GetWrapper <IFileWrapper>();
            //copy data.xml to data.xml.bak
            //copy data.xml to data_date.bak - it will override last dayily backup. first run of day will create new one
            string backupFileName = pathWrapper.GetFileNameWithoutExtension(path) + DateTime.Now.ToString("yyyyMMdd");
            string backupPath     = pathWrapper.Combine(
                pathWrapper.GetDirectoryName(path),
                backupFileName);

            backupPath = pathWrapper.ChangeExtension(backupPath, pathWrapper.GetExtension(path));

            bool backupExists = File.Exists(backupPath);

            File.Copy(path, backupPath, true);

            if (!backupExists)
            {
                ManageBackups(path, pathWrapper, directoryWrapper, fileWrapper);
            }
        }
        public void ManageBackups(
            string path,
            IPathWrapper pathWrapper,
            IDirectoryWrapper directoryWrapper,
            IFileWrapper fileWrapper)
        {
            string dataFileFilter = Path.ChangeExtension(
                string.Format("{0}*", Path.GetFileNameWithoutExtension(DataFile)),
                Path.GetExtension(DataFile));
            var backupFiles = directoryWrapper.EnumerateFiles(
                pathWrapper.GetDirectoryName(path),
                dataFileFilter).Where(f => f != FullDataFilePath).OrderByDescending(f => f);
            //first save of day - delete old backups
            int backupcount = backupFiles.Count();
            int skipfiles   = 7; //backups to keep

            if (backupcount > skipfiles)
            {
                foreach (string s in backupFiles.Skip(skipfiles))
                {
                    fileWrapper.Delete(s);
                }
            }
        }
Exemplo n.º 29
0
 JavaScriptBundleFactory WithCurrentDirectoryWrapper(IDirectoryWrapper directoryWrapper)
 {
     this.directoryWrapper = directoryWrapper;
     return this;
 }
Exemplo n.º 30
0
 public IOWrapper(IFileWrapper fileWrapper, IDirectoryWrapper directoryWrapper)
 {
     Assert.IsNotNull(fileWrapper, "fileWrapper");
     Assert.IsNotNull(directoryWrapper, "directoryWrapper");
 }
Exemplo n.º 31
0
 public CSSBundleFactory WithCurrentDirectoryWrapper(IDirectoryWrapper directoryWrapper)
 {
     this.directoryWrapper = directoryWrapper;
     return this;
 }
Exemplo n.º 32
0
 public AssemblyLocater(IDirectoryWrapper directoryWrapper)
 {
     _directoryWrapper = directoryWrapper;
 }
Exemplo n.º 33
0
 public AudioLocalRepositoryBuilder WithDirectoryWrapper(IDirectoryWrapper directoryWrapper)
 {
     _directoryWrapper = directoryWrapper;
     return this;
 }