当前位置: 首页>>代码示例>>C#>>正文


C# FileInfo.DeserializeXml方法代码示例

本文整理汇总了C#中System.IO.FileInfo.DeserializeXml方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.DeserializeXml方法的具体用法?C# FileInfo.DeserializeXml怎么用?C# FileInfo.DeserializeXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileInfo的用法示例。


在下文中一共展示了FileInfo.DeserializeXml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

		public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings)
		{
			var quiz = file.DeserializeXml<Quiz>();
			BuildUp(quiz, file.Directory, settings);
			quiz.InitQuestionIndices();
			var slideInfo = new SlideInfo(unitName, file, slideIndex);
			return new QuizSlide(slideInfo, quiz);
		}
开发者ID:kontur-edu,项目名称:uLearn,代码行数:8,代码来源:QuizSlideLoader.cs

示例2: Load

		public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings)
		{
			var quiz = file.DeserializeXml<Quiz>();
			int index = 1;
			foreach (var b in quiz.Blocks.OfType<AbstractQuestionBlock>())
			{
				b.QuestionIndex = index++;
			}
			var slideInfo = new SlideInfo(unitName, file, slideIndex);
			return new QuizSlide(slideInfo, quiz);
		}
开发者ID:andgein,项目名称:uLearn,代码行数:11,代码来源:QuizSlideLoader.cs

示例3: Load

		public Slide Load(FileInfo file, string unitName, int slideIndex, CourseSettings settings)
		{
			var lesson = file.DeserializeXml<Lesson>();
		    var dir = file.Directory;
			var context = new BuildUpContext(dir, settings, lesson);
			var blocks = lesson.Blocks.SelectMany(b => b.BuildUp(context, ImmutableHashSet<string>.Empty)).ToList();
			var slideInfo = new SlideInfo(unitName, file, slideIndex);
			if (blocks.OfType<ExerciseBlock>().Any())
				return new ExerciseSlide(blocks, slideInfo, lesson.Title, Guid.Parse(lesson.Id));
			return new Slide(blocks, slideInfo, lesson.Title, Guid.Parse(lesson.Id));
		}
开发者ID:kontur-edu,项目名称:uLearn,代码行数:11,代码来源:LessonSlideLoader.cs

示例4: DeserializeBlocks

		private static SlideBlock[] DeserializeBlocks(string blocksXml)
		{
			var input = [email protected]"
<Lesson xmlns='https://ulearn.azurewebsites.net/lesson'>
{blocksXml}
</Lesson>";
			File.WriteAllText("temp.xml", input);
			var fileInfo = new FileInfo("temp.xml");
			var buildUpContext = new BuildUpContext(new DirectoryInfo("."), CourseSettings.DefaultSettings, null);
			return fileInfo.DeserializeXml<Lesson>().Blocks
				.SelectMany(b => b.BuildUp(buildUpContext, ImmutableHashSet<string>.Empty))
				.ToArray();
		}
开发者ID:kontur-edu,项目名称:uLearn,代码行数:13,代码来源:Lesson_ShouldDeserialize.cs


注:本文中的System.IO.FileInfo.DeserializeXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。