Example #1
0
 public Bundler(IFileSystem system, IDeploymentController controller, DeploymentSettings settings, IBottleRepository bottles)
 {
     _system = system;
     _controller = controller;
     _settings = settings;
     _bottles = bottles;
 }
        public static IAppBuilder UseRazor(this IAppBuilder builder, IFileSystem fileSystem)
        {
            Requires.NotNull(builder, "builder");
            Requires.NotNull(fileSystem, "fileSystem");

            return UseRazor(builder, fileSystem, "/");
        }
 public CollectionManager(ILibraryManager libraryManager, IFileSystem fileSystem, ILibraryMonitor iLibraryMonitor, ILogger logger)
 {
     _libraryManager = libraryManager;
     _fileSystem = fileSystem;
     _iLibraryMonitor = iLibraryMonitor;
     _logger = logger;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProgressiveStreamWriter" /> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="fileSystem">The file system.</param>
 public ProgressiveStreamWriter(string path, ILogger logger, IFileSystem fileSystem, TranscodingJob job)
 {
     Path = path;
     Logger = logger;
     _fileSystem = fileSystem;
     _job = job;
 }
Example #5
0
        /// <summary>
        /// Sets the initial item values.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="args">The args.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="libraryManager">The library manager.</param>
        public static void SetInitialItemValues(BaseItem item, ItemResolveArgs args, IFileSystem fileSystem, ILibraryManager libraryManager)
        {
            // If the resolver didn't specify this
            if (string.IsNullOrEmpty(item.Path))
            {
                item.Path = args.Path;
            }

            // If the resolver didn't specify this
            if (args.Parent != null)
            {
                item.Parent = args.Parent;
            }

            item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());

            // Make sure the item has a name
            EnsureName(item, args.FileInfo);

            item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
                item.Parents.Any(i => i.IsLocked);

            // Make sure DateCreated and DateModified have values
            EnsureDates(fileSystem, item, args, true);
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="libraryMonitor">The directory watchers.</param>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="logger">The logger.</param>
 public ImageSaver(IServerConfigurationManager config, ILibraryMonitor libraryMonitor, IFileSystem fileSystem, ILogger logger)
 {
     _config = config;
     _libraryMonitor = libraryMonitor;
     _fileSystem = fileSystem;
     _logger = logger;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="directoryWatchers">The directory watchers.</param>
 public ImageSaver(IServerConfigurationManager config, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem)
 {
     _config = config;
     _directoryWatchers = directoryWatchers;
     _fileSystem = fileSystem;
     _remoteImageCache = new FileSystemRepository(config.ApplicationPaths.DownloadedImagesDataPath);
 }
 public static void Move(this IFileSystem sourceFileSystem, FileSystemPath sourcePath, IFileSystem destinationFileSystem, FileSystemPath destinationPath)
 {
     IEntityMover mover;
     if (!EntityMovers.Registration.TryGetSupported(sourceFileSystem.GetType(), destinationFileSystem.GetType(), out mover))
         throw new ArgumentException("The specified combination of file-systems is not supported.");
     mover.Move(sourceFileSystem, sourcePath, destinationFileSystem, destinationPath);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FanArtAlbumProvider"/> class.
 /// </summary>
 /// <param name="httpClient">The HTTP client.</param>
 /// <param name="logManager">The log manager.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="providerManager">The provider manager.</param>
 public FanArtAlbumProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager, IFileSystem fileSystem)
     : base(logManager, configurationManager)
 {
     _providerManager = providerManager;
     _fileSystem = fileSystem;
     HttpClient = httpClient;
 }
Example #10
0
 private static XDocument CreateDocument(XName rootName, IFileSystem fileSystem, string path)
 {
     XDocument document = new XDocument(new XElement(rootName));
     // Add it to the file system
     fileSystem.AddFile(path, document.Save);
     return document;
 }
Example #11
0
 private static XDocument GetDocument(IFileSystem fileSystem, string path)
 {
     using (Stream configStream = fileSystem.OpenFile(path))
     {
         return XDocument.Load(configStream, LoadOptions.PreserveWhitespace);
     }
 }
 protected override IPackageManager CreatePackageManager(IFileSystem packagesFolderFileSystem) {
     var sourceRepository = GetRepository();
     var pathResolver = new CustomPackagePathResolver(packagesFolderFileSystem, true) {
         OverlayDirectory = OverlayPackageDirectory
     };
     return new PackageManager(sourceRepository, pathResolver, packagesFolderFileSystem, new LocalPackageRepository(pathResolver, packagesFolderFileSystem)) { Logger = base.Console };
 }
		public ISharedPackageRepository CreateSharedRepository(IPackagePathResolver pathResolver, IFileSystem fileSystem, IFileSystem configSettingsFileSystem)
		{
			PathResolverPassedToCreateSharedRepository = pathResolver;
			FileSystemPassedToCreateSharedRepository = fileSystem;
			ConfigSettingsFileSystemPassedToCreateSharedRepository = configSettingsFileSystem;
			return FakeSharedRepository;
		}
 public DeploymentStatusManager(IEnvironment environment,
                                IFileSystem fileSystem)
 {
     _environment = environment;
     _fileSystem = fileSystem;
     _activeFile = Path.Combine(environment.DeploymentCachePath, Constants.ActiveDeploymentFile);
 }
Example #15
0
 protected WritableXapFile(string outputPath, IFileSystem fileSystem)
     : base(outputPath, fileSystem.OpenArchive(outputPath, ZipArchiveMode.Update))
 {
     FileSystem = fileSystem;
     OutputPath = outputPath;
     OutputArchive = InputArchive;
 }
 public EpisodeProviderFromXml(ILogManager logManager, IServerConfigurationManager configurationManager, IItemRepository itemRepo, IFileSystem fileSystem)
     : base(logManager, configurationManager)
 {
     _itemRepo = itemRepo;
     _fileSystem = fileSystem;
     Current = this;
 }
 public ScriptServices(
     IFileSystem fileSystem,
     IPackageAssemblyResolver packageAssemblyResolver, 
     IScriptExecutor executor,
     IScriptEngine engine,
     IFilePreProcessor filePreProcessor,
     IReplCommandService replCommandService,
     IScriptPackResolver scriptPackResolver, 
     IPackageInstaller packageInstaller,
     ILog logger,
     IAssemblyResolver assemblyResolver,
     IConsole console = null,
     IInstallationProvider installationProvider = null 
     )
 {
     FileSystem = fileSystem;
     PackageAssemblyResolver = packageAssemblyResolver;
     Executor = executor;
     Engine = engine;
     FilePreProcessor = filePreProcessor;
     ReplCommandService = replCommandService;
     ScriptPackResolver = scriptPackResolver;
     PackageInstaller = packageInstaller;
     Logger = logger;
     Console = console;
     AssemblyResolver = assemblyResolver;
     InstallationProvider = installationProvider;
 }
Example #18
0
 public Hooks(IFileSystem fileSystem, Purl path)
 {
   _path = path;
   _fileSystem = fileSystem;
   _hookTypes.Add(new HookType("cmd", typeof(CmdExecHook)));
   _hookTypes.Add(new HookType("ps1", typeof(PowershellHook)));
 }
Example #19
0
        public SessionHandler(ILogger<SessionHandler> logger,
            IEnvironment environment,
            IFileSystem fileSystem,
            IKeyValueStore keyValueStore,
            IMessageBus messageBus,
            ISession session,
            ITorrentInfoRepository torrentInfoRepository,
            ITorrentMetadataRepository metadataRepository)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (environment == null) throw new ArgumentNullException("environment");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (messageBus == null) throw new ArgumentNullException("messageBus");
            if (session == null) throw new ArgumentNullException("session");
            if (torrentInfoRepository == null) throw new ArgumentNullException("torrentInfoRepository");
            if (metadataRepository == null) throw new ArgumentNullException("metadataRepository");

            _logger = logger;
            _environment = environment;
            _fileSystem = fileSystem;
            _keyValueStore = keyValueStore;
            _messageBus = messageBus;
            _session = session;
            _torrentInfoRepository = torrentInfoRepository;
            _metadataRepository = metadataRepository;
            _muted = new List<string>();
            _alertsThread = new Thread(ReadAlerts);
        }
Example #20
0
 public ExecuteCore(IFileSystem fileSystem)
 {
     if (fileSystem == null) throw new ArgumentNullException("fileSystem");
     
     this.fileSystem = fileSystem;
     gitVersionCache = new GitVersionCache(fileSystem);
 }
        public static void Run(Arguments arguments, IFileSystem fileSystem)
        {
            Logger.WriteInfo(string.Format("Running on {0}.", runningOnMono ? "Mono" : "Windows"));

            var noFetch = arguments.NoFetch;
            var authentication = arguments.Authentication;
            var targetPath = arguments.TargetPath;
            var targetUrl = arguments.TargetUrl;
            var dynamicRepositoryLocation = arguments.DynamicRepositoryLocation;
            var targetBranch = arguments.TargetBranch;
            var commitId = arguments.CommitId;
            var overrideConfig = arguments.HasOverrideConfig ? arguments.OverrideConfig : null;

            var executeCore = new ExecuteCore(fileSystem);
            var variables = executeCore.ExecuteGitVersion(targetUrl, dynamicRepositoryLocation, authentication, targetBranch, noFetch, targetPath, commitId, overrideConfig);

            if (arguments.Output == OutputType.BuildServer)
            {
                foreach (var buildServer in BuildServerList.GetApplicableBuildServers())
                {
                    buildServer.WriteIntegration(Console.WriteLine, variables);
                }
            }

            if (arguments.Output == OutputType.Json)
            {
                switch (arguments.ShowVariable)
                {
                    case null:
                        Console.WriteLine(JsonOutputFormatter.ToJson(variables));
                        break;

                    default:
                        string part;
                        if (!variables.TryGetValue(arguments.ShowVariable, out part))
                        {
                            throw new WarningException(string.Format("'{0}' variable does not exist", arguments.ShowVariable));
                        }
                        Console.WriteLine(part);
                        break;
                }
            }

            using (var assemblyInfoUpdate = new AssemblyInfoFileUpdate(arguments, targetPath, variables, fileSystem))
            {
                var execRun = RunExecCommandIfNeeded(arguments, targetPath, variables);
                var msbuildRun = RunMsBuildIfNeeded(arguments, targetPath, variables);
                if (!execRun && !msbuildRun)
                {
                    assemblyInfoUpdate.DoNotRestoreAssemblyInfo();
                    //TODO Put warning back
                    //if (!context.CurrentBuildServer.IsRunningInBuildAgent())
                    //{
                    //    Console.WriteLine("WARNING: Not running in build server and /ProjectFile or /Exec arguments not passed");
                    //    Console.WriteLine();
                    //    Console.WriteLine("Run GitVersion.exe /? for help");
                    //}
                }
            }
        }
        /// <summary>
        /// Initialize the file system.
        /// </summary>
        /// <param name="fileSystem">File system.</param>
        public static void Initialize(IFileSystem fileSystem)
        {
            ExceptionHelper.ThrowIfNull("fileSystem", fileSystem);

            Current = fileSystem;
            LogService.Debug("FileSystem :: Initialized with {0}.", fileSystem);
        }
Example #23
0
        /// <summary>
        /// Sets the initial item values.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="libraryManager">The library manager.</param>
        /// <param name="directoryService">The directory service.</param>
        /// <exception cref="System.ArgumentException">Item must have a path</exception>
        public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
        {
            // This version of the below method has no ItemResolveArgs, so we have to require the path already being set
            if (string.IsNullOrWhiteSpace(item.Path))
            {
                throw new ArgumentException("Item must have a Path");
            }

            // If the resolver didn't specify this
            if (parent != null)
            {
                item.Parent = parent;
            }

            item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());

            item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
                item.Parents.Any(i => i.IsLocked);

            // Make sure DateCreated and DateModified have values
            var fileInfo = directoryService.GetFile(item.Path);
            item.DateModified = fileSystem.GetLastWriteTimeUtc(fileInfo);
            SetDateCreated(item, fileSystem, fileInfo);

            EnsureName(item, fileInfo);
        }
