public void Init(string tempPath, string testname, QTIVersion version) { var engine = new RazorLightEngineBuilder() //.UseProject(new EmbeddedRazorProject(typeof(QtiPackageCreator))) .UseEmbeddedResourcesProject(typeof(QtiPackageCreator)) .UseMemoryCachingProvider() .Build(); _choiceInterationCreator = new ChoiceInteractionCreator(version, engine); _textEntryInteractionCreator = new TextEntryInteractionCreator(version, engine); _testCreator = new TestCreator(version, engine); _manifestCreator = new ManifestCreator(version, engine); _testname = testname; var dir = new DirectoryInfo(tempPath); if (!dir.Exists) { dir.Create(); } var packagePath = Path.Combine(tempPath, Path.GetRandomFileName()); var itemPath = Path.Combine(packagePath, "items"); var baseDir = new DirectoryInfo(packagePath); var itemDir = new DirectoryInfo(itemPath); if (!baseDir.Exists) { baseDir.Create(); } if (!itemDir.Exists) { itemDir.Create(); } }
public TextEntryInteractionCreator(QTIVersion version, RazorLightEngine engine) { _version = version; _engine = engine; }
/// <summary> /// Convert items and create package /// </summary> /// <param name="testname"></param> /// <param name="items"></param> /// <param name="tempPath"></param> /// <param name="version"></param> /// <returns>File location of zip file</returns public Task <string> CreatePackageWithPlainTextItems(QTIVersion version, string testname, IEnumerable <IItem> items, string tempPath) { Init(tempPath, testname, version); return(ConvertItems(items, tempPath, false, null)); }
/// <summary> /// Create items and create package /// </summary> /// <param name="testname"></param> /// <param name="items"></param> /// <param name="tempPath"></param> /// <param name="resourceHandler"></param> /// <param name="version"></param> /// <returns>File location of zip file</returns public Task <string> CreatePackageWithRichTextItems(QTIVersion version, string testname, IEnumerable <IItem> items, string tempPath, Func <string, IRetrievedFile> resourceHandler) { Init(tempPath, testname, version); return(ConvertItems(items, tempPath, true, resourceHandler)); }
public TestCreator(QTIVersion version, RazorLightEngine engine) { _version = version; _engine = engine; }
public ChoiceInteractionCreator(QTIVersion version, RazorLightEngine engine) { _version = version; _engine = engine; }