Example #1
0
 public void OnStartDownload(DeploymentFile file)
 {
     StartDownload?.Invoke(new DownloadEventArgs
     {
         File = file,
     });
 }
            public FileDownloader(WebControl webControl, string expectedFile, string targetFile, StartDownload startDownload)
            {
                m_sExpectedFullName = Path.Combine(webControl.DownloadPath, expectedFile);
                if (targetFile == null)
                {
                    m_sTargetFile = Path.Combine(
                        webControl.DownloadPath,
                        $"{System.Guid.NewGuid().ToString()}.{Path.GetExtension(expectedFile)}");
                }
                else
                {
                    m_sTargetFile = targetFile;
                }

                // make sure that file doesn't already exist
                if (File.Exists(m_sExpectedFullName))
                {
                    throw new Exception(
                              $"File {m_sExpectedFullName} already exists! our temp download directory should start out empty! Someone not cleaning up?");
                }

                m_startDownload = startDownload;
            }
Example #3
0
 protected void OnStartDownload(
     DownloadEventArgs args)
 {
     StartDownload?.Invoke(args);
 }