/// <summary> /// This function is used to get the Values in XML Format based on the selected sites in the layer /// </summary> /// <param name="info">DownloadInfo</param> /// <param name="getValueProgressHandler">Progress handler</param> /// <returns>Collection of of the xml files with values</returns> /// <exception cref="DownloadXmlException">Some exception during get values from web service</exception> public IEnumerable <string> DownloadXmlDataValues(OneSeriesDownloadInfo info, IGetValuesProgressHandler getValueProgressHandler) { try { return(GetWsClientInstance(info.Wsdl).GetValuesXML(info.FullSiteCode, info.FullVariableCode, info.StartDate, info.EndDate, info.EstimatedValuesCount, getValueProgressHandler)); } catch (Exception ex) { Exception exToWrap; if (ex is TargetInvocationException && ex.InnerException != null) { exToWrap = ex.InnerException; } else { exToWrap = ex; } throw new DownloadXmlException(exToWrap.Message, exToWrap); } }
/// <summary> /// Converts the xml file to a data series object. /// </summary> /// <param name="dInfo">Download info</param> /// <returns>Collection of the data series objects</returns> /// <exception cref="DataSeriesFromXmlException">Exception during parsing</exception> /// <exception cref="NoSeriesFromXmlException">Throws when no series in xml file</exception> public IEnumerable <Series> DataSeriesFromXml(OneSeriesDownloadInfo dInfo) { var client = GetWsClientInstance(dInfo.Wsdl); var parser = ParserFactory.GetParser(client.ServiceInfo); var result = new List <Series>(); foreach (var xmlFile in dInfo.FilesWithData) { try { using (var fileStream = new FileStream(xmlFile, FileMode.Open)) { var seriesList = parser.ParseGetValues(fileStream); result.AddRange(seriesList); } } catch (Exception ex) { throw new DataSeriesFromXmlException(ex.Message, ex); } } if (result.Count == 0) { throw new NoSeriesFromXmlException(); } return(result); }
private void DoLogError(string message, Exception exception, OneSeriesDownloadInfo di) { if (di != null) { message = string.Format("Error in {0}:" + Environment.NewLine + message, di.SeriesDescription); } else { message = "Error: " + message; } DoLog(LogKind.Error, message, exception); }
public GetValueProgressHandler(DownloadManager manager, OneSeriesDownloadInfo di) { _manager = manager; _di = di; }
public DoDownloadArg(OneSeriesDownloadInfo di, CommnonDoDownloadInfo commonInfo, Thread downloadThread) { DownloadInfo = di; CommnonInfo = commonInfo; DownloadThread = downloadThread; }