Пример #1
0
        public static EventList GetEventsLocal(int groupID)
        {
            List <Event> localEvents = Serialisation.FromJsonFile <List <Event> >(FilePath.SavedTimetable(groupID));

            if (localEvents == null)
            {
                return(null);
            }
            var events = new EventList(localEvents);

            return(events);
        }
        public static List <LessonSettings> GetLessonSettings(int groupID)
        {
            var    lessonSettings = new List <LessonSettings>();
            string filePath       = FilePath.LessonSettings(groupID);

            if (!File.Exists(filePath))
            {
                return(lessonSettings);
            }

            lessonSettings = Serialisation.FromJsonFile <List <LessonSettings> >(filePath) ?? lessonSettings;
            return(lessonSettings);
        }
Пример #3
0
        public static Group GetSelected()
        {
            string filePath = FilePath.SelectedGroup;

            if (!File.Exists(filePath))
            {
                return(null);
            }

            Group selectedGroup = Serialisation.FromJsonFile <Group>(filePath);

            return(selectedGroup);
        }
Пример #4
0
        private static DateTime?GetLastCistAllEntitiesUpdateTime()
        {
            string filePath = FilePath.LastCistAllEntitiesUpdate;

            if (!File.Exists(filePath))
            {
                return(null);
            }

            DateTime lastTimetableUpdate = Serialisation.FromJsonFile <DateTime>(filePath);

            return(lastTimetableUpdate);
        }
Пример #5
0
        public static List <Group> GetAllLocal()
        {
            List <Group> loadedGroups;

            string filePath = FilePath.AllGroupsList;

            if (!File.Exists(filePath))
            {
                return(null);
            }

            loadedGroups = Serialisation.FromJsonFile <List <Group> >(filePath);
            return(loadedGroups);
        }
Пример #6
0
        public static List <SavedGroup> GetSaved()
        {
            List <SavedGroup> loadedGroups = new List <SavedGroup>();

            string filePath = FilePath.SavedGroupsList;

            if (!File.Exists(filePath))
            {
                return(loadedGroups);
            }

            loadedGroups = Serialisation.FromJsonFile <List <SavedGroup> >(filePath) ?? loadedGroups;
            return(loadedGroups);
        }
Пример #7
0
        public static DateTime?GetLastTimetableUpdate()
        {
#if DEBUG
            return(null);
#endif

            string filePath = FilePath.LastTimetableUpdate;
            if (!File.Exists(filePath))
            {
                return(null);
            }

            DateTime lastTimetableUpdate = Serialisation.FromJsonFile <DateTime>(filePath);
            return(lastTimetableUpdate);
        }
Пример #8
0
        public static List <Local.TimetableInfo> GetTimetableLocal(params Local.SavedEntity[] entities)
        {
            var timetables = new List <Local.TimetableInfo>();

            if (entities == null)
            {
                return(timetables);
            }
            foreach (Local.SavedEntity entity in entities)
            {
                Local.TimetableInfo timetableInfo = Serialisation.FromJsonFile <Local.TimetableInfo>(FilePath.SavedTimetable(entity.Type, entity.ID));
                if (timetableInfo == null)
                {
                    continue;
                }
                timetables.Add(timetableInfo);
            }
            return(timetables);
        }
        public static async Task <List <Local::TimetableInfo> > GetTimetableLocal(List <Local::Entity> entities)
        {
            List <Local::TimetableInfo> timetables = new();

            if (entities == null)
            {
                return(timetables);
            }
            foreach (var entity in entities)
            {
                Local::TimetableInfo timetableInfo = await Serialisation.FromJsonFile <Local::TimetableInfo>(FilePath.SavedTimetable(entity.Type, entity.ID));

                if (timetableInfo == null)
                {
                    continue;
                }
                timetables.Add(timetableInfo);
            }
            return(timetables);
        }
Пример #10
0
 public static AppSettings GetSettings()
 {
     return(Serialisation.FromJsonFile <AppSettings>(FilePath.AppSettings) ?? new AppSettings());
 }