public RepositorySource(string url, RepositoryBay Bay, string pwd_server)
        {
            _url        = url;
            _pwd_server = pwd_server;


            _bay = Bay;

            servidores_path = Bay.ToDirectoryInfo();

            _servidores    = new ObservableCollection <Servidor>();
            _servidoresMis = new ObservableCollection <ServidorMision>();
        }
        public async Task <bool> DownloadRepositoriesJson()
        {
            bay = new RepositoryBay();

            try
            {
                string url    = $"{webrepository}/repositories.json";
                string target = $"{bay.ToDirectoryInfo().FullName}\\repositories.json";


                await DownloadAsync(url, target);

                string json = File.ReadAllText(bay.ToDirectoryInfo().FullName + @"\repositories.json");

                repolight = JsonConvert.DeserializeObject <List <RepositoryProxy> >(json);

                return(true);

                //double oldsum = 0;
                //double newsum = 0;

                /*
                 * foreach (RepositoryProxy r in repolight)
                 * {
                 *  string repofolder = bay.GetDirectoryForRepo(r.Nombre).FullName;
                 *  string repo = r.Nombre;
                 *
                 *  WinWebDownload dltstamp = new WinWebDownload();
                 *
                 *  if (!File.Exists(repofolder + @"\timestamp_" + repo + @".txt"))
                 *  {
                 *      r.MustUpdate = true;
                 *      dltstamp.DownloadFile(webrepository, repo + @"/timestamp.txt", repofolder + @"\timestamp_" + repo + @".txt");
                 *      continue;
                 *  }
                 *
                 *  if (File.Exists(repofolder + @"\timestamp_" + repo + @".txt"))
                 *  {
                 *      File.Copy(repofolder + @"\timestamp_" + repo + @".txt", repofolder + @"\timestamp_" + repo + @".old");
                 *      File.Delete(repofolder + @"\timestamp_" + repo + @".txt");
                 *  }
                 *  else
                 *  {
                 *  }
                 *
                 *
                 *  dltstamp.DownloadFile(webrepository, repo + @"/timestamp.txt", repofolder + @"\timestamp_" + repo + @".new");
                 *
                 *  oldsum = System.Convert.ToDouble(File.ReadAllText(bay.GetDirectoryForRepo(r.Nombre).FullName + @"\timestamp_" + r.Nombre + @".txt"));
                 *
                 *  newsum = System.Convert.ToDouble(File.ReadAllText(repofolder + @"\timestamp_" + r.Nombre + @".new"));
                 *
                 *  r.MustUpdate = (newsum > oldsum) ? true : false;
                 *
                 *  if (r.MustUpdate)
                 *  {
                 *      File.Copy(repofolder + @"\timestamp_" + repo + @".txt", repofolder + @"\timestamp_" + repo + @".old");
                 *      File.Delete(repofolder + @"\timestamp_" + repo + @".old");
                 *      File.Copy(repofolder + @"\timestamp_" + repo + @".new", repofolder + @"\timestamp_" + repo + @".txt");
                 *      File.Delete(repofolder + @"\timestamp_" + repo + @".new");
                 *  }
                 *  else
                 *  {
                 *      File.Delete(repofolder + @"\timestamp_" + repo + @".new");
                 *  }
                 * }
                 */
            }
            catch
            {
                repolight = new List <RepositoryProxy>();
                return(false);
            }
        }