Esempio n. 1
0
        public void Update(string path, CKAN.Resource resource)
        {
            var r = resource.result;

            RevisionId   = r.revision_id;
            LastRevision = r.last_modified;
            LastImport   = DateTime.Now;

            WriteJson(path);
        }
Esempio n. 2
0
        public async Task ImportAsync()
        {
            // Load source from config file.

            //LoadConfig();

            // Get Resource from CKAN.

            //await GetCKANResource();

            // Check resource revision.

            //if (!CheckResourceUpdate())
            //    return;

            // Download Resource



            resource = new CKAN.Resource();


            //await DownloadResource();

            //Stream fs = File.Open("C:\\Users\\Developer\\Desktop\\brisbane-city-council.json", FileMode.Open);

            //downloadStream = new StreamReader(fs);

            //var s = downloadStream.ReadToEnd();

            // Import resource records

            EventRecord thing1 = JsonConvert.DeserializeObject <EventRecord>(File.ReadAllText(@"C:\\Users\\Developer\\Desktop\\brisbane-city-council.json"));

            var jsontest = JsonConvert.SerializeObject(thing1, Formatting.Indented);

            Console.WriteLine(jsontest);


            ImportRecords();

            // Write converted records

            WriteRecords();

            // Update data source

            UpdateDataSource();

            // Pause

            Console.ReadKey();
        }
Esempio n. 3
0
        public async Task GetCKANResource()
        {
            Console.WriteLine("Getting CKAN resource {0} from {1}", source.ResourceId, source.BaseAddress);

            ckan     = new CKAN.Client(source.BaseAddress);
            resource = await ckan.GetResourceAsync(source.ResourceId);

            if (!resource.success)
            {
                throw new Exception("Error retrieving CKAN resource info.");
            }
        }