GetFullFileName() public method

public GetFullFileName ( string targetDir ) : string
targetDir string
return string
Exemplo n.º 1
0
        private bool DownloadFile(FileInfo f)
        {
            var targetFile = f.GetFullFileName(targetDir);

            if (f.Type == FileType.Exec)
            {
                startExec = targetFile;
            }

            if (File.Exists(targetFile))
            {
                var fi = new System.IO.FileInfo(targetFile);
                if (fi.LastWriteTimeUtc == f.Date && fi.Length == f.Size)
                {
                    return(true);
                }
            }

            Directory.CreateDirectory(Path.Combine(targetDir, f.DestPath));

            var adr = new Uri(new Uri(address), "Bootstrapper.svc/GetFile/" + f.DestPath + "/" + f.Name);

            service.DownloadFileAsync(adr, targetFile);
            downloadEvent.WaitOne();

            if (!downloadError)
            {
                File.SetCreationTimeUtc(targetFile, f.Date);
                File.SetLastWriteTimeUtc(targetFile, f.Date);
                File.SetLastAccessTimeUtc(targetFile, f.Date);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        private bool DownloadFile(FileInfo f)
        {
            var targetFile = f.GetFullFileName(targetDir);

            if (f.Type == FileType.Exec)
            {
                startExec = targetFile;
            }

            if (File.Exists(targetFile))
            {
                var fi = new System.IO.FileInfo(targetFile);
                if (fi.LastWriteTimeUtc == f.Date && fi.Length == f.Size) return true;
            }

            Directory.CreateDirectory(Path.Combine(targetDir, f.DestPath));

            var adr = new Uri(new Uri(address), "Bootstrapper.svc/GetFile/" + f.DestPath + "/" + f.Name);
            service.DownloadFileAsync(adr, targetFile);
            downloadEvent.WaitOne();

            if (!downloadError)
            {
                File.SetCreationTimeUtc(targetFile, f.Date);
                File.SetLastWriteTimeUtc(targetFile, f.Date);
                File.SetLastAccessTimeUtc(targetFile, f.Date);
                return true;
            }
            else
            {
                return false;
            }
        }