public static Result CreateSaveData(this FileSystemClient fs, Ncm.ApplicationId applicationId, UserId userId, ulong ownerId, long size, long journalSize, SaveDataFlags flags) { return(fs.RunOperationWithAccessLog(AccessLogTarget.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute(applicationId, SaveDataType.Account, userId, 0); var createInfo = new SaveDataCreationInfo { Size = size, JournalSize = journalSize, BlockSize = 0x4000, OwnerId = ownerId, Flags = flags, SpaceId = SaveDataSpaceId.User }; var metaInfo = new SaveMetaCreateInfo { Type = SaveDataMetaType.Thumbnail, Size = 0x40060 }; return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo); }, () => $", applicationid: 0x{applicationId.Value:X}, userid: 0x{userId}, save_data_owner_id: 0x{ownerId:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}")); }
/// <exception cref="ArgumentNullException"> /// <paramref name="archiveCurrentSaveDirectory"/> or /// <paramref name="httpDownloadManager"/> or /// <paramref name="fileSystemProxy"/> is <see langword="null" />.</exception> public PluralsightWebDataService(string archiveCurrentSaveDirectory, IHttpDownloadManager httpDownloadManager, IFileSystemProxy fileSystemProxy, bool createArchives = true) : base(fileSystemProxy) { if (archiveCurrentSaveDirectory == null) { throw new ArgumentNullException("archiveCurrentSaveDirectory"); } if (httpDownloadManager == null) { throw new ArgumentNullException("httpDownloadManager"); } if (fileSystemProxy == null) { throw new ArgumentNullException("fileSystemProxy"); } _archiveCurrentSaveDirectory = archiveCurrentSaveDirectory; _httpDownloadManager = httpDownloadManager; _authorsInfoContainer = new Dictionary <string, string>(); _coursesInfoContainer = new Dictionary <string, string>(); _coursesToCContainer = new Dictionary <string, string>(); _courseSpecializationsContainer = new AsyncLazy <Dictionary <string, Specializations> >(async() => await InitializeCourseSpecializationContainerAsync()); _createArchives = createArchives; }
public static Result CreateBcatSaveData(this FileSystemClient fs, Ncm.ApplicationId applicationId, long size) { return(fs.RunOperationWithAccessLog(AccessLogTarget.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute(applicationId, SaveDataType.Bcat, UserId.Zero, 0); var createInfo = new SaveDataCreationInfo { Size = size, JournalSize = 0x200000, BlockSize = 0x4000, OwnerId = SystemProgramId.Bcat.Value, Flags = 0, SpaceId = SaveDataSpaceId.User }; var metaInfo = new SaveMetaCreateInfo(); return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo); }, () => $", applicationid: 0x{applicationId.Value:X}, save_data_size: {size}")); }
public ModificationComponentFactory(IFileSystemProxy fileSystemProxy, IPofContext pofContext, SlotSourceFactory slotSourceFactory, IPofSerializer serializer) { this.fileSystemProxy = fileSystemProxy; this.pofContext = pofContext; this.slotSourceFactory = slotSourceFactory; this.serializer = serializer; }
public NugetDownloadStrategy(IWebRequestProxy webRequestProxy, IFileSystemProxy fileSystemProxy, string folder, string nugetSource) { WebRequestProxy = webRequestProxy; FileSystemProxy = fileSystemProxy; Folder = folder; NugetSource = nugetSource; }
/// <exception cref="ArgumentNullException"> /// <paramref name="htmlLoader" /> or /// <paramref name="parser" /> or /// <paramref name="backupProcessor" /> or /// <paramref name="httpDownloadManager" /> or /// <paramref name="dataService" /> or /// <paramref name="fileSystemProxy" /> is <see langword="null" />.</exception> internal PluralsightCatalog(IHtmlLoader htmlLoader, ITrainingCatalogParser <PluralsightCategory, PluralsightCourse, PluralsightAuthor> parser, ICatalogBackupProcessor <PluralsightCategory, PluralsightCourse, PluralsightAuthor> backupProcessor, IHttpDownloadManager httpDownloadManager, IPluralsightDataService dataService, IFileSystemProxy fileSystemProxy) : base(httpDownloadManager, fileSystemProxy) { if (htmlLoader == null) { throw new ArgumentNullException("htmlLoader"); } if (parser == null) { throw new ArgumentNullException("parser"); } if (backupProcessor == null) { throw new ArgumentNullException("backupProcessor"); } if (dataService == null) { throw new ArgumentNullException("dataService"); } _htmlLoader = htmlLoader; _parser = parser; _backupProcessor = backupProcessor; _dataService = dataService; }
public static Result FindSaveDataWithFilter(this FileSystemClient fs, out SaveDataInfo info, SaveDataSpaceId spaceId, ref SaveDataFilter filter) { info = default; SaveDataFilter tempFilter = filter; var tempInfo = new SaveDataInfo(); Result result = fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); tempInfo = new SaveDataInfo(); Result rc = fsProxy.FindSaveDataWithFilter(out long count, SpanHelpers.AsByteSpan(ref tempInfo), spaceId, ref tempFilter); if (rc.IsFailure()) { return(rc); } if (count == 0) { return(ResultFs.TargetNotFound.Log()); } return(Result.Success); },
public static string GetBootstrapperArgsForFolder(IFileSystemProxy proxy) { try { var folder = proxy.GetCurrentDirectory(); var path = LocateDependenciesFile(proxy, new DirectoryInfo(folder)); if (path == null) { ConsoleImpl.WriteTrace("Dependencies file was not found."); return(null); } using (var fileStream = proxy.OpenRead(path)) { using (var reader = new StreamReader(fileStream)) { return(GetBootstrapperArgs(reader)); } } } catch (Exception e) { // ¯\_(ツ)_/¯ ConsoleImpl.WriteTrace("Error while retrieving arguments from paket.dependencies file: {0}", e); return(null); } }
public static Result CreateTemporaryStorage(this FileSystemClient fs, TitleId applicationId, TitleId ownerId, long size, uint flags) { return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute { TitleId = applicationId, Type = SaveDataType.TemporaryStorage }; var createInfo = new SaveDataCreateInfo { Size = size, BlockSize = 0x4000, OwnerId = ownerId, Flags = flags, SpaceId = SaveDataSpaceId.TemporaryStorage }; var metaInfo = new SaveMetaCreateInfo(); return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo); }, () => $", applicationid: 0x{applicationId.Value:X}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_flags: 0x{flags:x8}")); }
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId, ulong saveDataId, UserId userId) { Result rc = MountHelpers.CheckMountName(mountName); if (rc.IsFailure()) { return(rc); } IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); SaveDataAttribute attribute = default; attribute.UserId = userId; attribute.SaveDataId = saveDataId; rc = fsProxy.OpenSaveDataFileSystemBySystemSaveDataId(out IFileSystem fileSystem, spaceId, ref attribute); if (rc.IsFailure()) { return(rc); } return(fs.Register(mountName, fileSystem)); }
protected FileSystemDataModelRepository( IFileSystemProxy <T> fileSystemProxy, IDataModelFileAdapter <T> dataModelFileAdapter) { _fileProxy = fileSystemProxy; _dataModelFileAdapter = dataModelFileAdapter; }
public static Result CreateCacheStorage(this FileSystemClient fs, TitleId applicationId, SaveDataSpaceId spaceId, TitleId ownerId, short index, long size, long journalSize, SaveDataFlags flags) { return(fs.RunOperationWithAccessLog(AccessLogTarget.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute { TitleId = applicationId, Type = SaveDataType.Cache, Index = index }; var creationInfo = new SaveDataCreationInfo { Size = size, JournalSize = journalSize, BlockSize = 0x4000, OwnerId = ownerId, Flags = flags, SpaceId = spaceId }; var metaInfo = new SaveMetaCreateInfo(); return fsProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaInfo); }, () => $", applicationid: 0x{applicationId.Value:X}, savedataspaceid: {spaceId}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}")); }
/// <exception cref="ArgumentNullException"> /// <paramref name="archiveFolderPath"/> or /// <paramref name="fileSystemProxy"/> is <see langword="null" />.</exception> public PluralsightArchiveDataService(string archiveFolderPath, IFileSystemProxy fileSystemProxy) : base(fileSystemProxy) { if (archiveFolderPath == null) { throw new ArgumentNullException("archiveFolderPath"); } if (fileSystemProxy == null) { throw new ArgumentNullException("fileSystemProxy"); } _archiveFolderPath = archiveFolderPath; _authorsInfoArchive = new AsyncLazy <Dictionary <string, string> >(async() => await MergeArchivesAsync <string>(AuthorsArchiveNamePrefix)); _coursesInfoArchive = new AsyncLazy <Dictionary <string, string> >(async() => { foreach (var entry in await _authorsInfoArchive) { UpdateAuthorCoursesDictionary(entry.Value); } return(await MergeArchivesAsync <string>(CoursesArchiveNamePrefix)); }); _coursesToCArchive = new AsyncLazy <Dictionary <string, string> >(async() => await MergeArchivesAsync <string>(CoursesToCArchiveNamePrefix)); _courseSpecializationsArchive = new AsyncLazy <Dictionary <string, Specializations> >(async() => await InitializeCourseSpecializationContainerAsync()); }
public static Result CreateSaveData(this FileSystemClient fs, TitleId applicationId, UserId userId, TitleId ownerId, long size, long journalSize, HashSalt hashSalt, uint flags) { return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute { TitleId = applicationId, UserId = userId, Type = SaveDataType.SaveData }; var createInfo = new SaveDataCreateInfo { Size = size, JournalSize = journalSize, BlockSize = 0x4000, OwnerId = ownerId, Flags = flags, SpaceId = SaveDataSpaceId.User }; var metaInfo = new SaveMetaCreateInfo { Type = SaveMetaType.Thumbnail, Size = 0x40060 }; return fsProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref createInfo, ref metaInfo, ref hashSalt); }, () => $", applicationid: 0x{applicationId.Value:X}, userid: 0x{userId}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{flags:x8}")); }
// ReSharper disable once UnusedParameter.Local private static Result MountBisImpl(FileSystemClient fs, U8Span mountName, BisPartitionId partitionId, U8Span rootPath) { Result rc = MountHelpers.CheckMountNameAcceptingReservedMountName(mountName); if (rc.IsFailure()) { return(rc); } FsPath sfPath; unsafe { _ = &sfPath; } // workaround for CS0165 IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); // Nintendo doesn't use the provided rootPath sfPath.Str[0] = 0; rc = fsProxy.OpenBisFileSystem(out IFileSystem fileSystem, ref sfPath, partitionId); if (rc.IsFailure()) { return(rc); } var nameGenerator = new BisCommonMountNameGenerator(partitionId); return(fs.Register(mountName, fileSystem, nameGenerator)); }
public static Result CreateBcatSaveData(this FileSystemClient fs, TitleId applicationId, long size) { return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute { TitleId = applicationId, Type = SaveDataType.BcatDeliveryCacheStorage }; var createInfo = new SaveDataCreateInfo { Size = size, JournalSize = 0x200000, BlockSize = 0x4000, OwnerId = SystemTitleIds.Bcat, Flags = 0, SpaceId = SaveDataSpaceId.User }; var metaInfo = new SaveMetaCreateInfo(); return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo); }, () => $", applicationid: 0x{applicationId.Value:X}, save_data_size: {size}")); }
public static Result OpenGameCardPartition(this FileSystemClient fs, out IStorage storage, GameCardHandle handle, GameCardPartitionRaw partitionType) { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return(fsProxy.OpenGameCardStorage(out storage, handle, partitionType)); }
public static bool ValidateHash(IFileSystemProxy fileSystem, PaketHashFile hashFile, string version, string paketFile) { if (hashFile == null) { ConsoleImpl.WriteTrace("No hashFile file expected, bypassing check."); return(true); } var dict = hashFile.Content .Select(i => i.Split(' ')) .ToDictionary(i => i[1], i => i[0]); string expectedHash; if (!dict.TryGetValue("paket.exe", out expectedHash)) { throw new InvalidDataException("Paket hashFile file is corrupted"); } using (var stream = fileSystem.OpenRead(paketFile)) using (var sha = SHA256.Create()) { byte[] checksum = sha.ComputeHash(stream); var hash = BitConverter.ToString(checksum).Replace("-", String.Empty); ConsoleImpl.WriteTrace("Expected hash = {0}", expectedHash); ConsoleImpl.WriteTrace("paket.exe hash = {0} ({1})", hash, paketFile); return(string.Equals(expectedHash, hash, StringComparison.OrdinalIgnoreCase)); } }
private static bool GetIsMagicMode(IFileSystemProxy fileSystemProxy) { // Magic mode is defined by the bootstrapper being renamed 'paket.exe' var fileName = Path.GetFileName(fileSystemProxy.GetExecutingAssemblyPath()); return(string.Equals(fileName, "paket.exe", StringComparison.OrdinalIgnoreCase)); }
/// <exception cref="ArgumentNullException"> /// <paramref name="trainingProviderName"/> or /// <paramref name="mediaPath"/> or /// <paramref name="httpDownloadManager"/> or /// <paramref name="fileSystemProxy"/> /// is <see langword="null" />.</exception> internal TrainingCatalogMediaContentProcessor(int trainingProviderId, string trainingProviderName, IMediaPath mediaPath, IHttpDownloadManager httpDownloadManager, IFileSystemProxy fileSystemProxy) { if (trainingProviderName == null) { throw new ArgumentNullException("trainingProviderName"); } if (mediaPath == null) { throw new ArgumentNullException("mediaPath"); } if (mediaPath == null) { throw new ArgumentNullException("httpDownloadManager"); } if (mediaPath == null) { throw new ArgumentNullException("fileSystemProxy"); } _trainingProviderName = trainingProviderName; _trainingProviderId = trainingProviderId; _mediaPath = mediaPath; _httpDownloadManager = httpDownloadManager; _fileSystemProxy = fileSystemProxy; }
// todo: Decide how to handle SetBisRootForHost since it allows mounting any directory on the user's computer public static Result SetBisRootForHost(this FileSystemClient fs, BisPartitionId partitionId, U8Span rootPath) { FsPath sfPath; unsafe { _ = &sfPath; } // workaround for CS0165 int pathLen = StringUtils.GetLength(rootPath, PathTools.MaxPathLength + 1); if (pathLen > PathTools.MaxPathLength) { return(ResultFs.TooLongPath.Log()); } if (pathLen > 0) { byte endingSeparator = PathTool.IsSeparator(rootPath[pathLen - 1]) ? StringTraits.NullTerminator : StringTraits.DirectorySeparator; var sb = new U8StringBuilder(sfPath.Str); Result rc = sb.Append(rootPath).Append(endingSeparator).ToSfPath(); if (rc.IsFailure()) { return(rc); } } else { sfPath.Str[0] = StringTraits.NullTerminator; } IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return(fsProxy.SetBisRootForHost(partitionId, ref sfPath)); }
public static Result CreateSystemSaveData(this FileSystemClient fs, SaveDataSpaceId spaceId, ulong saveDataId, UserId userId, TitleId ownerId, long size, long journalSize, uint flags) { return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); var attribute = new SaveDataAttribute { UserId = userId, SaveDataId = saveDataId }; var createInfo = new SaveDataCreateInfo { Size = size, JournalSize = journalSize, BlockSize = 0x4000, OwnerId = ownerId, Flags = flags, SpaceId = spaceId }; return fsProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref createInfo); }, () => $", savedataspaceid: {spaceId}, savedataid: 0x{saveDataId:X}, userid: 0x{userId.Id.High:X16}{userId.Id.Low:X16}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{flags:X8}")); }
public FileRenameCommand(IFileSystemProxy fileSystemProxy, IImageProcessor imageProcessor, IFileNameFormatter fileNameFormatter, IDirectoryNameFormatter directoryNameFormatter) { _directoryNameFormatter = directoryNameFormatter; _fileNameFormatter = fileNameFormatter; _imageProcessor = imageProcessor; _fileSystemProxy = fileSystemProxy; }
public static Result GetRightsId(this FileSystemClient fs, out FsRightsId rightsId, TitleId programId, StorageId storageId) { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return(fsProxy.GetRightsId(out rightsId, programId, storageId)); }
public static BootstrapperOptions ParseArgumentsAndConfigurations(IEnumerable<string> arguments, NameValueCollection appSettings, IDictionary envVariables, IFileSystemProxy fileSystem, IEnumerable<string> argumentsInDependenciesFile) { var options = new BootstrapperOptions(); var commandArgs = arguments.ToList(); var magicMode = GetIsMagicMode(fileSystem); var transparentMagicMode = magicMode && commandArgs.IndexOf(CommandArgs.Run) == -1; FillTarget(options.DownloadArguments, magicMode, fileSystem); // 1 - AppSettings FillOptionsFromAppSettings(options, appSettings); // 2 - paket.dependencies FillNonRunOptionsFromArguments(options, argumentsInDependenciesFile.ToList()); // 3 - Environment variables FillOptionsFromEnvVariables(options, envVariables); // 4 - Command line if (transparentMagicMode) { // Transparent magic mode mean that we're renamed 'paket.exe' and --run wasn't passed // Virtually add a '-s' options.Verbosity -= 1; // Assume --run and that all arguments are for the real paket binary options.Run = true; options.RunArgs = new List<string>(commandArgs); commandArgs.Clear(); // Don't check more than twice a day // - Except if we want pre-releases as we're living on the bleeding edge // - Or if we specify a fixed version because it will never check anyway // - Or if the user specified any other value via 'paket.dependencies' if (options.DownloadArguments.IgnorePrerelease && string.IsNullOrEmpty(options.DownloadArguments.LatestVersion) && options.DownloadArguments.MaxFileAgeInMinutes == null) { options.DownloadArguments.MaxFileAgeInMinutes = 60*12; } } else { FillRunOptionsFromArguments(options, commandArgs); FillNonRunOptionsFromArguments(options, commandArgs); } if (!options.DownloadArguments.IgnorePrerelease && !string.IsNullOrEmpty(options.DownloadArguments.LatestVersion)) { // PreRelease + specific version -> we prefer the specific version options.DownloadArguments.IgnorePrerelease = true; } options.UnprocessedCommandArgs = commandArgs; return options; }
public TemporaryFileServiceImpl(IClientConfiguration configuration, IFileSystemProxy fileSystemProxy) { this.configuration = configuration; this.fileSystemProxy = fileSystemProxy; this.temporaryDirectoryRoot = Path.Combine(configuration.UserDataDirectoryPath, "temp");; this.temporaryFilesLockPath = Path.Combine(temporaryDirectoryRoot, "LOCK"); this.temporaryFilesLock = new FileLock(temporaryFilesLockPath); }
public TemporaryFileServiceImpl(IClientConfiguration configuration, IFileSystemProxy fileSystemProxy) { this.configuration = configuration; this.fileSystemProxy = fileSystemProxy; this.temporaryDirectoryRoot = Path.Combine(configuration.UserDataDirectoryPath, "temp"); ; this.temporaryFilesLockPath = Path.Combine(temporaryDirectoryRoot, "LOCK"); this.temporaryFilesLock = new FileLock(temporaryFilesLockPath); }
public SubscriptionSettingsFactory( ILog log, ISettings settings, IFileSystemProxy fileSystem) { _log = log; _fileSystem = fileSystem; _settings = settings; }
public static Result DeleteSaveData(this FileSystemClient fs, ulong saveDataId) { return(fs.RunOperationWithAccessLog(AccessLogTarget.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return fsProxy.DeleteSaveDataFileSystem(saveDataId); }, () => $", savedataid: 0x{saveDataId:X}")); }
public CacheDownloadStrategy(IDownloadStrategy effectiveStrategy, IFileSystemProxy fileSystemProxy) { 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; FileSystemProxy = fileSystemProxy; }
public static Result DeleteSaveData(this FileSystemClient fs, SaveDataSpaceId spaceId, ulong saveDataId) { return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System, () => { IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return fsProxy.DeleteSaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId); }, () => $", savedataspaceid: {spaceId}, savedataid: 0x{saveDataId:X}")); }
public ReportManager( ILog log, ISettings settings, IFileSystemProxy fileSystemProxy, IReportingServiceProxy reportingServiceProxy) { _log = log; _fileSystemProxy = fileSystemProxy; _settings = settings; _reportingServiceProxy = reportingServiceProxy; }
public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection<ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities) { this.pofSerializer = pofSerializer; this.fileSystemProxy = fileSystemProxy; this.clientConfiguration = clientConfiguration; this.temporaryFileService = temporaryFileService; this.exeggutorService = exeggutorService; this.modificationLoader = modificationLoader; this.modificationViewModels = modificationViewModels; this.leagueBuildUtilities = leagueBuildUtilities; }
public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection <ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities) { this.pofSerializer = pofSerializer; this.fileSystemProxy = fileSystemProxy; this.clientConfiguration = clientConfiguration; this.temporaryFileService = temporaryFileService; this.exeggutorService = exeggutorService; this.modificationLoader = modificationLoader; this.modificationViewModels = modificationViewModels; this.leagueBuildUtilities = leagueBuildUtilities; }
public ModificationPhaseFactory(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationPhaseManager phaseManager, ModificationLoader modificationLoader, ModificationViewModel viewModel, LeagueBuildUtilities leagueBuildUtilities, Modification modification) { this.pofSerializer = pofSerializer; this.fileSystemProxy = fileSystemProxy; this.temporaryFileService = temporaryFileService; this.exeggutorService = exeggutorService; this.phaseManager = phaseManager; this.modificationLoader = modificationLoader; this.viewModel = viewModel; this.leagueBuildUtilities = leagueBuildUtilities; this.modification = modification; }
static NestDeployer() { var ryu = new RyuFactory().Create(); ryu.Touch<ItzWartyProxiesRyuPackage>(); fileSystemProxy = ryu.Get<IFileSystemProxy>(); nestClientPath = Path.Combine(NestDeployerConstants.RootSolutionDirectoryPath, "deploy", "nest_client"); fileSystemProxy.PrepareDirectory(nestClientPath); // nestServerPath = Path.Combine(NestDeployerConstants.RootSolutionDirectoryPath, "deploy", "nest_server"); nestServerPath = @"C:\Apache24\htdocs"; //Path.Combine(NestDeployerConstants.RootSolutionDirectoryPath, "deploy", "nest_server"); fileSystemProxy.PrepareDirectory(nestServerPath); }
public ModificationImportController(IPofSerializer pofSerializer, string repositoriesDirectory, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationComponentFactory modificationComponentFactory, IFileSystemProxy fileSystemProxy, RiotSolutionLoader riotSolutionLoader, ModificationImportViewModelFactory modificationImportViewModelFactory, ObservableCollection<ModificationViewModel> modificationViewModels, ModificationLoader modificationLoader, LeagueBuildUtilities leagueBuildUtilities) { this.pofSerializer = pofSerializer; this.repositoriesDirectory = repositoriesDirectory; this.temporaryFileService = temporaryFileService; this.exeggutorService = exeggutorService; this.modificationComponentFactory = modificationComponentFactory; this.fileSystemProxy = fileSystemProxy; this.riotSolutionLoader = riotSolutionLoader; this.modificationImportViewModelFactory = modificationImportViewModelFactory; this.modificationViewModels = modificationViewModels; this.modificationLoader = modificationLoader; this.leagueBuildUtilities = leagueBuildUtilities; }
public TemporarilyIgnoreUpdatesDownloadStrategy( IDownloadStrategy effectiveStrategy, IFileSystemProxy fileSystemProxy, 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; this.fileSystemProxy = fileSystemProxy; _target = target; }
/// <exception cref="ArgumentNullException"> /// <paramref name="trainingProviderName"/> or /// <paramref name="mediaPath"/> or /// <paramref name="httpDownloadManager"/> or /// <paramref name="fileSystemProxy"/> /// is <see langword="null" />.</exception> internal TrainingCatalogMediaContentProcessor(int trainingProviderId, string trainingProviderName, IMediaPath mediaPath, IHttpDownloadManager httpDownloadManager, IFileSystemProxy fileSystemProxy) { if (trainingProviderName == null) throw new ArgumentNullException("trainingProviderName"); if (mediaPath == null) throw new ArgumentNullException("mediaPath"); if (mediaPath == null) throw new ArgumentNullException("httpDownloadManager"); if (mediaPath == null) throw new ArgumentNullException("fileSystemProxy"); _trainingProviderName = trainingProviderName; _trainingProviderId = trainingProviderId; _mediaPath = mediaPath; _httpDownloadManager = httpDownloadManager; _fileSystemProxy = fileSystemProxy; }
public ModificationImportViewModelFactory(IFileSystemProxy fileSystemProxy, IDriveNodeFactory driveNodeFactory) { this.fileSystemProxy = fileSystemProxy; this.driveNodeFactory = driveNodeFactory; }
public FileBackedSystemStateImpl(IFileSystemProxy fileSystemProxy, string basePath) { this.fileSystemProxy = fileSystemProxy; this.basePath = basePath; fileSystemProxy.PrepareDirectory(basePath); }
public DumpCommand(IFileSystemProxy fileSystemProxy) { this.fileSystemProxy = fileSystemProxy; }
private void InitializeDependencies(IActivityContextProxy vproxyContext, IFileSystemProxy vproxyFileSystem) { this.InitializeDependencies(vproxyContext, vproxyFileSystem, new ParametersValidations(vproxyContext, vproxyFileSystem)); }
public ParametersValidations(IActivityContextProxy proxyContext, IFileSystemProxy proxyFileSystem) { this.proxyContext = proxyContext; this.proxyFileSystem = proxyFileSystem; }
protected DataServiceBase(IFileSystemProxy fileSystemProxy) { FileSystemProxy = fileSystemProxy; AuthorCoursesContainer = new Dictionary<string, string>(); }
private static void FillTarget(DownloadArguments downloadArguments, bool magicMode, IFileSystemProxy fileSystem) { var folder = Path.GetDirectoryName(fileSystem.GetExecutingAssemblyPath()) ?? ""; var target = magicMode ? GetMagicModeTarget(fileSystem) : Path.Combine(folder, "paket.exe"); downloadArguments.Target = target; downloadArguments.Folder = Path.GetDirectoryName(target); }
public TrinketInternalUtilitiesImpl(IFileSystemProxy fileSystemProxy) { this.fileSystemProxy = fileSystemProxy; }
private static bool GetIsMagicMode(IFileSystemProxy fileSystemProxy) { // Magic mode is defined by the bootstrapper being renamed 'paket.exe' var fileName = Path.GetFileName(fileSystemProxy.GetExecutingAssemblyPath()); return string.Equals(fileName, "paket.exe", StringComparison.OrdinalIgnoreCase); }
private static string GetMagicModeTarget(IFileSystemProxy fileSystemProxy) { // In magic mode the real 'paket.exe' is downloaded to the system temporary directory with a // stable name depending on the bootstrapper location. It give two advantages : // - Multiple executions of the same boostrapper will use the same path and can reuse the // downloaded executable if needed. All of that without needing any additional state as // our location on the file system act as the only state needed. // - There is no risk to have two bootstrapper instances in two different locations // accessing the same file as their path depends on the bootstrapper path. var assemblyLocation = fileSystemProxy.GetExecutingAssemblyPath(); var targetName = $"paket_{GetHash(assemblyLocation)}.exe"; return Path.Combine(fileSystemProxy.GetTempPath(), targetName); }
public GitHubDownloadStrategy(IWebRequestProxy webRequestProxy, IFileSystemProxy fileSystemProxy) { WebRequestProxy = webRequestProxy; FileSystemProxy = fileSystemProxy; }
public NodeOperationsController(IFileSystemProxy fileSystemProxy, ArchiveCache archiveCache) { this.fileSystemProxy = fileSystemProxy; this.archiveCache = archiveCache; }
/// <summary> /// Initializes a new instance of the CodeMetricsHistory class /// </summary> /// <param name="proxyContext">Proxy context</param> /// <param name="proxyFileSystem">File system proxy</param> /// <param name="validations">validation</param> public CodeMetricsHistory(IActivityContextProxy proxyContext, IFileSystemProxy proxyFileSystem, IParametersValidations validations) { this.dependenciesCameFromExternalSource = true; this.InitializeDependencies(proxyContext, proxyFileSystem, validations); }
internal CodeMetricsFilesToProcess(IActivityContextProxy activityProxy, IFileSystemProxy fileSystemProxy) { this.activityProxy = activityProxy; this.fileSystemProxy = fileSystemProxy; }
private void InitializeDependencies(IActivityContextProxy vproxyContext, IFileSystemProxy vproxyFileSystem, IParametersValidations vvalidations) { this.proxyContext = vproxyContext; this.proxyFileSystem = vproxyFileSystem; this.validations = vvalidations; }
public static void StartPaketBootstrapping(IDownloadStrategy downloadStrategy, DownloadArguments dlArgs, IFileSystemProxy fileSystemProxy, Action onSuccess) { Action<Exception> handleException = exception => { if (!fileSystemProxy.FileExists(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.WriteInfo("Checking Paket version ({0})...", versionRequested); ConsoleImpl.WriteTrace("Target path is {0}", dlArgs.Target); var localVersion = fileSystemProxy.GetLocalFileVersion(dlArgs.Target); ConsoleImpl.WriteTrace("File in target path version: v{0}", localVersion); var specificVersionRequested = true; var latestVersion = dlArgs.LatestVersion; if (latestVersion == string.Empty) { ConsoleImpl.WriteTrace("No version specified, checking online..."); var getLatestVersionWatch = Stopwatch.StartNew(); latestVersion = downloadStrategy.GetLatestVersion(dlArgs.IgnorePrerelease); getLatestVersionWatch.Stop(); ConsoleImpl.WriteTrace("Latest version check found v{0} in {1:0.##} second(s)", latestVersion, getLatestVersionWatch.Elapsed.TotalSeconds); specificVersionRequested = false; } if (dlArgs.DoSelfUpdate) { ConsoleImpl.WriteInfo("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) { ConsoleImpl.WriteTrace("Downloading v{0} ...", latestVersion); var downloadWatch = Stopwatch.StartNew(); downloadStrategy.DownloadVersion(latestVersion, dlArgs.Target); downloadWatch.Stop(); ConsoleImpl.WriteTrace("Download took {0:0.##} second(s)", downloadWatch.Elapsed.TotalSeconds); ConsoleImpl.WriteInfo("Done in {0:0.##} second(s).", executionWatch.Elapsed.TotalSeconds); } else { ConsoleImpl.WriteInfo("Paket.exe {0} is up to date.", localVersion); } } executionWatch.Stop(); ConsoleImpl.WriteTrace("Paket Bootstrapping took {0:0.##} second(s)", executionWatch.Elapsed.TotalSeconds); onSuccess(); } catch (WebException exn) { var shouldHandleException = true; if (!fileSystemProxy.FileExists(dlArgs.Target)) { if (downloadStrategy.FallbackStrategy != null) { var fallbackStrategy = downloadStrategy.FallbackStrategy; ConsoleImpl.WriteInfo("'{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, fileSystemProxy, onSuccess); shouldHandleException = !fileSystemProxy.FileExists(dlArgs.Target); } } if (shouldHandleException) handleException(exn); } catch (Exception exn) { handleException(exn); } }
public ClientSystemStateFactory(IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration) { this.fileSystemProxy = fileSystemProxy; this.clientConfiguration = clientConfiguration; }