/// <summary> /// Legacy funtion, to be deleted if the rest is stable /// </summary> /// <param name="location"></param> /// <param name="DownloadPath"></param> /// <param name="Connection"></param> public void DownloadAndSliceAndUploadAssociatedFile(string location, string DownloadPath, OctoprintConnection Connection) { JObject info = Connection.Files.GetFileInfo(location, this.Path); JToken refs = info.Value <JToken>("refs"); string downloadLink = refs.Value <string>("download"); this.Connection = Connection; using (WebClient myWebClient = new WebClient()) { try { //myWebClient.DownloadFileAsync(new Uri(downloadLink), DownloadPath); myWebClient.DownloadFile(new Uri(downloadLink), DownloadPath + FileName); LocalFilePath = DownloadPath + FileName; SlicedFilePath = DownloadPath + FileName; SlicedFilePath = System.IO.Path.ChangeExtension(LocalFilePath, null); FileReadyForSlicing?.Invoke(this, new FileReadyForSlicingArgs(LocalFilePath)); //SliceAndUpload(LocalFilePath, SlicedFilePath); } catch (Exception e) { var msg = e.Message; } } }
private void SetDownloadedFileLocalInformation(string downloadPath) { LocalFilePath = System.IO.Path.Combine(downloadPath, FileName); FileReadyForSlicing?.Invoke(this, new FileReadyForSlicingArgs(LocalFilePath)); }