public Runtime(string text = "", IFileCache fileCache = null) { Sys = new Sys(); stack = new ValueStack(); blockManager = new BlockManager(); printBuffer = new Buffer(); patternManager = new PatternManager(); Regions = new RegionManager(Sys, text); expressionManager = new ExpressionManager(); FieldPattern = (Pattern)(STRING_BEGIN_PATTERN + "+" + STRING_END_PATTERN); RecordPattern = (Pattern)(STRING_BEGIN_PATTERN + "'`r`n' | '`r' | '`n'" + STRING_END_PATTERN); FieldSeparator = (String)" "; RecordSeparator = (String)"\r\n"; seed = DateTime.Now.Millisecond; random = new Random(seed); valueStacks = new Stack <ValueStack>(); FileCache = fileCache ?? new StandardFileCache(); takeArray = new Array(); defaultParameterNames = new Stack <DefaultParameterNames>(); defaultParameterNames.Push(new DefaultParameterNames(true)); buffer = new Buffer(); ArgumentDepth = 0; invokeables = new Hash <string, IInvokeable>(); extenders = new Hash <string, InvokeableReference>(); Parser.InClassDefinition = false; consoleManager = new ConsoleManager(); indent = ""; }
private void GetFileCaches(ICondition condition, IFieldSource[] fieldSources, FileInfo file, Dictionary <Type, IFileCache> cacheLookup, IProgress <IEnumerable <ExceptionInfo> > exceptionProgress) { List <Type> cacheTypes = new List <Type>(); cacheTypes.AddRange(condition.CacheTypes); foreach (IFieldSource fieldSource in fieldSources) { cacheTypes.AddRange(fieldSource.CacheTypes); } List <ExceptionInfo> exinfos = new List <ExceptionInfo>(); foreach (Type type in cacheTypes) { Type[] interfaces = type.GetInterfaces(); if (type == null || !interfaces.Contains(typeof(IFileCache))) { continue; } try { if (!cacheLookup.ContainsKey(type)) { IFileCache cache = (IFileCache)Activator.CreateInstance(type); cache.Load(file); cacheLookup[type] = cache; } } catch (Exception ex) when(!(ex is OperationCanceledException)) { RunInfo.ExceptionInfos.Enqueue(new ExceptionInfo(ex, file)); } } }
public BannerDownloader(IFileCache fileCache, BannerOptions options, IHashUtil hashUtil, IDownloader downloader) { _fileCache = fileCache; _options = options; _hashUtil = hashUtil; _downloader = downloader; }
protected void SetUp() { Config = new TestConfiguration(); WebApi = new TestWebApi(Config); Cache = new TestFileCache(); Storage = new PictureStorageImpl(WebApi, Cache); }
public BannerLoader(IDirectory directory, IFileCache fileCache, IWebLinkLauncher webLinkLauncher, IUsageStatisticsSender usageStatisticsSender, IBannerMetricFactory bannerMetricFactory) { _directory = directory; _fileCache = fileCache; _webLinkLauncher = webLinkLauncher; _usageStatisticsSender = usageStatisticsSender; _bannerMetricFactory = bannerMetricFactory; }
public GitHubAdapter(IGitHubClientFactory clientFactory, IConfiguration configuration, IFileCache cache, Options options) { _clientFactory = clientFactory; _configuration = configuration; _cache = cache; this.options = options; }
public BannerLoader(IDirectory directory, IFileCache fileCache, IProcessStarter processStarter, IUsageStatisticsSender usageStatisticsSender, IBannerMetricFactory bannerMetricFactory) { _directory = directory; _fileCache = fileCache; _processStarter = processStarter; _usageStatisticsSender = usageStatisticsSender; _bannerMetricFactory = bannerMetricFactory; }
public MappingList(IApplicationPaths applicationPaths, IFileCache fileCache) { _mappingsFileSpec = new MappingsFileSpec(applicationPaths.CachePath); _fileCache = fileCache; _mappingListTaskLazy = new Lazy <Task <IEnumerable <SeriesMapping> > >(() => CreateMappingListAsync(CancellationToken.None)); }
public OrangeRuntime(Block block, string text = "", IFileCache fileCache = null, IConsole console = null) { this.block = block; Block.ClearResults(); this.text = text; this.fileCache = fileCache; this.console = console; }
public BackgroundController(ProductJsonConverter productJsonConverter, IFileCache fileCache, IConfiguration configuration, ImageLoader imageLoader) { _productJsonConverter = productJsonConverter; _fileCache = fileCache; _configuration = configuration; _imageLoader = imageLoader; _itemHandlerFactory = new ItemHandlerFactory(_configuration, _fileCache, null, _imageLoader, null, null); }
public static TSFileAdditionalInfo AutodetectAndAddDependencyCore(ProjectOptions projectOptions, string depName, IFileCache usedFrom) { var dc = projectOptions.Owner.DiskCache; var extension = PathUtils.GetExtension(depName); var depFile = dc.TryGetItem(depName) as IFileCache; if (depFile == null) { if (usedFrom != null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("In " + usedFrom.FullPath + " missing dependency " + depName); Console.ForegroundColor = ConsoleColor.Gray; TSFileAdditionalInfo.Get(usedFrom, dc) .ReportDiag(true, -3, "Missing dependency " + depName, 0, 0, 0, 0); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Somethere missing dependency " + depName); Console.ForegroundColor = ConsoleColor.Gray; } return(null); } var assetFileInfo = TSFileAdditionalInfo.Get(depFile, dc); if (projectOptions.BundleCss && extension == "css") { assetFileInfo.Type = FileCompilationType.Css; return(assetFileInfo); } if (assetFileInfo.OutputUrl == null) { assetFileInfo.OutputUrl = projectOptions.AllocateName(PathUtils.Subtract(depFile.FullPath, projectOptions.Owner.Owner.FullPath)); } switch (extension) { case "css": assetFileInfo.Type = FileCompilationType.Css; break; case "js": assetFileInfo.Type = FileCompilationType.JavaScriptAsset; break; default: assetFileInfo.Type = FileCompilationType.Resource; break; } return(assetFileInfo); }
public OrangeRuntime(Block block, string text = "", IFileCache fileCache = null, IConsole console = null) { this.block = block; //this.block.Statement += (sender, e) => Statement?.Invoke(this, e); Block.ClearResults(); this.text = text; this.fileCache = fileCache; this.console = console; }
internal void Collect(string sourceDir, string dstDir) { if (sourceDir == null || dstDir == null) { return; } IFileCache fileCache = InitFileCache(dstDir); if (Directory.Exists(sourceDir)) { string fileName; string destFile; string[] files = Directory.GetFiles(sourceDir); foreach (string sourceFile in files) { using (FileStream sourceFileStream = new FileStream(sourceFile, FileMode.Open, FileAccess.Read)) { if (fileCache.Contains(sourceFileStream)) { continue; } try { using (Image img = Image.FromStream(sourceFileStream)) { // Use static Path methods to extract only the file name from the path. fileName = Path.GetFileName(sourceFile) + _fileType; destFile = Path.Combine(dstDir, fileName); if (CanCopy(img)) { File.Copy(sourceFile, destFile, false); fileCache.AddEntry(sourceFileStream.Length); _logger.Add($"File Added: {fileName}"); } } } catch (Exception e) { Console.WriteLine(e); } } } } else { Console.WriteLine("Source path does not exist!"); } fileCache.Dispose(); _logger.Dispose(); }
public Orange(string source, IColorizer colorizer = null, IFileCache fileCache = null, IConsole console = null) { this.source = source.Trim(); this.colorizer = colorizer; this.fileCache = fileCache; this.console = console; verboseText = ""; block = null; }
public FaviconCommand( string faviconsDirectory, IFileSystem fileSystem, IFileCache fileCache) { this.faviconsDirectory = faviconsDirectory; this.fileSystem = fileSystem; this.fileCache = fileCache; }
bool MatchingTranspilationDendencies(IFileCache owner, List <DependencyTriplet> transpilationDependencies) { if (transpilationDependencies == null) { return(true); } var hashToName = new Dictionary <byte[], string>(StructuralEqualityComparer <byte[]> .Default); hashToName.Add(owner.HashOfContent, owner.FullPath); var processed = new StructList <bool>(); processed.RepeatAdd(false, (uint)transpilationDependencies.Count); bool somethingFailed; do { var somethingProcessed = false; somethingFailed = false; for (var i = 0u; i < processed.Count; i++) { if (processed[i]) { continue; } var dep = transpilationDependencies[(int)i]; if (!hashToName.TryGetValue(dep.SourceHash, out var sourceName)) { somethingFailed = true; continue; } somethingProcessed = true; processed[i] = true; var targetName = ResolveImport(sourceName, dep.Import); if (targetName == "?") { return(false); } Result.Path2FileInfo.TryGetValue(targetName, out var targetInfo); if (!dep.TargetHash.AsSpan().SequenceEqual(targetInfo.Owner.HashOfContent)) { return(false); } hashToName.TryAdd(targetInfo.Owner.HashOfContent, targetInfo.Owner.FullPath); } if (!somethingProcessed) { return(!somethingFailed); } } while (somethingFailed); return(true); }
public TvDbClient(IJsonConnection jsonConnection, IFileCache fileCache, IApplicationPaths applicationPaths, ILogManager logManager, ICustomJsonSerialiser jsonSerialiser, PluginConfiguration configuration) { _log = logManager.GetLogger(nameof(TvDbClient)); _jsonConnection = jsonConnection; _fileCache = fileCache; _applicationPaths = applicationPaths; _jsonSerialiser = jsonSerialiser; _token = new TvDbToken(_jsonConnection, configuration.TvDbApiKey, logManager); }
/// <summary> /// Gets the main file cache. /// </summary> public IFileCache GetMainFileCache() { if (_mainFileCache == null) { DiskCacheConfig diskCacheConfig = _config.MainDiskCacheConfig; _mainFileCache = _config.FileCacheFactory.Get(diskCacheConfig); } return(_mainFileCache); }
/// <summary> /// Gets the small image file cache. /// </summary> public IFileCache GetSmallImageFileCache() { if (_smallImageFileCache == null) { DiskCacheConfig diskCacheConfig = _config.SmallImageDiskCacheConfig; _smallImageFileCache = _config.FileCacheFactory.Get(diskCacheConfig); } return(_smallImageFileCache); }
public static TSFileAdditionalInfo Create(IFileCache file, IDiskCache diskCache) { if (file == null) { return(null); } return(new TSFileAdditionalInfo { Owner = file, DiskCache = diskCache }); }
TSFileAdditionalInfo AutodetectAndAddDependency(string depName, IFileCache usedFrom) { var fai = AutodetectAndAddDependencyCore(_owner.ProjectOptions, depName, usedFrom); if (fai != null) { CheckAdd(depName); } return(fai); }
public TvDbClientV2(IJsonConnection jsonConnection, IFileCache fileCache, IApplicationPaths applicationPaths, ILogManager logManager, ICustomJsonSerialiser jsonSerialiser, PluginConfiguration configuration) { this.log = logManager.GetLogger(nameof(TvDbClientV2)); this.jsonConnection = jsonConnection; this.fileCache = fileCache; this.applicationPaths = applicationPaths; this.jsonSerialiser = jsonSerialiser; this.token = new TvDbToken(this.jsonConnection, configuration.TvDbApiKey, logManager); }
private ContentCommand RegisterWebContent(string webAppRootDir, IFileCache fileCache, IWebServerConfiguration config) { string contentRootDirectory = Path.GetFullPath(Path.Combine(webAppRootDir, "Content")); ContentCommand contentCommand = new ContentCommand(contentRootDirectory, FileSystem, fileCache); contentCommand.CacheByMaxAge(@"cached-by-max-age.txt", TimeSpan.FromDays(30)); contentCommand.CacheByETag(@"cached-by-etag.txt", TimeSpan.FromDays(10), () => GenerateContentETag(config)); return(contentCommand); }
public TvDbClientV3(IJsonConnection jsonConnection, IFileCache fileCache, IApplicationPaths applicationPaths, ILogManager logManager, ICustomJsonSerialiser jsonSerialiser, PluginConfiguration configuration) { this.log = logManager.GetLogger(nameof(TvDbClientV2)); this.fileCache = fileCache; this.applicationPaths = applicationPaths; this.jsonSerialiser = jsonSerialiser; this.tvDbClient = new TvDbClient(); this.tvDbClient.Authentication.AuthenticateAsync(configuration.TvDbApiKey).GetAwaiter().GetResult(); this.dataMapper = this.CreateDataMapper(); }
public NVelocityHtmlRenderHelper( IHttpContext httpContext, XhtmlTextWriter writer, IApplicationInfo applicationInfo, IFileCache fileCache) { this.httpContext = httpContext; this.fileCache = fileCache; this.applicationInfo = applicationInfo; this.writer = writer; }
public CachedFileResponse( string fileName, IFileCache fileCache, string contentType, Encoding encoding) { this.fileName = fileName; this.fileCache = fileCache; this.contentType = contentType; this.encoding = encoding; }
public AgentCommunicator(Stream stream, IFormatter formatter, IJobWorker jobWorker, IFileCache fileCache, ILog logger) { logger.Info("AgentCommunicator initializing..."); this.stream = stream; this.formatter = formatter; this.jobWorker = jobWorker; this.fileCache = fileCache; this.logger = logger; logger.Info("AgentCommunicator initialized."); }
/// <summary> /// Initializes a new instance of the <see cref="ContentCommand"/> class. /// </summary> /// <param name="contentRootDirectory"> /// The path to the root content directory. /// </param> /// <param name="fileSystem"> /// Instance of the <see cref="IFileSystem"/> service. /// </param> /// <param name="fileCache"> /// Instance of the <see cref="IFileCache"/> service. If <c>null</c>, no file caching will be performed. /// </param> public ContentCommand( string contentRootDirectory, IFileSystem fileSystem, IFileCache fileCache) { Contract.Requires(contentRootDirectory != null); Contract.Requires(fileSystem != null); this.contentRootDirectory = contentRootDirectory; this.fileSystem = fileSystem; this.fileCache = fileCache; }
public MappingList(IApplicationPaths applicationPaths, IFileCache fileCache, IApiClient xemApiClient, ICustomJsonSerialiser jsonSerialiser, IXmlSerialiser xmlSerializer) { this.mappingsFileSpec = new MappingsFileSpec(applicationPaths.CachePath, xmlSerializer); this.mappingsAniDbXemFileSpec = new XemAniDbMappingsFileSpec(applicationPaths.CachePath, xemApiClient, jsonSerialiser); this.mappingsTvDbXemFileSpec = new XemTvDbMappingsFileSpec(applicationPaths.CachePath, xemApiClient, jsonSerialiser); this.fileCache = fileCache; this.mappingListTaskLazy = new Lazy <Task <IEnumerable <SeriesMapping> > >(() => this.CreateMappingListAsync(CancellationToken.None)); this.xemAniDbMappingListTaskLazy = new Lazy <Task <IEnumerable <SeriesMapping> > >(() => this.CreateXemAniDbMappingListAsync(CancellationToken.None)); this.xemTvDbMappingListTaskLazy = new Lazy <Task <IEnumerable <SeriesMapping> > >(() => this.CreateXemTvDbMappingListAsync(CancellationToken.None)); }
public static MvcTemplateHttpResponse ReturnHtml( string htmlTemplateFileName, IFileCache fileCache, IDictionary properties) { ITemplateSource template = new CacheableFileTemplate( htmlTemplateFileName, fileCache); return(new MvcTemplateHttpResponse( template, HttpConstants.ContentTypeHtml, properties)); }
public Wiki2Html(Configuration config, ResolveWikiLink resolveWikiLinkDel, RetrievePage retrievePageDel, IFileCache fileCache) { config_ = config; resolveWikiLinkDel_ = resolveWikiLinkDel; retrievePageDel_ = retrievePageDel; fileCache_ = fileCache; commonImagesPath_ = Path.Combine(config.SkinsPath, config.CommonImagesPath); commonImagesPath_ = commonImagesPath_.Replace('\\', '/'); commonImagesPath_ = "file:///" + commonImagesPath_; commonImagesPath_ = commonImagesPath_.TrimEnd('/') + '/'; magicWordProcessor_ = new MagicWordProcessor(ProcessMagicWords); parserFunctionsProcessor_ = new ParserFunctionProcessor(ProcessMagicWords); logger_ = LogManager.CreateLoger(typeof(Wiki2Html).FullName); logger_.Trace = true; }
/// <summary> /// Initializes a new instance of the <see cref="FileTransferServiceClient"/> class. /// </summary> public FileTransferServiceClient() { _fileCache = new DefaultFileCache(); }
public StaticFileController(IFileCache fileCache) : base(fileCache) { }
protected ControllerBase(IFileCache fileCache) { this.fileCache = fileCache; }
public CacheableFileTemplate(string templateFileName, IFileCache fileCache) { this.templateFileName = templateFileName; this.fileCache = fileCache; }