Esempio n. 1
0
        public static bool Lock(LockSchedule schedule)
        {
            if (FileLocker.DenyAccess(schedule.FolderPath))
            {
                ScheduleSerialiser.Serialise(schedule);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public static bool Serialise(LockSchedule schedule)
        {
            try
            {
                Stream stream = new FileStream(
                    $@"{SerialObjectsDirectory}\{schedule.SerialName}",
                    FileMode.Create, FileAccess.Write);
                IFormatter formatter = new BinaryFormatter();

                formatter.Serialize(stream, schedule);
                stream.Close();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }