コード例 #1
0
    public string RequestRecords(DataRecordSetter Setter, int offset, int limit, string model_set_type = "vis", string service = "", string query = "", string starttime = "", string endtime = "", string location = "", string state = "", string modelname = "", string timestamp_start = "", string timestamp_end = "", string model_vars = "", DownloadType type = DownloadType.Record, string OutputPath = "", string OutputName = "")
    {
        List <DataRecord> Records = new List <DataRecord>();

        // Make a request to the root html service. -- Need to pass in a call back function...
        string req = Root + App + "/search/datasets.json" + "?offset=" + offset + "&model_set_type=" + model_set_type + "&limit=" + limit + "&version=3";

        if (starttime != "" && endtime != "")
        {
            req += "&startime=" + starttime + "&endtime=" + endtime;
        }
        if (query != "")
        {
            req += "&query=" + query;
        }
        if (location != "")
        {
            req += "&location=" + location;
        }
        if (modelname != "")
        {
            req += "&modelname=" + modelname;
        }
        if (state != "")
        {
            req += "&state=" + state;
        }
        if (timestamp_start != "")
        {
            req += "&timestamp_start=" + timestamp_start;
        }
        if (timestamp_end != "")
        {
            req += "&timestamp_end=" + timestamp_end;
        }
        if (model_vars != "")
        {
            req += "&model_vars=" + model_vars;
        }

        // Make the request and enqueue it...
        // Request Download --
        //DataRecordJob Job = new DataRecordJob();
        var Obs = new GenericObservable(factory, type, OutputPath, OutputName);

        Obs.callback = Setter;
        Obs.Token    = GenerateToken("RequestRecords");
        Obs.Request(Records, DownloadRecords2, req);
        AddObservable(Obs);
        //DataRecords[req] = Job;

        // Need to put the setter somewhere.

        return(req);
    }
コード例 #2
0
    /// Metadata function needs a setter as well
    ///
    public void GetMetaData(DataRecordSetter Setter, List <DataRecord> records, DownloadType type = DownloadType.Record, string OutputPath = "", string OutputName = "")
    {
        // One Record only for this function
        if (!records[0].services.ContainsKey("xml_fgdc"))
        {
            return;
        }
        string xml_url = records[0].services["xml_fgdc"];
        // Register Job with Data Tracker
        var Obs = new GenericObservable(factory, type, OutputPath, OutputName);

        Obs.callback = Setter;

        // Generate Token
        Obs.Token = GenerateToken("RequestRecords");

        //
        Obs.Request(records, GetMetaData, xml_url);
        AddObservable(Obs);
    }