Пример #1
0
        public override string ToString()
        {
            var str = "{";

            str += RawDataReport.NewProp("name", name);
            str += RawDataReport.NewProp("url", url);
            str += RawDataReport.NewProp("size", size);
            str += RawDataReport.NewProp("date", date, true);
            str += "}";
            return(str);
        }
Пример #2
0
        public override string ToString()
        {
            var str = "{";

            str += RawDataReport.NewProp("startDate", RawDataReport.ToDateStr(startDate));
            str += RawDataReport.NewProp("endDate", RawDataReport.ToDateStr(endDate));
            str += RawDataReport.NewProp("format", format);
            str += RawDataReport.NewProp("dataset", dataset, true);
            str += "}";
            return(str);
        }
Пример #3
0
 public void Download(RawDataReport report)
 {
     for (int a = 0; a < report.result.fileList.Count; a++)
     {
         string file = report.result.fileList[a].url;
         using (WebClient client = new WebClient())
         {
             string fileName = report.result.fileList[a].name;
             if (fileName.Contains("headers.gz"))
             {
                 fileName = report.request.dataset + "_" + report.result.fileList[a].name;
             }
             string savePath = PathFromFileName(fileName);
             client.DownloadFile(file, savePath);
         }
     }
 }
Пример #4
0
        public override string ToString()
        {
            var str = "{";

            str += RawDataReport.NewProp("size", size);
            str += RawDataReport.NewProp("eventCount", eventCount);
            str += "\"fileList\":[";
            for (var a = 0; a < fileList.Count; a++)
            {
                str += fileList[a].ToString();
                if (a < fileList.Count - 1)
                {
                    str += ",";
                }
            }
            str += "]}";
            return(str);
        }
Пример #5
0
 public bool FilesHaveLoaded(RawDataReport report)
 {
     if (report.result == null || report.result.fileList.Count == 0)
     {
         return(false);
     }
     for (var a = 0; a < report.result.fileList.Count; a++)
     {
         string fileName = report.result.fileList[a].name;
         if (fileName.Contains("headers.gz"))
         {
             fileName = report.request.dataset + "_" + report.result.fileList[a].name;
         }
         if (!FileHasLoaded(fileName))
         {
             return(false);
         }
     }
     return(true);
 }
Пример #6
0
        private RawDataReport SubmitRequest(RawDataRequest request)
        {
            RawDataReport report = null;

            using (WebClient client = new WebClient())
            {
                client.Encoding = System.Text.Encoding.UTF8;
                Authorization(client);
                string url   = string.Format(CreateJobPath, m_AppId);
                string start = request.startDate.ToString("yyyy-MM-dd");
                string end   = request.endDate.ToString("yyyy-MM-dd");
                string data  = "\"startDate\":\"{0}\",\"endDate\":\"{1}\",\"format\":\"{2}\",\"dataset\":\"{3}\"";
                data = "{" + string.Format(data, start, end, "tsv", request.dataset) + "}";
                string result = client.UploadString(new Uri(url), "POST", data);
                var    dict   = MiniJSON.Json.Deserialize(result) as Dictionary <string, object>;
                report = new RawDataReport(dict);
            }

            return(report);
        }
Пример #7
0
        public RawDataReport ContinueFromJob(RawDataReport priorReport, DateTime endDate)
        {
            RawDataReport report = null;

            using (WebClient client = new WebClient())
            {
                client.Encoding = System.Text.Encoding.UTF8;
                Authorization(client);
                string url  = string.Format(CreateJobPath, m_AppId);
                string end  = endDate.ToString("yyyy-MM-dd");
                string data = "\"continueFrom\":\"{0}\",\"endDate\":\"{1}\",\"format\":\"{2}\",\"dataset\":\"{3}\"";
                data = "{" + string.Format(data, priorReport.id, end, "tsv", priorReport.request.dataset) + "}";
                string result = client.UploadString(new Uri(url), "POST", data);
                var    dict   = MiniJSON.Json.Deserialize(result) as Dictionary <string, object>;
                report = new RawDataReport(dict);
                // fill in the startDate for reporting purposes
                report.request.startDate = priorReport.request.endDate;
            }

            return(report);
        }
Пример #8
0
 public RawDataReport ContinueFromJob(RawDataReport priorReport)
 {
     return(ContinueFromJob(priorReport, DateTime.UtcNow));
 }