Click here to Skip to main content
15,896,201 members
Articles / Programming Languages / Visual Basic

Text Log Viewer

Rate me:
Please Sign up or sign in to vote.
3.30/5 (6 votes)
19 Aug 2009CPOL2 min read 53.5K   2.3K   30  
Text Log Viewer
Module SatirIslem

    Public CLs_Kriterler As New List(Of Cls_SatirOZellik)
    Public Mdl_AyarDosyasi As String = Application.StartupPath & "\ayarlar.xml"
    Public MDL_Dil As String = "TR"

    Sub SatirTanimYukle()

        On Error Resume Next

        Dim Pxml As New XmlPlus.XmlConfig
        Pxml.LoadXmlFromFile(Mdl_AyarDosyasi)

        CLs_Kriterler.Clear()

        For Each s As XmlPlus.ConfigSetting In Pxml.Settings("Renk").Children
            CLs_Kriterler.Add(New Cls_SatirOZellik(s("tanim").Value, System.Drawing.Color.FromArgb(s("yazi").Value), System.Drawing.Color.FromArgb(s("arkaalan").Value), s("icon").Value))
        Next

    End Sub

    Function KriterBul(ByVal str As String) As Cls_SatirOZellik
        Dim cs As New Cls_SatirOZellik

        For Each c As Cls_SatirOZellik In CLs_Kriterler
            '   Dim regex As New System.Text.RegularExpressions.Regex(c.Tanim)

            If System.Text.RegularExpressions.Regex.Matches(str, c.Tanim).Count > 0 Then
                cs.Renk_ArkaAlan = c.Renk_ArkaAlan
                cs.Renk_Yazi = c.Renk_Yazi
                cs.ImgIndex = c.ImgIndex
                Return (cs)
            End If
        Next

        cs.Renk_ArkaAlan = Color.White
        cs.Renk_Yazi = Color.Black
        cs.ImgIndex = Nothing

        Return (cs)
    End Function

    Function DosyaOku(ByVal Dosya As String, ByVal nerden As Double) As String()

        Try
            Dim file As New System.IO.StreamReader(New System.IO.FileStream(Dosya, IO.FileMode.Open, IO.FileAccess.Read))
            file.BaseStream.Seek(nerden, IO.SeekOrigin.Current)
            Dim Okunan() As String = Split(file.ReadToEnd, vbCrLf)
            DosyaOku = Okunan
            file.Close()
            file = Nothing

        Catch ex As Exception
            Return Nothing
        End Try

    End Function

    Sub KriterKaydet()

        Dim Pxml As New XmlPlus.XmlConfig
        Pxml.LoadXmlFromFile(Mdl_AyarDosyasi, True)
        Pxml.Settings("Renk").RemoveChildren()
        Pxml.Commit()

        For i As Int16 = 0 To CLs_Kriterler.Count - 1
            Pxml.Settings("Renk")("item" & i)("tanim").Value = CLs_Kriterler(i).Tanim
            Pxml.Settings("Renk")("item" & i)("yazi").Value = CLs_Kriterler(i).Renk_Yazi.ToArgb
            Pxml.Settings("Renk")("item" & i)("arkaalan").Value = CLs_Kriterler(i).Renk_ArkaAlan.ToArgb
            Pxml.Settings("Renk")("item" & i)("icon").Value = CLs_Kriterler(i).ImgIndex
        Next

        Pxml.Commit()
        
    End Sub

    Sub DosyaAc(ByVal dosya As String)


        For Each c As WeifenLuo.WinFormsUI.Docking.DockContent In MainF.Dck_1.Documents
            Dim adosya As String = c.Text.Replace("*", "")
            If Trim(LCase(adosya)) = Trim(LCase(dosya)) Then
                Dim yanit As MsgBoxResult = MsgBox(dosya & vbCrLf & " Zaten Açık.İkinci Bir Kopya Açmak İstiyormusunuz ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question)
                If yanit = MsgBoxResult.No Then

                    c.Activate()
                    c.Select()
                    Exit Sub
                End If
            End If

        Next


        Dim flog As New Frm_Log

        flog.DockPanel = MainF.Dck_1
        flog.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Unknown
        flog.Show()
        flog.Okunacak_Dosya = dosya
        flog.Basla()

        SaveSetting(Application.ProductName, "SonDosya", "SonDosya", dosya)

    End Sub

    Sub SonIslenenDosya(ByVal dosya As String)

        If Not dosya Is Nothing Then
            MainF.TsM.Visible = True
            MainF.TsM.Text = "    Last File : " & dosya
        End If

    End Sub

    Sub CellStil(ByVal c As DataGridViewTextBoxCell, ByVal yazistil As Cls_SatirOZellik)
        c.Style.BackColor = yazistil.Renk_ArkaAlan
        c.Style.ForeColor = yazistil.Renk_Yazi
    End Sub

    Sub GenelCikis()
        Do
            Try

                For Each c As WeifenLuo.WinFormsUI.Docking.DockContent In MainF.Dck_1.Documents
                    c.Close()
                Next

            Catch ex As Exception

            End Try

        Loop Until MainF.Dck_1.DocumentsCount = 0

        End


    End Sub


End Module

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Turkey Turkey
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions