// Does not work yet.. does not return at the moment, not sure why, specs seem to be correctly implemented //public async Task<string> GetEventStream(CamEvent camEvent) //{ // var httpRequest = new HttpRequest(); // httpRequest.Parameters.Add("api", "SYNO.SurveillanceStation.Streaming"); // httpRequest.Parameters.Add("version", "1"); // httpRequest.Parameters.Add("_sid", _sessionId); // httpRequest.Parameters.Add("eventId", camEvent.Id.ToString()); // httpRequest.Parameters.Add("method", "EventStream"); // httpRequest.Headers.Add("User-Agent", "SynoCam"); // httpRequest.Headers.Add("Range", "bytes=0-9999999"); // httpRequest.Headers.Add("Icy-MetaData", "1"); // var eventData = await GetDataFromUrl(httpRequest, _url + "streaming.cgi"); // return ""; //} public string DownloadEvent(ICamEvent camEvent, AsyncCompletedEventHandler fileDownloadCompleted, DownloadProgressChangedEventHandler progressChanged) { string tempPath = Path.GetTempPath(); string nameWithoutPrefix = camEvent.Name.Substring(camEvent.Name.LastIndexOf("/", StringComparison.Ordinal) + 1); string url = string.Format("{0}entry.cgi/{1}?api=SYNO.SurveillanceStation.Event&method=Download&version=4&eventId={2}&_sid={3}", _url, nameWithoutPrefix, camEvent.Id, _sessionId); string tempFile = Path.Combine(tempPath, nameWithoutPrefix); using (var downloadClient = new WebClient()) { downloadClient.DownloadFileCompleted += fileDownloadCompleted; downloadClient.DownloadFileCompleted += (sender, args) => _deleteFilesBeforeExit.Add(tempFile); downloadClient.DownloadProgressChanged += progressChanged; downloadClient.DownloadFileAsync(new Uri(url), tempFile); } return(tempFile); }
// Does not work yet.. does not return at the moment, not sure why, specs seem to be correctly implemented //public async Task<string> GetEventStream(CamEvent camEvent) //{ // var httpRequest = new HttpRequest(); // httpRequest.Parameters.Add("api", "SYNO.SurveillanceStation.Streaming"); // httpRequest.Parameters.Add("version", "1"); // httpRequest.Parameters.Add("_sid", _sessionId); // httpRequest.Parameters.Add("eventId", camEvent.Id.ToString()); // httpRequest.Parameters.Add("method", "EventStream"); // httpRequest.Headers.Add("User-Agent", "SynoCam"); // httpRequest.Headers.Add("Range", "bytes=0-9999999"); // httpRequest.Headers.Add("Icy-MetaData", "1"); // var eventData = await GetDataFromUrl(httpRequest, _url + "streaming.cgi"); // return ""; //} public string DownloadEvent(ICamEvent camEvent, AsyncCompletedEventHandler fileDownloadCompleted, DownloadProgressChangedEventHandler progressChanged) { string tempPath = Path.GetTempPath(); string nameWithoutPrefix = camEvent.Name.Substring(camEvent.Name.LastIndexOf("/", StringComparison.Ordinal) + 1); string url = string.Format("{0}entry.cgi/{1}?api=SYNO.SurveillanceStation.Event&method=Download&version=4&eventId={2}&_sid={3}", _url, nameWithoutPrefix, camEvent.Id, _sessionId); string tempFile = Path.Combine(tempPath, nameWithoutPrefix); using (var downloadClient = new WebClient()) { downloadClient.DownloadFileCompleted += fileDownloadCompleted; downloadClient.DownloadFileCompleted += (sender, args) => _deleteFilesBeforeExit.Add(tempFile); downloadClient.DownloadProgressChanged += progressChanged; downloadClient.DownloadFileAsync(new Uri(url), tempFile); } return tempFile; }
public string DownloadEvent(ICamEvent camEvent, AsyncCompletedEventHandler fileDownloadCompleted, DownloadProgressChangedEventHandler progressChanged) { return _connector.DownloadEvent(camEvent, fileDownloadCompleted, progressChanged); }
public void ShowDialog(SynoCommand synoCommand, ICamEvent camEvent) { _filePath = synoCommand.DownloadEvent(camEvent, FileDownloadCompleted, ProgressChanged); ShowDialog(); }
public string DownloadEvent(ICamEvent camEvent, AsyncCompletedEventHandler fileDownloadCompleted, DownloadProgressChangedEventHandler progressChanged) { return(_connector.DownloadEvent(camEvent, fileDownloadCompleted, progressChanged)); }
public string DownloadEvent(ICamEvent camEvent, AsyncCompletedEventHandler fileDownloadCompleted, DownloadProgressChangedEventHandler progressChanged) { throw new NotImplementedException(); }