File: OldResult.vb

package info (click to toggle)
mono-basic 2.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 18,852 kB
  • ctags: 809
  • sloc: cs: 8,852; makefile: 516; sh: 307
file content (70 lines) | stat: -rwxr-xr-x 2,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Public Class OldResult
    Private m_Filename As String

    Sub New(ByVal Filename As String)
        m_Filename = Filename
    End Sub

    ReadOnly Property Result() As Test.Results
        Get
            Dim tmp As String
            Dim value As Test.Results

            Dim file As String = IO.Path.GetFileNameWithoutExtension(m_Filename)

            Dim iEnd As Integer
            iEnd = file.LastIndexOf("."c)
            If iEnd > 0 AndAlso System.Enum.IsDefined(GetType(Test.Results), file.Substring(iEnd + 1)) Then
                tmp = file.Substring(iEnd + 1)
            Else
                Dim xml As New Xml.XPath.XPathDocument(m_Filename)
                Dim navigator As Xml.XPath.XPathNavigator
                Dim node As Xml.XPath.XPathNavigator

                navigator = xml.CreateNavigator
                node = navigator.SelectSingleNode("Test/Result")

                tmp = node.Value

                Try
                    Dim destFile As String
                    destFile = IO.Path.Combine(IO.Path.GetDirectoryName(m_Filename), file & "." & tmp & ".testresult")
                    IO.File.Move(m_Filename, destFile)
                    m_Filename = destFile
                Catch

                End Try
            End If

            value = CType([Enum].Parse(GetType(Test.Results), tmp), Test.Results)

            Return value
        End Get
    End Property

    ReadOnly Property Verification() As String
        Get
            Return "(not implemented)"
        End Get
    End Property

    ReadOnly Property Compiler() As String
        Get
            Dim tmp As String

            Dim xml As New Xml.XmlDocument
            Dim node As Xml.XmlNode
            xml.Load(m_Filename)
            node = xml.SelectSingleNode("Test/Compiler")
            tmp = node.InnerText

            Return tmp
        End Get
    End Property

    ReadOnly Property Text() As String
        Get
            Return IO.File.ReadAllText(m_Filename)
        End Get
    End Property
End Class