private void createDistribution(Compound compound, List <object> report, BuildTracker tracker) { var thisSection = new List <object>(); thisSection.AddRangeSafe(permeabilityAlternatives(compound)); addCalculationMethodsAccordingToPredicate(compound, thisSection, cm => cm.Category.IsOneOf(CoreConstants.Category.DistributionCellular, CoreConstants.Category.DistributionInterstitial, CoreConstants.Category.DiffusionIntCell)); thisSection.AddRangeSafe(partialProcesses <SpecificBindingPartialProcess>(compound)); addToReport(report, tracker, thisSection, PKSimConstants.UI.Distribution); }
public static Figure ForCreation(string caption, string fileName, BuildTracker tracker) { var figure = new Figure(caption, string.Empty); var figureFolder = new DirectoryInfo(Path.Combine(tracker.WorkingDirectory, _subFolder)); if (!figureFolder.Exists) { figureFolder.Create(); } figure.FullPath = Path.Combine(figureFolder.FullName, fileName); return(figure); }
private static void Transpile(Build build, BuildTracker buildTracker, BuildTargetCollection buildTargets, BuildLogServices buildLogServices, int threadsNumber) { var buildPlan = buildTargets.GetBuildPlan(threadsNumber); int totalScripts = buildPlan.Sum(p => p.Value.Sum(chunk => chunk.Sum(c => c.Value.Count))); ProgressWriter progressWriter = new ProgressWriter("Transpiling Scripts", totalScripts); using (StreamWriter errorLog = new StreamWriter(build.GetErrorLogPath(), false)) { foreach (var threadBuildPlan in buildPlan) { TranspileChunkJob task = new TranspileChunkJob(build, buildTracker, buildLogServices, threadBuildPlan.Value); task.RunTask(errorLog, progressWriter); } } progressWriter.WriteLast(); }
/// <summary> /// Called when the VSPackage is loaded by Visual Studio. /// </summary> protected override void Initialize() { base.Initialize(); var preferredLocale = settingsRepository.GetSettings().PreferredLocale; try { var cultureInfo = preferredLocale == string.Empty ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(preferredLocale); System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo; } catch { //Ignored. This will throw if the culture in the settings repo isn't a valid culture. } if (MenuService != null) { var menuCommandID = new CommandID( GuidList.guidCSharpAchiever_Achiever_VSIXCmdSet, (int)PkgCmdIDList.showAchievementIndex); var menuItem = new MenuCommand(MenuItemCallback, menuCommandID); MenuService.AddCommand(menuItem); } if (SolutionBuildManager != null) { var buildTracker = new BuildTracker(DTE, achievementService); SolutionBuildManager.AdviseUpdateSolutionEvents(buildTracker, out updateSolutionEventsCookie); } AddService <IAchievementLibraryService>(this, true); AddService(achievementService, true); RegisterAchievementAssembly(typeof(NRefactoryAchievement).Assembly); AchievementUIContext.AchievementClicked += AchievementContext_AchievementClicked; achievementService.StaticAnalysisCompleted += DetectionDispatcher_DetectionCompleted; }
private static void Transpile(Build build, BuildTracker buildTracker, BuildTargetAdvancedCollection buildTargets, int threadsNumber) { var buildPlan = buildTargets.GetBuildPlan(threadsNumber); ESMAnalyzer esmAnalyzer = buildTargets.ESMAnalyzer; int totalScripts = buildPlan.Sum(p => p.Value.Sum(chunk => chunk.Sum(c => c.Value.Count))); ProgressWriter progressWriter = new ProgressWriter("Transpiling Scripts", totalScripts); using (StreamWriter errorLog = new StreamWriter(build.GetErrorLogPath(), false)) { foreach (var threadBuildPlan in buildPlan) { TranspileChunkJob task = new TranspileChunkJob(buildTracker, threadBuildPlan.Value, esmAnalyzer); task.RunTask(errorLog, progressWriter); } } AddTopicBuilderCommand.GenerateINFOAddTopicScripts(buildTargets.ESMAnalyzer, buildTracker, buildTargets.First(t => t.IsTIF())); progressWriter.WriteLast(); }
public void write(BuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter) { Dictionary <string, TES5Target> scripts = buildTracker.GetBuiltScripts(target.GetTargetName()); List <TES5Target> connectedQuestFragments = new List <TES5Target>(); Dictionary <string, List <QuestStageScript> > jointScripts = new Dictionary <string, List <QuestStageScript> >(); /* * Scan manually for .map files in the QF scripts folder * Reason is that in case we"ve got a quest with no fragments to anything whatsoever, we"ll have to go * through it too ( just with empty subfragments trees ), to generate the objective handlings */ string sourcePath = target.GetSourcePath(); foreach (var mapFilePath in Directory.EnumerateFiles(sourcePath, "*.map")) { string mapFileName = Path.GetFileNameWithoutExtension(mapFilePath); jointScripts.AddNewListIfNotContainsKey(mapFileName); } /* * Group the fragments together */ foreach (var script in scripts.Values) { string[] parts = script.Script.ScriptHeader.OriginalScriptName.Split('_'); if (parts.Length < 3) { //Not able to categorize, probably wrong name of the fragment. continue; } string baseName = parts[0] + "_" + parts[1] + "_" + parts[2]; jointScripts.AddNewListIfNotContainsKeyAndAddValueToList(baseName, new QuestStageScript(script, int.Parse(parts[3]), int.Parse(parts[4]))); } foreach (var kvp in jointScripts) { var resultingFragmentName = kvp.Key; var subfragmentsTrees = kvp.Value; connectedQuestFragments.Add(this.QFFragmentFactory.JoinQFFragments(target, resultingFragmentName, subfragmentsTrees)); } Write(connectedQuestFragments, progressWriter); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { //Command.Initialize(this); base.Initialize(); var settingsStore = new Lazy <WritableSettingsStore>(() => new ShellSettingsManager(this). GetWritableSettingsStore(SettingsScope.UserSettings)); Settings = new BuildRestartSettings(settingsStore); _vsInstance = (DTE2)GetService(typeof(DTE)); var solutionBuildManager = (IVsSolutionBuildManager2)GetService(typeof(SVsSolutionBuildManager)); //var statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar)); //var logger = new ExtensionLogger(() => GetService(typeof(SVsActivityLog)) as IVsActivityLog, statusBar); //never cache the activity log reference _buildTracker = new BuildTracker( _vsInstance, solutionBuildManager, Settings ); }
/// <summary> /// Called when the VSPackage is loaded by Visual Studio. /// </summary> protected override void Initialize() { base.Initialize(); //Set a uiculture //System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU"); ObjectFactory.Configure(a => { a.For <IAchievementRepository>().Singleton().Use <AppDataXmlCompletedAchievementsRepository>(); a.For <ISettingsRepository>().Singleton().Use <AppDataXmlSettingsRepository>(); }); if (MenuService != null) { var menuCommandID = new CommandID( GuidList.guidCSharpAchiever_Achiever_VSIXCmdSet, (int)PkgCmdIDList.showAchievementIndex); var menuItem = new MenuCommand(MenuItemCallback, menuCommandID); MenuService.AddCommand(menuItem); } if (SolutionBuildManager != null) { var buildTracker = new BuildTracker(DTE); SolutionBuildManager.AdviseUpdateSolutionEvents(buildTracker, out updateSolutionEventsCookie); } AddService <IAchevementLibraryService>(this, true); RegisterAchievementAssembly(typeof(NRefactoryAchievement).Assembly); GuiInitializer.Initialize(); AchievementContext.AchievementClicked += AchievementContext_AchievementClicked; DetectionDispatcher.DetectionCompleted += DetectionDispatcher_DetectionCompleted; }
public async Task SaveArtifacts(BuildTracker tracker) { var outputFolderPath = Path.Combine(tracker.ReportFolder, $"{tracker.ReportFileName}_{Constants.ArtifactOutputFolder}"); var outputFolder = new DirectoryInfo(outputFolderPath); if (outputFolder.Exists) { deleteDirectory(outputFolder); } outputFolder.Create(); foreach (var artifactFolderName in Constants.AllArtifactFolders) { var artifactWorkingFolder = new DirectoryInfo(Path.Combine(tracker.WorkingDirectory, artifactFolderName)); if (!artifactWorkingFolder.Exists) { continue; } var artifactOutputFolder = Path.Combine(outputFolder.FullName, artifactFolderName); createDirectory(artifactOutputFolder); foreach (var artifact in allArtifactsFrom(artifactWorkingFolder)) { var outputArtifactFullPath = Path.Combine(artifactOutputFolder, artifact.Name); artifact.CopyTo(outputArtifactFullPath, true); //convert the pdf plots to png format if (isAnPDFFile(artifact.Name)) { await _imageConverter.ConvertPDF(outputArtifactFullPath, ImageTypes.PNG, 600); } } } }
public void Write(IBuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter) { Write(buildTracker.GetBuiltScripts(target.Name).Values, progressWriter); }
private static IEnumerable <object> getObjectsToReport(SimulationProperties simulationProperties, BuildTracker buildTracker, Func <CompoundProperties, object> objectSelectionFunc) { foreach (var compoundProperties in simulationProperties.CompoundPropertiesList) { var objectsToAdd = objectSelectionFunc(compoundProperties); if (objectsToAdd == null) { continue; } // We are creating a relative structural element two levels below for the current tracker because in the calling method, we have already added a structural element // that's 1 level below but the tracker has not been updated for that. yield return(buildTracker.CreateRelativeStructureElement(compoundProperties.Compound.Name, 2)); yield return(objectsToAdd); } }
public static StructureElement CreateRelativeStructureElement(this BuildTracker tracker, string structureElementName, int level = 1) { return(tracker.GetStructureElementRelativeToLast(structureElementName, level)); }
public override void Build(IEnumerable <IFormulaUsablePath> formulaUsablePaths, BuildTracker buildTracker) { _builderRepository.Report(tableFor(formulaUsablePaths), buildTracker); }
private void checkThatOutputFileIsWritable(BuildTracker buildTracker) { var fileFullPath = buildTracker.ReportFullPath; FileHelper.TrySaveFile(fileFullPath, () => { }); }
private void copyCreatedToPdfToDesiredLocation(string createdPDF, BuildTracker buildTracker) { checkThatOutputFileIsWritable(buildTracker); FileHelper.Copy(createdPDF, buildTracker.ReportFullPath); }
/// <summary> /// This methods brings all information together to compile the generated TEX code with the predefined template to given /// pdf file path. /// </summary> /// <param name="texContent">The generated TEX Content to be written</param> /// <param name="attachements">List of attachements that will be added to the report</param> /// <param name="settings">settings used to configure the report</param> /// <param name="buildTracker">The current build tracker used to compile the report</param> public async Task CompileReport(StringBuilder texContent, IEnumerable <Attachement> attachements, ReportSettings settings, BuildTracker buildTracker) { checkThatOutputFileIsWritable(buildTracker); //copy content of template folder into working directory var texFilePath = copyTemplateToOutputDirectory(settings, buildTracker.WorkingDirectory, buildTracker.ReportFileName + ".tex"); //copy content file to working dir var workingContentFile = Path.Combine(buildTracker.WorkingDirectory, settings.ContentFileName + ".tex"); File.WriteAllText(workingContentFile, texContent.ToString()); //copy attachments attachements.Each(x => x.CopyToWorkingDirectory(buildTracker.WorkingDirectory)); settings.Implement(texFilePath); var createdPDF = await _texCompiler.CompileTex(texFilePath, settings.NumberOfCompilations); //Report could not be found. Something went wrong during the creation process. Throw an exception if (!FileHelper.FileExists(createdPDF)) { throw new TeXReportCompilerException(buildTracker.WorkingDirectory); } //creation successful: Copy to final location copyCreatedToPdfToDesiredLocation(createdPDF, buildTracker); }
private void createTranspoortAndExcretion(Compound compound, List <object> report, BuildTracker tracker) { var thisSection = new List <object>(); thisSection.AddRangeSafe(partialProcesses <TransportPartialProcess>(compound)); thisSection.AddRangeSafe(systemicProcesses(compound, SystemicProcessTypes.Renal)); thisSection.AddRangeSafe(systemicProcesses(compound, SystemicProcessTypes.Biliary)); thisSection.AddRangeSafe(systemicProcesses(compound, SystemicProcessTypes.GFR)); addToReport(report, tracker, thisSection, PKSimConstants.UI.TransportAndExcretionProcesses); }
private static void WriteTranspiled(BuildTargetAdvancedCollection buildTargets, BuildTracker buildTracker) { ProgressWriter progressWriter = new ProgressWriter("Writing Transpiled Scripts", buildTargets.Sum(bt => buildTracker.GetBuiltScripts(bt.Name).Count)); //WTM: Change: Added: Transpile QF first since some transpilation will be done while writing. //Types will be inferenced like TES4PublicanBloatedFloatOrmil, and if Standalone gets written first, those files will be incorrect. //The below OrderBy statement puts QF first. foreach (var buildTarget in buildTargets.OrderBy(bt => !bt.IsQF())) { buildTarget.Write(buildTracker, progressWriter); } progressWriter.WriteLast(); }
public override void Build(DescriptorCriteria descriptorCriteria, BuildTracker buildTracker) { buildTracker.TeX.Append(TeXChunk(descriptorCriteria)); buildTracker.Track(descriptorCriteria); }
public void write(BuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter) { Write(buildTracker.GetBuiltScripts(target.GetTargetName()).Values, progressWriter); }
/* * No injection is done here because of multithreaded enviroment which messes it up. * Maybe at some point we will have a proper DI into the jobs. * TranspileChunkJob constructor. */ public TranspileChunkJob(BuildTracker buildTracker, List <Dictionary <BuildTargetAdvanced, List <string> > > buildPlan, ESMAnalyzer esmAnalyzer) { this.buildPlan = buildPlan; this.buildTracker = buildTracker; this.esmAnalyzer = esmAnalyzer; }