本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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();
}