Esempio n. 1
0
        private static Card[] GetCardsInfo(WebAccess webAccess, string url)
        {
            string filePath = Path.Combine(Path.GetTempPath(), WantedBulkType + ".json");

            try
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
                webAccess.DownloadFile(url, filePath);
                using (StreamReader re = new StreamReader(filePath))
                {
                    using (JsonTextReader reader = new JsonTextReader(re))
                    {
                        JsonSerializer se = new JsonSerializer();
                        return(se.Deserialize <Card[]>(reader));
                    }
                }
            }
            finally
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
            }
        }