コード例 #1
0
ファイル: QtiConverter.cs プロジェクト: Citolab/qti-creator
        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();
            }
        }
コード例 #2
0
 public TextEntryInteractionCreator(QTIVersion version, RazorLightEngine engine)
 {
     _version = version;
     _engine  = engine;
 }
コード例 #3
0
ファイル: QtiConverter.cs プロジェクト: Citolab/qti-creator
 /// <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));
 }
コード例 #4
0
ファイル: QtiConverter.cs プロジェクト: Citolab/qti-creator
 /// <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));
 }
コード例 #5
0
ファイル: TestCreator.cs プロジェクト: Citolab/qti-creator
 public TestCreator(QTIVersion version, RazorLightEngine engine)
 {
     _version = version;
     _engine  = engine;
 }
コード例 #6
0
 public ChoiceInteractionCreator(QTIVersion version, RazorLightEngine engine)
 {
     _version = version;
     _engine  = engine;
 }