Example #24
0
        public GDIImageEncoder(IFileSystem fileSystem, ILogger logger)
        {
            _fileSystem = fileSystem;
            _logger = logger;

            LogInfo();
        }
        public void Init() {
            fileSystemMock = new Mock<IFileSystem>();
            var volumeProvider = new MockedVolumeProvider();

            
            fileSystem = new VolumeFileSystemDecorator(fileSystemMock.Object, volumeProvider); 
        }
Example #26
0
        /// <summary>
        /// Sets the initial item values.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="args">The args.</param>
        /// <param name="fileSystem">The file system.</param>
        public static void SetInitialItemValues(BaseItem item, ItemResolveArgs args, IFileSystem fileSystem)
        {
            // If the resolver didn't specify this
            if (string.IsNullOrEmpty(item.Path))
            {
                item.Path = args.Path;
            }

            // If the resolver didn't specify this
            if (args.Parent != null)
            {
                item.Parent = args.Parent;
            }

            item.Id = item.Path.GetMBId(item.GetType());

            // If the resolver didn't specify this
            if (string.IsNullOrEmpty(item.DisplayMediaType))
            {
                item.DisplayMediaType = item.GetType().Name;
            }

            // Make sure the item has a name
            EnsureName(item, args);

            item.DontFetchMeta = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
                item.Parents.Any(i => i.IsLocked);

            // Make sure DateCreated and DateModified have values
            EntityResolutionHelper.EnsureDates(fileSystem, item, args, true);
        }
