private void BuildDownloadResource()
        {
            var filePath = @"{0}_{1}" + @"\" + this.constants.CultureCode + @"\Activity_" + this.Activity.Id + ".json";

            SavePath = this.constants.LocalContentPath + filePath;

            switch (this.constants.ContentGenerateBy)
            {
            case LevelType.Level:
                // activity, step, lesson, unit, level.
                this.baseModelId = this.Activity.ParentModule.ParentModule.ParentModule.ParentModule.Id;
                this.SavePath    = string.Format(SavePath, "level", this.baseModelId);
                break;

            case LevelType.Unit:
                this.baseModelId = this.Activity.ParentModule.ParentModule.ParentModule.ParentModule.Id;
                this.SavePath    = string.Format(SavePath, "unit", this.baseModelId);
                break;

            case LevelType.Lesson:
                this.baseModelId = this.Activity.ParentModule.ParentModule.ParentModule.Id;
                this.SavePath    = string.Format(SavePath, "lesson", this.baseModelId);
                break;
            }

            // Add download path to
            MapfileItem f = new MapfileItem();

            f.FileName = string.Format(filePath, "level", this.baseModelId);;
            // TODO:: To get SHA like value.
            f.SHA = "1";
            ResourceList.Add(f);
        }
Ejemplo n.º 2
0
        //
        public LevelContentResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie resourceService, IConstants constants)
        {
            this.downloadService             = downloadService;
            this.levelContentResourceService = resourceService;
            this.constants = constants;

            this.Level = module as Level;

            var filePath = string.Format(@"level_{0}\{1}\Level_{2}.json", this.Level.Id, this.constants.CultureCode, this.Level.Id);

            this.savePath = this.constants.LocalContentPath + filePath;

            this.ResourceList = new List <MapfileItem>();

            MapfileItem f = new MapfileItem();

            f.FileName = filePath;

            this.ResourceList.Add(f);
        }
Ejemplo n.º 3
0
        public MediaResourceDownloadManager(IDownloadService downloadService, IBaseModule module, IContentResourceServcie activityContentResourceService, IConstants constants)
        {
            this.downloadService = downloadService;
            this.baseModule      = module;
            this.constants       = constants;
            this.activityContentResourceService = activityContentResourceService;

            string oriContent = this.activityContentResourceService.Content;

            mediaList = ContentHelper.GetMediaResources(ref oriContent);

            this.ResourceList = new List <MapfileItem>();

            // Build ResourceList for Mapfile.
            foreach (var m in mediaList)
            {
                MapfileItem f = new MapfileItem();
                f.FileName = m;
                ResourceList.Add(f);
            }
        }