Exemplo n.º 1
0
 public static void Save()
 {
     lock (_updatelock)
     {
         string cpath = Path.Combine(UserDataPath.Get(), updatehistory);
         File.WriteAllText(cpath, JsonConvert.SerializeObject(_updates));
     }
 }
Exemplo n.º 2
0
        public void Load()
        {
            string cpath = Path.Combine(UserDataPath.Get(), follows);

            if (File.Exists(cpath))
            {
                string str = File.ReadAllText(cpath);
                JsonConvert.PopulateObject(str, this);
            }
        }
 public void Save()
 {
     lock (_downloadslock)
     {
         List <EpisodeWithDownloadSettings> sv = new List <EpisodeWithDownloadSettings>();
         foreach (DownloadItem d in _downloads)
         {
             EpisodeWithDownloadSettingAndStatus dk = new EpisodeWithDownloadSettingAndStatus();
             d.Episode.CopyTo(dk);
             dk.DownloadStatus = d.Status;
             sv.Add(dk);
         }
         string cpath = Path.Combine(UserDataPath.Get(), downloads);
         File.WriteAllText(cpath, JsonConvert.SerializeObject(sv));
     }
 }
Exemplo n.º 4
0
 public static void Load()
 {
     lock (_updatelock)
     {
         string cpath = Path.Combine(UserDataPath.Get(), updatehistory);
         if (File.Exists(cpath))
         {
             string str = File.ReadAllText(cpath);
             _updates = JsonConvert.DeserializeObject <Dictionary <string, string> >(str);
         }
         else
         {
             _updates = new Dictionary <string, string>();
         }
         IsLoaded = true;
     }
 }
        public List <DownloadItem> Load(string template, string downloadpath)
        {
            List <DownloadItem> downs = new List <DownloadItem>();
            string cpath = Path.Combine(UserDataPath.Get(), downloads);

            if (File.Exists(cpath))
            {
                string str = File.ReadAllText(cpath);
                List <EpisodeWithDownloadSettingAndStatus> dm = JsonConvert.DeserializeObject <List <EpisodeWithDownloadSettingAndStatus> >(str);
                foreach (EpisodeWithDownloadSettingAndStatus ep in dm)
                {
                    if (ep.DownloadStatus == DownloadStatus.Queue || ep.DownloadStatus == DownloadStatus.Downloading)
                    {
                        ep.DownloadStatus = DownloadStatus.Queue;
                    }
                    downs.Add(Add(ep, template, downloadpath, ep.DownloadStatus));
                }
            }
            return(downs);
        }
Exemplo n.º 6
0
        public void Save()
        {
            string cpath = Path.Combine(UserDataPath.Get(), follows);

            File.WriteAllText(cpath, JsonConvert.SerializeObject(this));
        }