Example #27
0
        public ConnectInfoForm()
        {
            XmlConfigurator.Configure();

            var settings = new NinjectSettings()
            {
                LoadExtensions = false
            };

            this.mKernel = new StandardKernel(
                settings,
                new Log4NetModule(),
                new ReportServerRepositoryModule());

            //this.mKernel.Load<FuncModule>();

            this.mLoggerFactory = this.mKernel.Get<ILoggerFactory>();
            this.mFileSystem = this.mKernel.Get<IFileSystem>();
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();

            InitializeComponent();

            this.LoadSettings();

            // Create the DebugForm and hide it if debug is False
            this.mDebugForm = new DebugForm();
            this.mDebugForm.Show();
            if (!this.mDebug)
                this.mDebugForm.Hide();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginsController" /> class.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="pluginsService">The plugins service.</param>
        /// <param name="nugetService">The nuget service.</param>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="readMeService">The read me service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="dialogService">The dialog service.</param>
        /// <param name="formsService">The forms service.</param>
        /// <param name="translator">The translator.</param>
        public PluginsController(
            IFileSystem fileSystem,
            IPluginsService pluginsService,
            INugetService nugetService,
            IVisualStudioService visualStudioService,
            IReadMeService readMeService,
            ISettingsService settingsService,
            IMessageBoxService messageBoxService,
            IDialogService dialogService,
            IFormsService formsService,
            ITranslator<Tuple<DirectoryInfoBase, DirectoryInfoBase>, Plugins> translator)
            : base(visualStudioService, 
            readMeService, 
            settingsService, 
            messageBoxService,
            dialogService,
            formsService)
        {
            TraceService.WriteLine("PluginsController::Constructor");

            this.fileSystem = fileSystem;
            this.pluginsService = pluginsService;
            this.nugetService = nugetService;
            this.translator = translator;
        }
Example #29
0
        public RepositorySettings(ISolutionManager solutionManager, IFileSystemProvider fileSystemProvider, IVsSourceControlTracker sourceControlTracker)
        {
            if (solutionManager == null)
            {
                throw new ArgumentNullException("solutionManager");
            }

            if (fileSystemProvider == null)
            {
                throw new ArgumentNullException("fileSystemProvider");
            }

            if (sourceControlTracker == null)
            {
                throw new ArgumentNullException("sourceControlTracker");
            }

            _solutionManager = solutionManager;
            _fileSystemProvider = fileSystemProvider;

            EventHandler resetConfiguration = (sender, e) =>
            {
                // Kill our configuration cache when someone closes the solution
                _configurationPath = null;
                _fileSystem = null;
            };

            _solutionManager.SolutionClosing += resetConfiguration;
            sourceControlTracker.SolutionBoundToSourceControl += resetConfiguration;
        }
 private static string GetDefaultDotNetReferenceAssembliesPath(IFileSystem fileSystem, IRuntimeEnvironment runtimeEnvironment)
 {            
     var os = runtimeEnvironment.OperatingSystemPlatform;
     
     if (os == Platform.Windows)
     {
         return null;
     }
     
     if (os == Platform.Darwin && 
         fileSystem.Directory.Exists("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks"))
     {
         return "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks";
     }
     
     if (fileSystem.Directory.Exists("/usr/local/lib/mono/xbuild-frameworks"))
     {
         return "/usr/local/lib/mono/xbuild-frameworks";
     }
     
     if (fileSystem.Directory.Exists("/usr/lib/mono/xbuild-frameworks"))
     {
         return "/usr/lib/mono/xbuild-frameworks";
     }
     
     return null;
 }