Пример #1
0
 public static TimetableExportSettings ToUntis(this ITimetableInput settings)
 {
     return(new TimetableExportSettings
     {
         FirstLesson = settings.FirstLesson,
         UseWeeks = settings.UseWeeks
     });
 }
        private List <string> GetWhitelist(ITimetableInput timetableInput)
        {
            switch (Type)
            {
            case TimetableType.Grade:
                return(timetableInput.Grades);

            case TimetableType.Subject:
                return(timetableInput.Subjects);
            }

            return(new List <string>());
        }
        public Task <TimetableExportResult> GetLessonsAsync(string contents, ITimetableInput settings)
        {
            var htmlSettings = settings as ITimetableInput;

            if (htmlSettings != null)
            {
                var untisSettings = htmlSettings.ToUntis();
                untisSettings.Type = Type;

                return(exporter.ParseHtmlAsync(contents, untisSettings));
            }

            return(Task.FromResult <TimetableExportResult>(null));
        }
        public bool IsMarkedToExport(string objective, ITimetableInput timetableInput)
        {
            var whitelist = GetWhitelist(timetableInput);

            foreach (var pattern in whitelist)
            {
                var glob = Glob.Parse(pattern);
                if (glob.IsMatch(objective))
                {
                    return(true);
                }
            }

            return(false);
        }