Example #1
0
            public static void download(SvnMappedUrl svnMappedUrl, string baseUrl, string targetFolder)
            {
                if (svnMappedUrl.VirtualPath == "../")
                    return;
                var localVirtualPath = svnMappedUrl.FullPath.Replace(baseUrl, "");
                localVirtualPath = WebEncoding.urlDecode(localVirtualPath);
                log.debug("svn download: {0}", svnMappedUrl.FullPath);
                Files.checkIfDirectoryExistsAndCreateIfNot(targetFolder);
                if (svnMappedUrl.IsFile)
                {
                    var localfile = targetFolder.pathCombine(localVirtualPath);

                    //var fileContents = Web.getUrlContents(svnMappedUrl.FullPath);
                    //Files.WriteFileContent(localfile,fileContents);

                    new Web().downloadBinaryFile(svnMappedUrl.FullPath, localfile);

                    if (!File.Exists(localfile))
                        //        			log.info("contents saved to local file: {0}", localfile);
                        //        		else
                        log.info("could not create file: {0}", localfile);
                }
                else
                {
                    var localfolder = targetFolder.pathCombine(localVirtualPath);
                    log.debug("   ... remote target was a folder, so creating local folder: {0}", localfolder);
                    Files.checkIfDirectoryExistsAndCreateIfNot(localfolder);
                }

                //var codeToParse = Web.getUrlContents(urlToFetch);
            }
            public static void download(SvnMappedUrl svnMappedUrl, string baseUrl, string targetFolder)
            {
                if (svnMappedUrl.VirtualPath == "../")
                {
                    return;
                }
                var localVirtualPath = svnMappedUrl.FullPath.Replace(baseUrl, "");

                localVirtualPath = WebEncoding.urlDecode(localVirtualPath);
                log.debug("svn download: {0}", svnMappedUrl.FullPath);
                Files.checkIfDirectoryExistsAndCreateIfNot(targetFolder);
                if (svnMappedUrl.IsFile)
                {
                    var localfile = targetFolder.pathCombine(localVirtualPath);

                    //var fileContents = Web.getUrlContents(svnMappedUrl.FullPath);
                    //Files.WriteFileContent(localfile,fileContents);

                    new Web().downloadBinaryFile(svnMappedUrl.FullPath, localfile);

                    if (!File.Exists(localfile))
                    {
                        //                  log.info("contents saved to local file: {0}", localfile);
                        //              else
                        log.info("could not create file: {0}", localfile);
                    }
                }
                else
                {
                    var localfolder = targetFolder.pathCombine(localVirtualPath);
                    log.debug("   ... remote target was a folder, so creating local folder: {0}", localfolder);
                    Files.checkIfDirectoryExistsAndCreateIfNot(localfolder);
                }

                //var codeToParse = Web.getUrlContents(urlToFetch);
            }