Ejemplo n.º 1
0
        public void Save(string folderName)
        {
            CreateDirectories(folderName, "static", "course", "chapter", "sequential", "vertical", "video", "html", "lti", "problem");
            foreach (var file in StaticFiles)
            {
                var newName = $"{folderName}/static/{Path.GetFileName(file)}";
                if (!Path.GetFullPath(file).Equals(Path.GetFullPath(newName), StringComparison.OrdinalIgnoreCase))
                {
                    File.Copy(file, newName, true);
                }
            }

            var courseFile = $"{folderName}/course.xml";

            if (File.Exists(courseFile))
            {
                CourseWithChapters.UrlName = new FileInfo(courseFile).DeserializeXml <EdxCourse>().UrlName;
            }
            else
            {
                File.WriteAllText(courseFile, this.XmlSerialize());
            }

            CourseWithChapters.Save(folderName);
        }
Ejemplo n.º 2
0
        public void Save(string folderName)
        {
            CreateDirectories(folderName, "course", "chapter", "sequential", "vertical", "video", "html", "lti", "static", "problem");
            foreach (var file in StaticFiles)
            {
                File.Copy(file, string.Format("{0}/static/{1}", folderName, Path.GetFileName(file)), true);
            }

            var courseFile = string.Format("{0}/course.xml", folderName);

            if (File.Exists(courseFile))
            {
                CourseWithChapters.UrlName = new FileInfo(courseFile).DeserializeXml <EdxCourse>().UrlName;
            }
            else
            {
                File.WriteAllText(courseFile, this.XmlSerialize());
            }

            CourseWithChapters.Save(folderName);
        }