示例#1
0
		public BuildUpContext(DirectoryInfo dir, CourseSettings courseSettings, Lesson lesson)
		{
			Dir = dir;
			CourseSettings = courseSettings;
			Lesson = lesson;
			Extractors = new List<RegionsExtractor>();
		}
示例#2
0
		public BuildUpContext(IFileSystem fileSystem, CourseSettings courseSettings, Lesson lesson)
		{
			FileSystem = fileSystem;
			CourseSettings = courseSettings;
			Lesson = lesson;
			Extractors = new List<RegionsExtractor>();
		}
示例#3
0
		private void ConvertSlide(Slide slide)
		{
			if (slide.ShouldBeSolved)
				return;
			Console.WriteLine(slide.Info.SlideFile.FullName);
			var lesson = new Lesson(slide.Title, slide.NormalizedGuid, slide.Blocks);
			var path = Path.ChangeExtension(slide.Info.SlideFile.FullName, "lesson.xml");
			using (var writer = new StreamWriter(path, false, Encoding.UTF8))
				lessonSerializer.Serialize(writer, lesson);
			slide.Info.SlideFile.Delete();
		}
示例#4
0
		public void CovertLessonSlidesToXml()
		{
			var coursesDirectory = new DirectoryInfo("../../../courses");
			var courseDirectories = coursesDirectory.GetDirectories("Slides", SearchOption.AllDirectories);
			var serializer = new XmlSerializer(typeof(Lesson));
			foreach (var courseDirectory in courseDirectories)
			{
				var course = new CourseLoader().LoadCourse(courseDirectory);
				foreach (var slide in course.Slides)
				{
					if (slide.ShouldBeSolved) continue;
					var lesson = new Lesson(slide.Title, slide.Id, slide.Blocks);
					var path = Path.ChangeExtension(slide.Info.SlideFile.FullName, "lesson.xml");
					var file = new FileInfo(path);
					using (var stream = file.OpenWrite())
						serializer.Serialize(stream, lesson);
					slide.Info.SlideFile.Delete();
				}
			}
		}