⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.vb

📁 大名鼎鼎的mono是.NET平台的跨平台(支持linux
💻 VB
📖 第 1 页 / 共 3 页
字号:
                Return 0            End If            Return m_Compilation.Process.ExitCode        End Get    End Property    ''' <summary>    ''' Get the files as a string with the filenames quoted.    ''' </summary>    ''' <returns></returns>    ''' <remarks></remarks>    Public Function GetFileList() As String        Dim result As String = ""        For Each file As String In m_Files            result = result & " """ & file & """"        Next        Return result    End Function    ''' <summary>    ''' The response file, if any.    ''' </summary>    ''' <remarks></remarks>    ReadOnly Property ResponseFile() As String        Get            Return m_ResponseFile        End Get    End Property    ReadOnly Property RspFile() As String        Get            Return m_RspFile        End Get    End Property    ''' <summary>    ''' The name of the test.    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property Name() As String        Get            Return m_Name        End Get    End Property    ''' <summary>    ''' The result of the test.    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property Success() As Boolean        Get            Return m_Result = Results.Success        End Get    End Property    ''' <summary>    ''' THe result of the test.    ''' </summary>    ''' <value></value>    ''' <returns></returns>    ''' <remarks></remarks>    ReadOnly Property Result() As Results        Get            Return m_Result        End Get    End Property    ReadOnly Property OldResult() As Results        Get            Return m_OldResult        End Get    End Property    ''' <summary>    ''' Has this test multiple files?    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property IsMultiFile() As Boolean        Get            Return m_Files.Count > 1        End Get    End Property    Function GetOutputAssembly() As String        Return IO.Path.Combine(Me.OutputPath, Name & "." & m_TargetExtension)    End Function    Function GetOutputVBCAssembly() As String        Return IO.Path.Combine(Me.OutputPath, Name & "_vbc." & m_TargetExtension)    End Function    ''' <summary>    ''' Get the xml output files.    ''' </summary>    ''' <returns></returns>    ''' <remarks></remarks>    Function GetOutputFiles() As String()        Dim result As String()        If IO.Directory.Exists(OutputPath) Then            result = New String() {} 'IO.Directory.GetFiles(OutputPath, Name & OutputPattern)        Else            result = New String() {}        End If        Return result    End Function    Function GetVerifiedFiles() As String()        Dim result As String()        If IO.Directory.Exists(OutputPath) Then            result = new String(){}'IO.Directory.GetFiles(OutputPath, Name & VerifiedPattern)        Else            result = New String() {}        End If        Return result    End Function    ''' <summary>    ''' Returns a commandline to execute this test. Does not include the compiler executable.    ''' Arguments are quoted, ready to execute.    ''' </summary>    ''' <returns></returns>    ''' <remarks></remarks>    Function GetTestCommandLine(Optional ByVal ForVBC As Boolean = False) As String        Dim result As New System.Text.StringBuilder        Initialize()        result.Append(" "c)        For Each str As String In GetTestCommandLineArguments(ForVBC)            If str.Contains(" "c) Then                result.Append("""" & str & """")            Else                result.Append(str)            End If            result.Append(" "c)        Next        Return result.ToString    End Function    ''' <summary>    ''' Returns the commandline arguments to execute this test. Does not include the compiler executable.    ''' Arguments are not quoted!    ''' </summary>    ''' <returns></returns>    ''' <remarks></remarks>    Function GetTestCommandLineArguments(Optional ByVal ForVBC As Boolean = False) As String()        Dim result As New Generic.List(Of String)        Initialize()        'First option is always the /out: argument.        Const OutArgument As String = "-out:{0}"        Dim outputFilename, outputPath As String        If ForVBC Then            outputFilename = GetOutputVBCAssembly()        Else            outputFilename = GetOutputAssembly()        End If        outputPath = IO.Path.GetDirectoryName(outputFilename)        If IO.Directory.Exists(outputPath) = False Then            IO.Directory.CreateDirectory(outputPath)        End If        result.Add(String.Format(OutArgument, outputFilename))        'If there is one unique .rsp file, use it        If m_RspFile <> "" Then            result.Add("@" & m_RspFile)        Else            'otherwise add the file, the default response file and the extra .response file if any.            result.AddRange(CType(m_Files, Generic.IEnumerable(Of String)))            result.Add("-libpath:" & m_BasePath)            If m_DefaultRspFile <> "" Then                result.Add("@" & m_DefaultRspFile)            End If            If m_ResponseFile <> "" Then result.Add("@" & m_ResponseFile)        End If        If m_NoConfig Then            result.Add("-noconfig")        End If        Return result.ToArray()    End Function    ReadOnly Property FailedVerification() As VerificationBase        Get            If m_Verifications Is Nothing Then Return Nothing            For Each v As VerificationBase In m_Verifications                If v.Result = False Then Return v            Next            Return Nothing        End Get    End Property    ReadOnly Property FailedVerificationMessage() As String        Get            Dim tmp As VerificationBase = FailedVerification            If tmp IsNot Nothing Then Return tmp.DescriptiveMessage            Return ""        End Get    End Property    Sub Initialize()        Dim rsp As String        Dim contents As String        rsp = IO.Path.Combine(m_BasePath, Name) & ".response"        If IO.File.Exists(rsp) Then m_ResponseFile = rsp Else m_ResponseFile = ""        rsp = IO.Path.Combine(m_BasePath, Name) & ".rsp"        If IO.File.Exists(rsp) Then m_RspFile = rsp Else m_RspFile = ""        rsp = IO.Path.Combine(m_BasePath, "all.rsp")        If IO.File.Exists(rsp) Then m_DefaultRspFile = rsp Else m_DefaultRspFile = ""        'Find the target of the test (exe, winexe, library, module)        m_Target = "exe" 'default target.        If m_RspFile <> "" Then            contents = IO.File.ReadAllText(m_RspFile)            m_Target = GetTarget(contents, m_Target)            m_NoConfig = IsNoConfig(contents)        Else            If m_DefaultRspFile <> "" Then                contents = IO.File.ReadAllText(m_DefaultRspFile)                m_Target = GetTarget(contents, m_Target)                m_NoConfig = IsNoConfig(contents) OrElse m_NoConfig            End If            If m_ResponseFile <> "" Then                contents = IO.File.ReadAllText(m_ResponseFile)                m_Target = GetTarget(contents, m_Target)                m_NoConfig = IsNoConfig(contents) OrElse m_NoConfig            End If        End If        m_TargetExtension = GetTargetExtension(m_Target)    End Sub    ReadOnly Property IsDirty() As Boolean        Get            If IO.File.Exists(Me.GetOutputAssembly) = False Then Return True            If AreExecutablesDirty Then Return True            If IsSourceDirty Then Return True            Return False        End Get    End Property    ''' <summary>    ''' Returns true if any of the verification executables has changed.    ''' </summary>    ''' <value></value>    ''' <returns></returns>    ''' <remarks></remarks>    ReadOnly Property AreExecutablesDirty() As Boolean        Get            Dim fileDate As Date            Dim filesToCheck As New Generic.List(Of String)            If Parent.VBNCPath <> "" Then filesToCheck.Add(Parent.VBNCPath)            If Parent.VBCPath <> "" Then filesToCheck.Add(Parent.VBCPath)            If PEVerifyPath <> "" Then filesToCheck.Add(PEVerifyPath)            If GetACPath <> "" Then filesToCheck.Add(GetACPath)            For Each item As String In filesToCheck                fileDate = IO.File.GetLastWriteTime(item)                If fileDate > m_LastRun Then Return True            Next            Return False        End Get    End Property    ''' <summary>    ''' Returns true if the vbc assembly is dirty as well (the source has changed).    ''' </summary>    ''' <value></value>    ''' <returns></returns>    ''' <remarks></remarks>    ReadOnly Property IsSourceDirty() As Boolean        Get            If IO.File.Exists(Me.GetOutputVBCAssembly) = False Then                Return True            ElseIf IO.File.GetLastWriteTime(Me.GetOutputVBCAssembly) < LastSourceWrite Then                Return True            Else                Return False            End If        End Get    End Property    ''' <summary>    ''' Returns the last date of any source file or response file.    ''' </summary>    ''' <value></value>    ''' <returns></returns>    ''' <remarks></remarks>    ReadOnly Property LastSourceWrite() As Date        Get            Dim lastDate As Date            Dim fileDate As Date            Dim filesToCheck As New Generic.List(Of String)            filesToCheck.AddRange(m_Files)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -