コード例 #1
0
        public bool TryLoadJob(string filename)
        {
            try {
                using (var stream = File.OpenRead(filename))
                    _ctx.Jobs.Enqueue(MailJob.CreateSerializer().Deserialize(stream) as MailJob);

                return(true);
            } catch (Exception ex) {
                _ctx.Logger.Error(ex, $"Failed to load job {filename}");
            }

            return(false);
        }
コード例 #2
0
 public void SaveJob(string filename, MailJob job)
 {
     using (var stream = File.Open(filename, FileMode.Create))
         MailJob.CreateSerializer().Serialize(stream, job);
 }