Esempio n. 1
0
        void IDownloadCache.Add(Uri uri, string path, WebHeaderCollection headers)
        {
            CachObject cach = new CachObject()
            {
                URI = uri.AbsoluteUri, PATH = path, HEADERS = headers.AllKeys
            };
            string jsonData = JsonConvert.SerializeObject(cach);
            string Path     = Base64.Base64Encode(uri.AbsolutePath).Replace("\\", "");

            File.WriteAllText(filepath + Path, jsonData);
        }
Esempio n. 2
0
        string IDownloadCache.Get(Uri uri, WebHeaderCollection headers)
        {
            string Path = Base64.Base64Encode(uri.AbsolutePath).Replace("\\", "");
            string PATH = filepath + Path;

            if (File.Exists(PATH))
            {
                var        JsonEncoded = File.ReadAllText(PATH);
                CachObject account     = JsonConvert.DeserializeObject <CachObject>(JsonEncoded);
                return(account.PATH);
            }
            else
            {
                return(null);
            }
        }