S҂̂\[X̂͂@B
ǂł炵ĂƂꂵłB
Tips̋lߍ킹ϐFXłB


Imports System.IO
Public Class Form1
    Dim FP As String = System.IO.Directory.GetCurrentDirectory()
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'OpenFileDialogNX̃CX^X쐬
        Dim ofd As New OpenFileDialog()
        Dim dckaly As New ArrayList
        Dim ngdckaly As New ArrayList
        Dim i As Integer = 0
        Dim str As String
        Dim ary As New ArrayList
        DeckList_txt.Text = ""

        TextBox1.Text = "ȉfbLɊ܂܂Ă֎~J[hXg" & vbCrLf
        '͂߂̃t@Cw肷
        '͂߂Ɂut@Cvŕ\镶w肷
        ofd.FileName = "decklist.txt"
        '͂߂ɕ\tH_w肷
        'w肵Ȃi̕j̎́Ã݂fBNg\
        ofd.InitialDirectory = FP
        '[t@C̎]ɕ\Iw肷
        'w肵ȂƂׂẴt@C\
        ofd.Filter = _
            "TEXTt@C(*.text;*.txt)|*.text;*.txt|ׂẴt@C(*.*)|*.*"
        '[t@C̎]ł͂߂
        'uׂẴt@CvIĂ悤ɂ
        ofd.FilterIndex = 2
        '^Cgݒ肷
        ofd.Title = "Jt@CIĂ"
        '_CAO{bNXOɌ݂̃fBNg𕜌悤ɂ
        ofd.RestoreDirectory = True
        '݂Ȃt@C̖Ow肳ꂽƂx\
        'ftHgTrueȂ̂Ŏw肷Kv͂Ȃ
        ofd.CheckFileExists = True
        '݂ȂpXw肳ꂽƂx\
        'ftHgTrueȂ̂Ŏw肷Kv͂Ȃ
        ofd.CheckPathExists = True

        '_CAO\
        If ofd.ShowDialog() = DialogResult.OK Then
            'OK{^NbNꂽƂ
            'Iꂽt@C\
            'Console.WriteLine(ofd.FileName)
            Dim sr As New System.IO.StreamReader(ofd.FileName, System.Text.Encoding.GetEncoding("shift_jis"))

            Dim nglst As New System.IO.StreamReader(FP & "\NGlist.txt", System.Text.Encoding.GetEncoding("shift_jis"))

            While nglst.Peek() > -1
                ary.Add(nglst.ReadLine())
            End While

            'esǂݍ
            While sr.Peek() > -1
                str = sr.ReadLine()
                DeckList_txt.Text &= str & vbCrLf
                For Each chk As String In ary
                    If HasString(str, chk) = True Then
                        TextBox1.Text &= str & vbCrLf
                    End If
                Next
            End While
            '
            sr.Close()
            nglst.Close()
        End If
    End Sub

    Public Function HasString(ByVal target As String, ByVal word As String) As Boolean
        If word = "" Then
            Return False
        End If
        If target = "" Then
            Return False
        End If
        target = StrConv(UCase(target), VbStrConv.Narrow)
        word = StrConv(UCase(word), VbStrConv.Narrow)

        If target.IndexOf(word) >= 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "fbLǂݍ" & vbCrLf & "֎~J[h`FbN"
    End Sub
End Class
