private void ExpandFiles(IPackage package) { IBatchProcessor <string> fileSystem = this.FileSystem as IBatchProcessor <string>; try { List <IPackageFile> list = package.GetFiles().ToList(); if (fileSystem != null) { fileSystem.BeginProcessing( list.Select(p => p.Path), PackageAction.Install); } string packageDirectory = this.PathResolver.GetPackageDirectory(package); this.FileSystem.AddFiles(list, packageDirectory); IPackage runtimePackage; if (!PackageHelper.IsSatellitePackage(package, this.LocalRepository, this.targetFrameWork, out runtimePackage)) { return; } this.FileSystem.AddFiles(package.GetSatelliteFiles(), this.PathResolver.GetPackageDirectory(runtimePackage)); } finally { if (fileSystem != null) { fileSystem.EndProcessing(); } } }
private void ExpandFiles(IPackage package) { IBatchProcessor <string> fileSystem = this.FileSystem as IBatchProcessor <string>; try { IPackage package2; List <IPackageFile> files = package.GetFiles().ToList <IPackageFile>(); if (fileSystem != null) { fileSystem.BeginProcessing(from p in files select p.Path, PackageAction.Install); } this.FileSystem.AddFiles(files, this.PathResolver.GetPackageDirectory(package)); if (PackageHelper.IsSatellitePackage(package, this.LocalRepository, null, out package2)) { IEnumerable <IPackageFile> satelliteFiles = package.GetSatelliteFiles(); this.FileSystem.AddFiles(satelliteFiles, this.PathResolver.GetPackageDirectory(package2)); } } finally { if (fileSystem != null) { fileSystem.EndProcessing(); } } }
public TerrainGenerator(WorldData worldData,IChunkProcessor chunkProcessor, IBatchProcessor<Chunk> batchProcessor, ITerrainGenerationMethod terrainGenerationMethod) { m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; m_BatchProcessor = batchProcessor; m_TerrainGenerationMethod = terrainGenerationMethod; }
public BackgroundWorldProcessor(bool useThreadPool) { if (useThreadPool) { int workerThreads = 0; int completionPortThreads = 0; ThreadPool.SetMaxThreads(400, 300); ThreadPool.GetMaxThreads(out workerThreads, out completionPortThreads); UnityEngine.Debug.Log ("workerThreads = " + workerThreads + ", completionPortThreads = " + completionPortThreads); // process batches in parallel sharedProcessor = new ThreadPoolBatchProcessor<Chunk>(); // the mesh processor will have its own processor which can take a data parameter // this will allow us to use the same mesh processor to process different meshes on different layers simultaneously meshProcessor = new MeshProcessor(new ThreadPoolBatchProcessor<Chunk, BlockLayer>()); } else { // process batches synchronously sharedProcessor = new BatchProcessor<Chunk>(); // the mesh processor will have its own processor which can take a data parameter // this will allow us to use the same mesh processor to process different meshes on different layers simultaneously meshProcessor = new MeshProcessor(new BatchProcessor<Chunk, BlockLayer>()); } terrainProcessor = new TerrainProcessor(sharedProcessor); colliderProcessor = new ColliderProcessor(sharedProcessor); }
public TerrainGenerator(WorldData worldData, IChunkProcessor chunkProcessor, IBatchProcessor <Chunk> batchProcessor, ITerrainGenerationMethod terrainGenerationMethod) { m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; m_BatchProcessor = batchProcessor; m_TerrainGenerationMethod = terrainGenerationMethod; }
/// <summary> /// This only exists for testing, not to be called directly by production code. /// </summary> public WorldDecorator(WorldData worldData, IBatchProcessor <Chunk> batchProcessor, List <IDecoration> decorations, IChunkProcessor chunkProcessor) { m_WorldData = worldData; m_BatchProcessor = batchProcessor; m_ChunkProcessor = chunkProcessor; m_Decorations = decorations; }
/// <summary> /// This only exists for testing, not to be called directly by production code. /// </summary> public WorldDecorator(WorldData worldData, IBatchProcessor<Chunk> batchProcessor, List<IDecoration> decorations, IChunkProcessor chunkProcessor) { m_WorldData = worldData; m_BatchProcessor = batchProcessor; m_ChunkProcessor = chunkProcessor; m_Decorations = decorations; }
private void Validate(IBatchProcessor batchProcessor, int maxBatchSize, TimeSpan maxtimeBetweenCalls) { if (batchProcessor == null) { throw new ApplicationException("IBatchProcessor must be provided"); } if (maxBatchSize == 0) { throw new ApplicationException("maxBatchSize must be more than Zero"); } if (maxtimeBetweenCalls.Milliseconds < 1) { throw new ApplicationException("maxtimeBetweenCalls can be less than 1 ms"); } }
public PackageHashProcessor( IEntityRepository <Package> packageRepository, IBatchProcessor batchProcessor, IResultRecorder resultRecorder, IOptionsSnapshot <PackageHashConfiguration> configuration, DurableCursor cursor, ILogger <PackageHashProcessor> logger) { _packageRepository = packageRepository ?? throw new ArgumentNullException(nameof(packageRepository)); _batchProcessor = batchProcessor ?? throw new ArgumentNullException(nameof(batchProcessor)); _resultRecorder = resultRecorder ?? throw new ArgumentNullException(nameof(resultRecorder)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _cursor = cursor ?? throw new ArgumentNullException(nameof(cursor)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public static void AddFiles(this IProjectSystem project, IEnumerable <IPackageFile> files, IDictionary <FileTransformExtensions, IPackageFileTransformer> fileTransformers) { List <IPackageFile> list = files.ToList <IPackageFile>(); IComparer <IPackageFile> comparer = project as IComparer <IPackageFile>; if (comparer != null) { list.Sort(comparer); } IBatchProcessor <string> processor = project as IBatchProcessor <string>; try { if (processor != null) { processor.BeginProcessing(from file in list select ResolvePath(fileTransformers, fte => fte.InstallExtension, file.EffectivePath), PackageAction.Install); } foreach (IPackageFile file in list) { IPackageFileTransformer transformer; if (file.IsEmptyFolder()) { continue; } string path = ResolveTargetPath(project, fileTransformers, fte => fte.InstallExtension, file.EffectivePath, out transformer); if (project.IsSupportedFile(path)) { string str2; if (transformer != null) { transformer.TransformFile(file, path, project); continue; } if (FindFileTransformer(fileTransformers, fte => fte.UninstallExtension, file.EffectivePath, out str2) == null) { TryAddFile(project, path, new Func <Stream>(file.GetStream)); } } } } finally { if (processor != null) { processor.EndProcessing(); } } }
public BatchScheduler(IBatchProcessor batchProcessor, TimeSpan maxTimeBetweenCalls) { _batchProcessor = batchProcessor; _batchProcessorTimer = new Timer(ExecuteBatch, null, maxTimeBetweenCalls, maxTimeBetweenCalls); }
public LightProcessor(IBatchProcessor <Chunk> batchProcessor, WorldData worldData) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; }
/// <summary> /// This only exists for testing, not to be called directly by production code. /// </summary> private WorldDecorator(WorldData worldData, IBatchProcessor<Chunk> batchProcessor, List<IDecoration> decorations) { m_WorldData = worldData; m_BatchProcessor = batchProcessor; m_Decorations = decorations; }
public TerrainProcessor(IBatchProcessor<Chunk> processor) { _processor = processor; }
public WorldDecorator(WorldData worldData, IBatchProcessor <Chunk> batchProcessor, IChunkProcessor chunkProcessor) : this(worldData, batchProcessor, LoadDecorators(worldData), chunkProcessor) { }
public WorldDecorator(WorldData worldData, IBatchProcessor<Chunk> batchProcessor, IChunkProcessor chunkProcessor) : this(worldData, batchProcessor, LoadDecorators(worldData), chunkProcessor) { }
public ColliderProcessor(IBatchProcessor<Chunk> processor) { _processor = processor; }
public BatchController(IBatchProcessor batchProcessor, IInnovationProcessor innovationProcessor, INetController netController) => (_batchProcessor, _innovationProcessor, _netController) = (batchProcessor, innovationProcessor, netController);
public LightProcessor(IBatchProcessor <Chunk> batchProcessor, WorldData worldData, ChunkProcessor chunkProcessor) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; }
public BatchRunnerService(IDbContext dbContext, IBatchProcessor batchProcessor) { _dbContext = dbContext; _batchProcessor = batchProcessor; }
static async Task Main(string[] args) { var serviceProvider = new Startup().GetServiceProvider(); IBatchProcessor batchProcessor = serviceProvider.GetService <IBatchProcessor>(); await batchProcessor.Process(); }
public static void DeleteFiles(this IProjectSystem project, IEnumerable <IPackageFile> files, IEnumerable <IPackage> otherPackages, IDictionary <FileTransformExtensions, IPackageFileTransformer> fileTransformers) { IPackageFileTransformer transformer; ILookup <string, IPackageFile> lookup = Enumerable.ToLookup <IPackageFile, string>(files, p => Path.GetDirectoryName(ResolveTargetPath(project, fileTransformers, fte => fte.UninstallExtension, p.EffectivePath, out transformer))); foreach (string str in from grouping in lookup from directory in FileSystemExtensions.GetDirectories(grouping.Key) orderby directory.Length descending select directory) { IEnumerable <IPackageFile> enumerable = lookup.Contains(str) ? lookup[str] : Enumerable.Empty <IPackageFile>(); if (project.DirectoryExists(str)) { IBatchProcessor <string> processor = project as IBatchProcessor <string>; try { if (processor != null) { Func <IPackageFile, string> < > 9__6; Func <IPackageFile, string> func5 = < > 9__6; if (< > 9__6 == null) { Func <IPackageFile, string> local5 = < > 9__6; func5 = < > 9__6 = file => ResolvePath(fileTransformers, fte => fte.UninstallExtension, file.EffectivePath); } processor.BeginProcessing(Enumerable.Select <IPackageFile, string>(enumerable, func5), PackageAction.Uninstall); } foreach (IPackageFile file in enumerable) { if (!file.IsEmptyFolder()) { string path = ResolveTargetPath(project, fileTransformers, fte => fte.UninstallExtension, file.EffectivePath, out transformer); if (project.IsSupportedFile(path)) { Func <IPackage, IEnumerable <IPackageFile> > < > 9__9; if (transformer == null) { project.DeleteFileSafe(path, new Func <Stream>(file.GetStream)); continue; } Func <IPackage, IEnumerable <IPackageFile> > func4 = < > 9__9; if (< > 9__9 == null) { Func <IPackage, IEnumerable <IPackageFile> > local7 = < > 9__9; func4 = < > 9__9 = p => project.GetCompatibleItemsCore <IPackageFile>(p.GetContentFiles()); } IEnumerable <IPackageFile> matchingFiles = from <> h__TransparentIdentifier0 in Enumerable.SelectMany(otherPackages, func4, (p, otherFile) => new { p = p, otherFile = otherFile }) where < > h__TransparentIdentifier0.otherFile.EffectivePath.Equals(file.EffectivePath, StringComparison.OrdinalIgnoreCase) select <> h__TransparentIdentifier0.otherFile; try { transformer.RevertFile(file, path, matchingFiles, project); } catch (Exception exception) { project.Logger.Log(MessageLevel.Warning, exception.Message, new object[0]); } } } } if (!project.GetFilesSafe(str).Any <string>() && !project.GetDirectoriesSafe(str).Any <string>()) { project.DeleteDirectorySafe(str, false); } } finally { if (processor != null) { processor.EndProcessing(); } } } } }
public MeshGenerator(IBatchProcessor <Chunk> batchProcessor, WorldData worldData) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; }
public LightProcessor(IBatchProcessor<Chunk> batchProcessor, WorldData worldData, ChunkProcessor chunkProcessor) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; }
public MeshDataGenerator(IBatchProcessor<Chunk> batchProcessor, WorldData worldData, ChunkProcessor chunkProcessor) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; }
/// <summary> /// Removes <param name="processor" /> from the list of possible operations in BatchProcessDialog /// </summary> public static void RemoveBatchProcessor(IBatchProcessor processor) { processors.Remove(processor); EventManager.DispatchEvent(null, new DataEvent(EventType.Command, "CodeRefactor.BatchProcessorRemoved", processor)); }
public MeshProcessor(IBatchProcessor<Chunk, BlockLayer> processor) { _processor = processor; }
static bool MetroReportProcessorIsActive(IBatchProcessor batchProcessor) { return(batchProcessor is HtmlReporter && ((HtmlReporter)batchProcessor).ReportBuilder is MetroReportBuilder); }
protected override void ExecuteRequest(SearchQueryRequest searchRequest) { if (LimitAll || RowLimit > SearchResultBatchSize) { #if FALSE int totalRows = 0; IBatchProcessor batchProcessor = BatchProcessor.Create(); batchProcessor.Initialize(searchRequest, SearchResultBatchSize); while (batchProcessor.NotFinished) { progress.ShowProgress(searchRequest.StartRow.Value, totalRows, remaining); totalRows = GetResults(searchRequest); if (!LimitAll) { totalRows = (RowLimit.HasValue ? RowLimit.Value : rowLimitDefault); } searchRequest.StartRow += SearchResultBatchSize; remaining = totalRows - searchRequest.StartRow.Value; //Console.WriteLine(remaining); searchRequest.RowLimit = remaining < SearchResultBatchSize ? remaining : SearchResultBatchSize; if (SleepBetweenQueryBatches > 0) { Thread.Sleep(SleepBetweenQueryBatches); } } #endif // Try to loop through all results in increments of 500 searchRequest.RowLimit = SearchResultBatchSize; int totalRows = (StartRow.HasValue ? StartRow.Value : 0) + 1; int remaining = 0; while (searchRequest.StartRow < totalRows) { progress.ShowProgress(searchRequest.StartRow.Value, totalRows, remaining); totalRows = GetResults(searchRequest); if (!LimitAll) { totalRows = (RowLimit.HasValue ? RowLimit.Value : rowLimitDefault); } searchRequest.StartRow += SearchResultBatchSize; remaining = totalRows - searchRequest.StartRow.Value; //Console.WriteLine(remaining); searchRequest.RowLimit = remaining < SearchResultBatchSize ? remaining : SearchResultBatchSize; if (SleepBetweenQueryBatches > 0) { Thread.Sleep(SleepBetweenQueryBatches); } } } else { GetResults(searchRequest); } }
public MeshDataGenerator(IBatchProcessor <Chunk> batchProcessor, WorldData worldData, ChunkProcessor chunkProcessor) { m_BatchProcessor = batchProcessor; m_WorldData = worldData; m_ChunkProcessor = chunkProcessor; }
public BatchProcessors Add(IBatchProcessor processor) { _addedProcessors.Add(processor); return this; }
public BatchProcessors Add(IBatchProcessor processor) { _addedProcessors.Add(processor); return(this); }
public Task Process(string inputDirectory, string outputDirectory, IBatchProcessor processor, IProgress <ProgressReport> progress) { ErrorReports = new List <BatchErrorReport <ProcessElement> >(); return(ProcessParallel(EnumerateAllFiles(inputDirectory, outputDirectory), progress, processor.Process)); }
static bool MetroReportProcessorIsActive(IBatchProcessor batchProcessor) { return batchProcessor is HtmlReporter && ((HtmlReporter)batchProcessor).ReportBuilder is MetroReportBuilder; }
public BatchProcessorItem(IBatchProcessor processor) { Processor = processor; }
/// <summary> /// Default constructor /// </summary> public Processor(CSqlOptions csqlOptions) { this.m_options = csqlOptions; this.m_processor = BatchProcessorFactory.CreateProcessor(csqlOptions); this.m_ppTraces = new PreProcessorTraceQueue(); }
/// <summary> /// IBatchProcessor /// Contains two methods: Process(Job) and ShutDown() /// Please keep in mind that Shutdown method return once all jobs sent processed /// </summary> public JobProcessor(IBatchProcessor batchProcessor, int maxBatchSize, TimeSpan maxtimeBetweenCalls) { Validate(batchProcessor, maxBatchSize, maxtimeBetweenCalls); _batchScheduler = new BatchScheduler.BatchScheduler(batchProcessor, maxtimeBetweenCalls); _maxBatchSize = maxBatchSize; }