File: frmFiles.vb

package info (click to toggle)
mono-basic 2.10-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 22,964 kB
  • sloc: cs: 34,086; xml: 7,804; makefile: 471; sh: 317
file content (68 lines) | stat: -rw-r--r-- 2,416 bytes parent folder | download | duplicates (3)
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
Imports System.Collections.Generic
Imports System.IO

Class frmFiles
    Private m_Main As frmMain

    Sub New(ByVal Main As frmMain)
        m_Main = Main

        InitializeComponent()
    End Sub

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        MyBase.OnLoad(e)

        Try
            'Check each file
            Dim files As New List(Of String)
            Dim dir As String = Path.GetDirectoryName(m_Main.Tests.Filename)
            Dim found As Boolean

            For Each vbfile As String In Directory.EnumerateFiles(dir, "*.vb", SearchOption.AllDirectories)
                found = False
                If vbfile.EndsWith("Bugs\bug-80967.vb") Then Continue For
                If Path.GetFileName(Path.GetDirectoryName(vbfile)) = "Generated" Then Continue For
                For Each t As Test In m_Main.Tests.Values
                    For j As Integer = 0 To t.Files.Count - 1
                        If vbfile = Path.GetFullPath(Path.Combine(t.FullWorkingDirectory, t.Files(j))) Then
                            found = True
                            Exit For
                        End If
                    Next
                    If found Then Exit For
                Next
                If found Then Continue For
                files.Add(vbfile)
            Next

            For Each s As String In files
                lstFiles.Items.Add(s)
            Next
        Catch ex As Exception
            MsgBox(ex.Message & vbNewLine & ex.StackTrace)
        End Try
    End Sub

    Private Sub cmdCreateTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreateTest.Click
        Try
            For Each item As ListViewItem In lstFiles.SelectedItems
                Using frmNew As New frmNewTest(m_Main)
                    frmNew.txtName.Text = Path.GetFileNameWithoutExtension(item.Text)
                    frmNew.txtFilename.Text = item.Text
                    frmNew.ShowDialog(Me)
                End Using
            Next
        Catch ex As Exception
            MsgBox(ex.Message & vbNewLine & ex.StackTrace)
        End Try
    End Sub

    Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
        Try
            Close()
        Catch ex As Exception
            MsgBox(ex.Message & vbNewLine & ex.StackTrace)
        End Try
    End Sub
End Class