Beispiel #1
0
 public SessionData()
 {
     TitlePage = new TitlePage();
     ChapterOne = new ChapterOne();
     ChapterThree = new ChapterThree();
     ChapterFour = new ChapterFour();
     ChapterSixPartTwoThree = new ChapterSixPartTwoThree();
     ChapterSixPartFourFive = new ChapterSixPartFourFive();
     ChapterSeven = new ChapterSeven();
     ChapterEight = new ChapterEight();
     ChapterNine = new ChapterNine();
 }
Beispiel #2
0
 /// <summary>
 /// получить информацию о сессиях
 /// </summary>
 /// <param name="sesType">Start или Complete</param>
 /// <returns></returns>
 public List<SessionDirInfo> GetDisciplinesFromSessions(SessionType sesType)
 {
     var result = new List<SessionDirInfo>();
     var path = "";
     switch (sesType)
     {
         case SessionType.Start: path = _startDir; break;
         case SessionType.Complete: path = _completeDir; break;
         default: path = _startDir; break;
     }
     var childDirs = new DirectoryInfo(path).GetDirectories();
     _loading = true;
     foreach (var d in childDirs)
     {
         var files = new DirectoryInfo(d.FullName).GetFiles();
         foreach (var f in files)
         {
             var titlePage = new TitlePage();
             if (f.Name.Substring(0, f.Name.Length - 4) == titlePage.GetType().Name)
             {
                 try
                 {
                     var ob = Activator.CreateInstance(titlePage.GetType());
                     ob = SerializeHelper.Deserialize(ob, f.FullName);
                     titlePage = ob as TitlePage;
                 }
                 catch
                 {
                     continue;
                 }
                 if (titlePage.Discipline != String.Empty)
                 {
                     result.Add(
                         new SessionDirInfo
                         {
                             CreationDate = d.CreationTime,
                             DisciplineName = titlePage.Discipline,
                             Path = d.FullName,
                             DisciplineCode = titlePage.DisciplineCode,
                             FormOftraining = titlePage.FormOfTraining
                         });
                 }
                 break;
             }
         }
     }
     _loading = false;
     return result;
 }