' *
' * The project site is at: http://sourceforge.jp/projects/fishbornas/
' *
' * First author tiritomato 2012.
' *
' * Distributed under the FishbornArchiveShelf License (See
' *  file "Licenses/License.txt" contained in a project, or the following link.
' *  http://sourceforge.jp/projects/fishbornas/scm/svn/blobs/head/trunk/Licenses/License.txt)
' *
' * 2012.06.07 Initial Revision (tiritomato)
' *

Public Class NetworkDownloadFile
    Inherits Microsoft.Build.Utilities.Task

    Public Sub New()
    End Sub

    <Microsoft.Build.Framework.Required()> _
    Public Property Address As String

    <Microsoft.Build.Framework.Required()> _
    Public Property DestinationFileName As String

    Public Property UserName As String = String.Empty
    Public Property Password As String = String.Empty
    Public Property ShowUI As Boolean = False
    Public Property ConnectionTimeout As Integer = 100
    Public Property Overwrite As Boolean = False

    Public Overrides Function Execute() As Boolean
        Execute = True
        Try
            My.Computer.Network.DownloadFile(Address, DestinationFileName, UserName, Password, ShowUI, ConnectionTimeout, Overwrite)
        Catch ex As Exception
            Execute = False
        End Try
    End Function

End Class
