1269 lines
48 KiB
VB.net
1269 lines
48 KiB
VB.net
|
|
Imports System.IO
|
|||
|
|
Imports System.Threading
|
|||
|
|
Imports FlexCell
|
|||
|
|
|
|||
|
|
Public Class RCU_Logviewer
|
|||
|
|
|
|||
|
|
Enum TableColName
|
|||
|
|
ID = 1
|
|||
|
|
TimeSpan
|
|||
|
|
mac
|
|||
|
|
createdatetime
|
|||
|
|
logfilename
|
|||
|
|
logprojectid
|
|||
|
|
logroomid
|
|||
|
|
log_valid
|
|||
|
|
log_sn
|
|||
|
|
log_len
|
|||
|
|
log_datetime
|
|||
|
|
log_timespan
|
|||
|
|
log_type
|
|||
|
|
log_content
|
|||
|
|
type_param_1
|
|||
|
|
type_param_2
|
|||
|
|
type_param_3
|
|||
|
|
type_param_4
|
|||
|
|
type_param_5
|
|||
|
|
type_param_6
|
|||
|
|
type_param_7
|
|||
|
|
type_param_8
|
|||
|
|
type_param_9
|
|||
|
|
type_param_10
|
|||
|
|
remark
|
|||
|
|
End Enum
|
|||
|
|
|
|||
|
|
Private Sub RCU_Logviewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|||
|
|
pan_sqldata.Parent = Nothing
|
|||
|
|
Timer1.Start()
|
|||
|
|
g_fileAnalysisThread = New Thread(AddressOf FileDataToSqlRuning)
|
|||
|
|
Text = Text & "__" & Application.ProductVersion
|
|||
|
|
My.Settings.Reload()
|
|||
|
|
DirPath_txt.Text = My.Settings.FileDir
|
|||
|
|
LoadingFileTreeInit()
|
|||
|
|
g_RowFileDic = New Dictionary(Of Integer, String)
|
|||
|
|
|
|||
|
|
'初始化字体
|
|||
|
|
Dim theFont As New System.Drawing.Text.InstalledFontCollection
|
|||
|
|
theFont = New System.Drawing.Text.InstalledFontCollection()
|
|||
|
|
For Each family As System.Drawing.FontFamily In theFont.Families
|
|||
|
|
systemfont.Items.Add(family.Name)
|
|||
|
|
Next
|
|||
|
|
systemfont.SelectedIndex = 9
|
|||
|
|
'Font.Name = DropDownList1.SelectedItem.Text
|
|||
|
|
'初始化字号
|
|||
|
|
|
|||
|
|
Dim sizeArray() As Integer = [Enum].GetValues(GetType(TableColName))
|
|||
|
|
Dim strbuff() As String
|
|||
|
|
strbuff = Array.ConvertAll(sizeArray, New Converter(Of Integer, String)(AddressOf inttostring))
|
|||
|
|
Textsize.Items.AddRange(strbuff)
|
|||
|
|
Textsize.SelectedIndex = 8
|
|||
|
|
|
|||
|
|
|
|||
|
|
Dim str As String = systemfont.SelectedItem.ToString
|
|||
|
|
Dim gtheFont As New System.Drawing.Font(str, 9.ToString)
|
|||
|
|
Grid_tab.Font = gtheFont
|
|||
|
|
|
|||
|
|
g_OldRowColor = New Dictionary(Of Integer, Color())
|
|||
|
|
InitRowConfig()
|
|||
|
|
|
|||
|
|
'//获取系统所有颜色(利用枚举获取系统的颜色并且将Dropdownlist的字体颜色改成当前的颜色)
|
|||
|
|
' String[] colorArray = Enum.GetNames(TypeOf(System.Drawing.KnownColor));
|
|||
|
|
' foreach(String color In colorArray)
|
|||
|
|
' {
|
|||
|
|
' ListItem item = New ListItem(Color);
|
|||
|
|
' item.Attributes.Add("style", "color:" + Color);
|
|||
|
|
' DropDownList2.Style.Add("BackColor", Color);
|
|||
|
|
' DropDownList2.Items.Add(item);
|
|||
|
|
|
|||
|
|
' }
|
|||
|
|
' //系统字体大小
|
|||
|
|
' String[] sizeArray = Enum.GetNames(TypeOf(System.Web.UI.WebControls.FontSize));
|
|||
|
|
' RadioButtonList1.DataSource = sizeArray;
|
|||
|
|
' RadioButtonList1.SelectedIndex = -1;
|
|||
|
|
' RadioButtonList1.DataBind();
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Sub InitRowConfig()
|
|||
|
|
Grid_RowConfig.Cols = 3
|
|||
|
|
Grid_RowConfig.Cell(0, 1).Text = "列名"
|
|||
|
|
Grid_RowConfig.Cell(0, 2).Text = "列值"
|
|||
|
|
Grid_RowConfig.Rows = TableColName.remark + 1
|
|||
|
|
Grid_RowConfig.Column(0).Visible = False
|
|||
|
|
Grid_RowConfig.Range(1, 1, Grid_RowConfig.Rows - 1, Grid_RowConfig.Cols - 1).Alignment = AlignmentEnum.CenterCenter
|
|||
|
|
For i As Integer = 1 To TableColName.remark
|
|||
|
|
Grid_RowConfig.Cell(i, 1).Text = [Enum].GetName(GetType(TableColName), i)
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Function inttostring(val As Integer) As String
|
|||
|
|
Return val.ToString
|
|||
|
|
End Function
|
|||
|
|
Private Sub RCU_Logviewer_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
|
|||
|
|
m_FolderIcon.Dispose()
|
|||
|
|
m_FileIcon.Dispose()
|
|||
|
|
Timer1.Stop()
|
|||
|
|
My.Settings.Save()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
#Region "时间显示"
|
|||
|
|
Private AutoCount As Integer
|
|||
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|||
|
|
Label3.Text = Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|||
|
|
If AutoCount > 5 Then
|
|||
|
|
AotuDirToMySQL()
|
|||
|
|
AutoCount = 0
|
|||
|
|
Judgmentpoint()
|
|||
|
|
Else
|
|||
|
|
AutoCount = AutoCount + 1
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
Public DbConnString As String = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Port=3307;Database=rculog;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;"
|
|||
|
|
Public Sub CellMysqlFunction()
|
|||
|
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, DbConnString)
|
|||
|
|
Try
|
|||
|
|
db.Open()
|
|||
|
|
Dim CreateTableStr As String = "CALL `rculog`.`DeleteOldRecords`()"
|
|||
|
|
db.ExecuteNonQuery(CreateTableStr)
|
|||
|
|
db.Close()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
AdminLog.ApplicationLog.WriteErrorLog($"CALL `rculog`.`DeleteOldRecords` Error, {ex.Message}")
|
|||
|
|
db.Close()
|
|||
|
|
End Try
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
Public Sub Judgmentpoint()
|
|||
|
|
Dim currentTime As DateTime = DateTime.Now
|
|||
|
|
|
|||
|
|
' 判断当前时间是否为凌晨3点
|
|||
|
|
If currentTime.Hour = 3 AndAlso currentTime.Minute = 0 AndAlso currentTime.Second = 0 Then
|
|||
|
|
Console.WriteLine("现在是凌晨3点。")
|
|||
|
|
AdminLog.ApplicationLog.WriteErrorLog($"现在是凌晨3点,开始清理过期文件与数据 (10天)")
|
|||
|
|
Dim directoryPath As String = TextBox1.Text ' 替换为你的目录路径
|
|||
|
|
Dim cutOffDate As TimeSpan = DateTime.Now - DateTime.Now.AddDays(-15)
|
|||
|
|
DeleteFilesOlderThan(directoryPath, cutOffDate)
|
|||
|
|
CellMysqlFunction()
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Sub DeleteFilesOlderThan(path As String, timeSpan As TimeSpan)
|
|||
|
|
Dim directoryInfo As New DirectoryInfo(path)
|
|||
|
|
Dim cutOffDate As DateTime = DateTime.Now.Subtract(timeSpan)
|
|||
|
|
|
|||
|
|
' 遍历目录中的文件
|
|||
|
|
For Each file As FileInfo In directoryInfo.GetFiles()
|
|||
|
|
If file.CreationTime < cutOffDate Then
|
|||
|
|
file.Delete()
|
|||
|
|
Console.WriteLine("Deleted file: " & file.FullName)
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
' 递归遍历子目录
|
|||
|
|
For Each subDir As DirectoryInfo In directoryInfo.GetDirectories()
|
|||
|
|
DeleteFilesOlderThan(subDir.FullName, timeSpan)
|
|||
|
|
Next
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
#Region "文件夹加载"
|
|||
|
|
#Region "选择文件夹"
|
|||
|
|
Private Sub Btn_refresh_Click(sender As Object, e As EventArgs) Handles Btn_refresh.Click
|
|||
|
|
If String.IsNullOrEmpty(DirPath_txt.Text) OrElse Not Directory.Exists(DirPath_txt.Text) Then Return
|
|||
|
|
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
m_Tree.Nodes.Clear()
|
|||
|
|
If Grid_File.Rows >= 2 Then
|
|||
|
|
Grid_File.Range(1, 1, Grid_File.Rows - 1, 1).DeleteByRow()
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim tempNode = m_Tree.Nodes.Add()
|
|||
|
|
tempNode.IsDirectory = True
|
|||
|
|
Grid_File.AddItem(GetFileConfig(DirPath_txt.Text))
|
|||
|
|
LoadingFileTree(DirPath_txt.Text, tempNode, 1)
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
End Sub
|
|||
|
|
Private Sub Btn_refresh_Click1()
|
|||
|
|
If String.IsNullOrEmpty(DirPath_txt.Text) OrElse Not Directory.Exists(DirPath_txt.Text) Then Return
|
|||
|
|
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
m_Tree.Nodes.Clear()
|
|||
|
|
If Grid_File.Rows >= 2 Then
|
|||
|
|
Grid_File.Range(1, 1, Grid_File.Rows - 1, 1).DeleteByRow()
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim tempNode = m_Tree.Nodes.Add()
|
|||
|
|
tempNode.IsDirectory = True
|
|||
|
|
Grid_File.AddItem(GetFileConfig(DirPath_txt.Text))
|
|||
|
|
LoadingFileTree(DirPath_txt.Text, tempNode, 1)
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
End Sub
|
|||
|
|
Private Sub SelectFile_btn_Click(sender As Object, e As EventArgs) Handles SelectFile_btn.Click
|
|||
|
|
Using dlg As New FolderBrowserDialog
|
|||
|
|
dlg.Description = "请选择入库文件夹!"
|
|||
|
|
If String.IsNullOrEmpty(DirPath_txt.Text) Or IO.Directory.Exists(DirPath_txt.Text) Then
|
|||
|
|
dlg.SelectedPath = My.Settings.FileDir
|
|||
|
|
Else
|
|||
|
|
dlg.SelectedPath = DirPath_txt.Text
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
If dlg.ShowDialog <> DialogResult.OK Then Return
|
|||
|
|
|
|||
|
|
DirPath_txt.Text = dlg.SelectedPath
|
|||
|
|
|
|||
|
|
End Using
|
|||
|
|
My.Settings.FileDir = DirPath_txt.Text
|
|||
|
|
My.Settings.Save()
|
|||
|
|
'第一个节点
|
|||
|
|
Btn_refresh.PerformClick()
|
|||
|
|
'Dim tempNode = m_Tree.Nodes.Add()
|
|||
|
|
'Grid_File.AddItem(GetFileConfig(DirPath_txt.Text))
|
|||
|
|
'LoadingFileTree(DirPath_txt.Text, tempNode, 1)
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
#Region "树状目录加载"
|
|||
|
|
Private m_FolderIcon As System.Drawing.Icon
|
|||
|
|
Private m_FileIcon As System.Drawing.Icon
|
|||
|
|
|
|||
|
|
Public Sub LoadingFileTreeInit()
|
|||
|
|
Dim resourceStream As System.IO.Stream
|
|||
|
|
|
|||
|
|
resourceStream = MyBase.GetType().Assembly.GetManifestResourceStream("RCU_LogAgent_sqllite.Folder.ico")
|
|||
|
|
m_FolderIcon = New Drawing.Icon(resourceStream)
|
|||
|
|
resourceStream = MyBase.GetType().Assembly.GetManifestResourceStream("RCU_LogAgent_sqllite.File.ico")
|
|||
|
|
m_FileIcon = New Drawing.Icon(resourceStream)
|
|||
|
|
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
Grid_File.ExtendLastCol = True
|
|||
|
|
Grid_File.DrawMode = FlexCell.DrawModeEnum.OwnerDraw
|
|||
|
|
Grid_File.AllowUserPaste = FlexCell.ClipboardDataEnum.Text
|
|||
|
|
Grid_File.Cols = 7
|
|||
|
|
Grid_File.Rows = 1
|
|||
|
|
Grid_File.DisplayRowNumber = True
|
|||
|
|
Grid_File.Cell(0, 0).Text = "ID"
|
|||
|
|
Grid_File.Cell(0, 1).Text = "A"
|
|||
|
|
Grid_File.Cell(0, 2).Text = "名称"
|
|||
|
|
Grid_File.Cell(0, 3).Text = "修改日期"
|
|||
|
|
Grid_File.Cell(0, 4).Text = "类型"
|
|||
|
|
Grid_File.Cell(0, 5).Text = "大小"
|
|||
|
|
Grid_File.Cell(0, 6).Text = "备注"
|
|||
|
|
Grid_File.Range(0, 1, 0, 6).Alignment = FlexCell.AlignmentEnum.CenterCenter
|
|||
|
|
Grid_File.Column(0).Width = 20
|
|||
|
|
Grid_File.Column(1).Width = 20
|
|||
|
|
Grid_File.Column(2).Width = 350
|
|||
|
|
Grid_File.Column(3).Width = 120
|
|||
|
|
Grid_File.Column(4).Width = 50
|
|||
|
|
Grid_File.Column(5).Width = 50
|
|||
|
|
|
|||
|
|
Grid_File.Column(1).Locked = False
|
|||
|
|
Grid_File.Column(2).Locked = True
|
|||
|
|
Grid_File.Column(3).Locked = True
|
|||
|
|
Grid_File.Column(4).Locked = True
|
|||
|
|
Grid_File.Column(5).Locked = True
|
|||
|
|
Grid_File.Column(1).CellType = FlexCell.CellTypeEnum.CheckBox
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
End Sub
|
|||
|
|
Private m_Tree As New Node
|
|||
|
|
|
|||
|
|
Public Sub LoadingFileTree(filedirPath As String, tempNode As Node, Level As Integer)
|
|||
|
|
If Directory.Exists(filedirPath) = False Then Return '指定目录不存在
|
|||
|
|
Dim datas As IReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(filedirPath) '获取文件夹内的文件路径集合
|
|||
|
|
|
|||
|
|
For Each strFileName As String In datas
|
|||
|
|
tempNode.Nodes.Add()
|
|||
|
|
Grid_File.AddItem(GetFileConfig(strFileName))
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
Public Function IsNewAnalyzeFile(filedirPath As String, btime As Date) As Boolean
|
|||
|
|
If Directory.Exists(filedirPath) = False Then Return False '指定目录不存在
|
|||
|
|
Dim datas As IReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(filedirPath) '获取文件夹内的文件路径集合
|
|||
|
|
|
|||
|
|
For Each strFileName As String In datas
|
|||
|
|
Dim fa As FileAttributes = File.GetAttributes(strFileName)
|
|||
|
|
If fa = FileAttributes.Directory Then
|
|||
|
|
Continue For
|
|||
|
|
Else
|
|||
|
|
Dim tmpFileInfo As New FileInfo(strFileName)
|
|||
|
|
Dim sp = btime - tmpFileInfo.LastWriteTime
|
|||
|
|
If sp.TotalSeconds > 600 Then
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
Return True
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Public Function GetFileConfig(path As String) As String
|
|||
|
|
Dim result As String = "0" & vbTab
|
|||
|
|
Dim filesize As Double = 0
|
|||
|
|
Dim fa As FileAttributes = File.GetAttributes(path)
|
|||
|
|
If fa = FileAttributes.Directory Then
|
|||
|
|
Dim tmpDirInfo As New DirectoryInfo(path)
|
|||
|
|
result = result & tmpDirInfo.Name & vbTab & Format(tmpDirInfo.LastWriteTime, "yyyy-MM-dd HH:mm:ss") & vbTab & "Directory"
|
|||
|
|
|
|||
|
|
Else
|
|||
|
|
Dim tmpFileInfo As New FileInfo(path)
|
|||
|
|
result = result & tmpFileInfo.Name & vbTab & Format(tmpFileInfo.LastWriteTime, "yyyy-MM-dd HH:mm:ss") & vbTab & "File" & vbTab
|
|||
|
|
result = result & GetfileSize(tmpFileInfo.Length)
|
|||
|
|
End If
|
|||
|
|
Return result
|
|||
|
|
End Function
|
|||
|
|
Public Function GetfileSize(fileSize As Long) As String
|
|||
|
|
Dim num As Double = 1024
|
|||
|
|
If fileSize < num Then
|
|||
|
|
Return fileSize.ToString & "B"
|
|||
|
|
ElseIf fileSize < Math.Pow(num, 2) Then
|
|||
|
|
Return (fileSize / num).ToString("f2") & "K"
|
|||
|
|
ElseIf fileSize < Math.Pow(num, 3) Then
|
|||
|
|
Return (fileSize / Math.Pow(num, 2)).ToString("f2") & "M"
|
|||
|
|
ElseIf fileSize < Math.Pow(num, 4) Then
|
|||
|
|
Return (fileSize / Math.Pow(num, 3)).ToString("f2") & "G"
|
|||
|
|
ElseIf fileSize < Math.Pow(num, 5) Then
|
|||
|
|
Return (fileSize / Math.Pow(num, 4)).ToString("f2") & "T"
|
|||
|
|
Else
|
|||
|
|
Return "文件大小获取异常"
|
|||
|
|
End If
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Declare Function DrawIconEx Lib "user32" (ByVal hDC As IntPtr, ByVal xLeft As Integer, ByVal yTop As Integer, ByVal hIcon As IntPtr, ByVal cxWidth As Integer, ByVal cyWidth As Integer, ByVal istepIfAniCur As Integer, ByVal hbrFlickerFreeDraw As Integer, ByVal diFlags As Integer) As Integer
|
|||
|
|
Private Const DI_NORMAL = &H3
|
|||
|
|
|
|||
|
|
Private Sub Grid_File_OwnerDrawCell(ByVal Sender As Object, ByVal e As FlexCell.Grid.OwnerDrawCellEventArgs) Handles Grid_File.OwnerDrawCell
|
|||
|
|
If e.Row < 1 OrElse e.Col <> 2 Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim i, j As Integer
|
|||
|
|
Dim blnDrawLine As Boolean
|
|||
|
|
Dim node, tmpNode As Node
|
|||
|
|
Dim intLevel As Integer
|
|||
|
|
Dim intWidth As Integer
|
|||
|
|
Dim intAdd As Integer
|
|||
|
|
|
|||
|
|
If True Then
|
|||
|
|
intWidth = 20
|
|||
|
|
intAdd = 26
|
|||
|
|
Else
|
|||
|
|
intWidth = 10
|
|||
|
|
intAdd = 6
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
node = m_Tree.FindNode(e.Row - 1 + 2)
|
|||
|
|
If node IsNot Nothing Then
|
|||
|
|
intLevel = node.Level - 1
|
|||
|
|
|
|||
|
|
'画树线
|
|||
|
|
Dim pen As New System.Drawing.Pen(Color.Gray, 1)
|
|||
|
|
pen.DashStyle = Drawing2D.DashStyle.Solid
|
|||
|
|
For i = 0 To intLevel
|
|||
|
|
If i < intLevel - 1 Then
|
|||
|
|
blnDrawLine = True
|
|||
|
|
tmpNode = node
|
|||
|
|
For j = i To intLevel - 2
|
|||
|
|
tmpNode = tmpNode.Parent
|
|||
|
|
Next
|
|||
|
|
If tmpNode.NextNode Is Nothing Then
|
|||
|
|
blnDrawLine = False
|
|||
|
|
End If
|
|||
|
|
If blnDrawLine Then
|
|||
|
|
'全部
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top - 1), CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Bottom + 1))
|
|||
|
|
End If
|
|||
|
|
ElseIf i = intLevel - 1 Then
|
|||
|
|
'上半部分
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top - 1), CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top + e.Bounds.Height / 2))
|
|||
|
|
If node.NextNode IsNot Nothing Then
|
|||
|
|
'下半部分
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top + e.Bounds.Height / 2), CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Bottom + 1))
|
|||
|
|
End If
|
|||
|
|
ElseIf i = intLevel Then
|
|||
|
|
'下半部分
|
|||
|
|
If node.VisibleNodesCount > 1 Then
|
|||
|
|
If True Then
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top + e.Bounds.Height / 2) + 7, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Bottom + 1))
|
|||
|
|
Else
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Top + e.Bounds.Height / 2), CInt(e.Bounds.Left + intWidth * i + intAdd), CInt(e.Bounds.Bottom + 1))
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
'水平的
|
|||
|
|
If intLevel > 0 Then
|
|||
|
|
e.Graphics.DrawLine(pen, CInt(e.Bounds.Left + intWidth * (intLevel - 1) + intAdd), CInt(e.Bounds.Top + e.Bounds.Height / 2), CInt(e.Bounds.Left + intWidth * (intLevel - 1) + intAdd + 10), CInt(e.Bounds.Top + e.Bounds.Height / 2))
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
pen.Dispose()
|
|||
|
|
|
|||
|
|
'+/-
|
|||
|
|
If node.ChildrenCount > 0 Then
|
|||
|
|
Dim rect As New Rectangle(e.Bounds.Left + 2 + intLevel * intWidth, CInt(e.Bounds.Top + (e.Bounds.Height - 9) / 2), 8, 8)
|
|||
|
|
e.Graphics.FillRectangle(Brushes.White, rect)
|
|||
|
|
e.Graphics.DrawRectangle(Pens.Black, rect)
|
|||
|
|
If node.Expanded Then
|
|||
|
|
e.Graphics.DrawLine(Pens.Black, rect.Left + 2, rect.Top + 4, rect.Right - 2, rect.Top + 4)
|
|||
|
|
Else
|
|||
|
|
e.Graphics.DrawLine(Pens.Black, rect.Left + 2, rect.Top + 4, rect.Right - 2, rect.Top + 4)
|
|||
|
|
e.Graphics.DrawLine(Pens.Black, rect.Left + 4, rect.Top + 2, rect.Left + 4, rect.Bottom - 2)
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
'图标
|
|||
|
|
' If CheckBox1.Checked Then
|
|||
|
|
If node.IsDirectory Then
|
|||
|
|
DrawIconEx(e.hDC, e.Bounds.Left + intWidth * intLevel + 18, e.Bounds.Top + (e.Bounds.Height - 16) / 2, m_FolderIcon.Handle, 16, 16, 0, 0, DI_NORMAL)
|
|||
|
|
Else
|
|||
|
|
DrawIconEx(e.hDC, e.Bounds.Left + intWidth * intLevel + 18, e.Bounds.Top + (e.Bounds.Height - 16) / 2, m_FileIcon.Handle, 16, 16, 0, 0, DI_NORMAL)
|
|||
|
|
End If
|
|||
|
|
' End If
|
|||
|
|
|
|||
|
|
'文字
|
|||
|
|
With Grid_File.Cell(e.Row, e.Col)
|
|||
|
|
If True Then
|
|||
|
|
e.Graphics.DrawString(.Text, .Font, Brushes.Black, e.Bounds.Left + intWidth * intLevel + 35, e.Bounds.Top + (e.Bounds.Height - e.Graphics.MeasureString(.Text, .Font).Height) / 2 + 1)
|
|||
|
|
Else
|
|||
|
|
e.Graphics.DrawString(.Text, .Font, Brushes.Black, e.Bounds.Left + intWidth * intLevel + 12, e.Bounds.Top + (e.Bounds.Height - e.Graphics.MeasureString(.Text, .Font).Height) / 2 + 1)
|
|||
|
|
End If
|
|||
|
|
End With
|
|||
|
|
|
|||
|
|
e.Handled = True
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
Private Sub Grid_File_MouseDown(ByVal Sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Grid_File.MouseDown
|
|||
|
|
If Grid_File.EditorVisible Then '处于编辑状态
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If e.Button <> Windows.Forms.MouseButtons.Right Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim cell As FlexCell.Cell = Grid_File.HitTest(e.X, e.Y)
|
|||
|
|
If cell Is Nothing Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
If cell.Row < 1 OrElse cell.Col <> 2 Then
|
|||
|
|
' If cell.Row < m_Row OrElse cell.Col <> m_Col Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Grid_File.Range(cell.Row, cell.Col, cell.Row, cell.Col).SelectCells()
|
|||
|
|
|
|||
|
|
Dim node As Node = m_Tree.FindNode(cell.Row - 1 + 2)
|
|||
|
|
If node Is Nothing Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If node.ChildrenCount > 0 Then
|
|||
|
|
If node.Expanded Then
|
|||
|
|
mnuExpand.Enabled = False
|
|||
|
|
mnuCollapse.Enabled = True
|
|||
|
|
Else
|
|||
|
|
mnuExpand.Enabled = True
|
|||
|
|
mnuCollapse.Enabled = False
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
mnuExpand.Enabled = False
|
|||
|
|
mnuCollapse.Enabled = False
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If node.Level = 1 Then
|
|||
|
|
mnuRemove.Enabled = False '第一个节点不允许删除
|
|||
|
|
mnuLevelDown.Enabled = False
|
|||
|
|
Else
|
|||
|
|
mnuRemove.Enabled = True
|
|||
|
|
If node.PrevNode Is Nothing Then
|
|||
|
|
mnuLevelDown.Enabled = False
|
|||
|
|
Else
|
|||
|
|
mnuLevelDown.Enabled = True
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If node.Level <= 2 Then
|
|||
|
|
mnuLevelUp.Enabled = False
|
|||
|
|
Else
|
|||
|
|
mnuLevelUp.Enabled = True
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If node.PrevNode Is Nothing Then
|
|||
|
|
mnuMoveUp.Enabled = False
|
|||
|
|
Else
|
|||
|
|
If node.Level > 1 Then
|
|||
|
|
mnuMoveUp.Enabled = True
|
|||
|
|
Else
|
|||
|
|
mnuMoveUp.Enabled = False
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If node.NextNode Is Nothing Then
|
|||
|
|
mnuMoveDown.Enabled = False
|
|||
|
|
Else
|
|||
|
|
If node.Level > 1 Then
|
|||
|
|
mnuMoveDown.Enabled = True
|
|||
|
|
Else
|
|||
|
|
mnuMoveDown.Enabled = False
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
ContextMenuStrip1.Show(MousePosition.X, MousePosition.Y)
|
|||
|
|
End Sub
|
|||
|
|
Private Sub Grid_File_Click(ByVal Sender As Object, ByVal e As System.EventArgs) Handles Grid_File.Click
|
|||
|
|
If Grid_File.EditorVisible Then '处于编辑状态
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim point As Point = Grid_File.PointToClient(Windows.Forms.Cursor.Position)
|
|||
|
|
Dim cell As FlexCell.Cell = Grid_File.HitTest(point.X, point.Y)
|
|||
|
|
Dim intWidth As Integer
|
|||
|
|
|
|||
|
|
If True Then
|
|||
|
|
intWidth = 20
|
|||
|
|
Else
|
|||
|
|
intWidth = 10
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If cell IsNot Nothing Then
|
|||
|
|
|
|||
|
|
If cell.Row >= 1 AndAlso cell.Col = 2 Then
|
|||
|
|
Dim node As Node
|
|||
|
|
node = m_Tree.FindNode(cell.Row - 1 + 2)
|
|||
|
|
If node IsNot Nothing Then
|
|||
|
|
Dim rect As New Rectangle(cell.Bounds.Left + 2 + (node.Level - 1) * intWidth, cell.Bounds.Top + (cell.Bounds.Height - 9) / 2, 8, 8)
|
|||
|
|
Dim i As Integer
|
|||
|
|
If rect.Contains(point) Then
|
|||
|
|
If node.Expanded Then
|
|||
|
|
node.Collapse()
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
For i = 1 To node.ChildrenCount
|
|||
|
|
Grid_File.Row(cell.Row + i).Visible = False
|
|||
|
|
Next
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
Else
|
|||
|
|
node.Expand()
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
For i = 1 To node.ChildrenCount
|
|||
|
|
If node.FindNode(i + 1).Visible Then
|
|||
|
|
Grid_File.Row(cell.Row + i).Visible = True
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
Private g_isCheckBox1CheckedChanged As Boolean = False
|
|||
|
|
'Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
|
|||
|
|
'
|
|||
|
|
'End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Sub ALLDirectory(IsAll As Boolean)
|
|||
|
|
|
|||
|
|
If g_isCheckBox1CheckedChanged Then
|
|||
|
|
g_isCheckBox1CheckedChanged = False
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
Grid_File.AutoRedraw = False
|
|||
|
|
For i As Integer = 1 To Grid_File.Rows - 1
|
|||
|
|
Grid_File.Cell(i, 1).Text = IIf(IsAll, "1", "0")
|
|||
|
|
Next
|
|||
|
|
Grid_File.AutoRedraw = True
|
|||
|
|
Grid_File.Refresh()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
#Region "文件解析"
|
|||
|
|
|
|||
|
|
Private g_RowFileDic As Dictionary(Of Integer, String)
|
|||
|
|
Private Sub Grid_File_CellChange(Sender As Object, e As FlexCell.Grid.CellChangeEventArgs) Handles Grid_File.CellChange
|
|||
|
|
|
|||
|
|
If e.Row > 0 AndAlso e.Col = 1 Then
|
|||
|
|
If Grid_File.Cell(e.Row, 4).Text.Equals("Directory") Then
|
|||
|
|
If Grid_File.Cell(e.Row, 1).Text.Equals("1") Then
|
|||
|
|
g_isCheckBox1CheckedChanged = False
|
|||
|
|
ALLDirectory(True)
|
|||
|
|
Else
|
|||
|
|
ALLDirectory(False)
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
If Grid_File.Cell(e.Row, 1).Text.Equals("1") Then
|
|||
|
|
If g_RowFileDic.ContainsKey(e.Row) Then
|
|||
|
|
g_RowFileDic.Item(e.Row) = Grid_File.Cell(e.Row, 2).Text
|
|||
|
|
Else
|
|||
|
|
If IsAuto Then
|
|||
|
|
If TimeDriverJudgement(e.Row) Then
|
|||
|
|
g_RowFileDic.Add(e.Row, Grid_File.Cell(e.Row, 2).Text)
|
|||
|
|
Else
|
|||
|
|
Grid_File.Cell(e.Row, 1).Text = "0"
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
g_RowFileDic.Add(e.Row, Grid_File.Cell(e.Row, 2).Text)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
If g_RowFileDic.ContainsKey(e.Row) Then
|
|||
|
|
g_RowFileDic.Remove(e.Row)
|
|||
|
|
End If
|
|||
|
|
g_isCheckBox1CheckedChanged = True
|
|||
|
|
Grid_File.Cell(1, 1).Text = "0"
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Function TimeDriverJudgement(Trow As Integer) As Boolean
|
|||
|
|
Dim filetime As Date = Date.Parse(Grid_File.Cell(Trow, 3).Text)
|
|||
|
|
Dim sp = AutoTime - filetime
|
|||
|
|
If sp.TotalSeconds > 600 Then
|
|||
|
|
Return True
|
|||
|
|
End If
|
|||
|
|
Return False
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub btn_analysis_Click(sender As Object, e As EventArgs) Handles btn_analysis.Click
|
|||
|
|
'Dim logpar As New LogParsing
|
|||
|
|
|
|||
|
|
If IsNothing(g_fileAnalysisThread) OrElse Not g_fileAnalysisThread.IsAlive Then
|
|||
|
|
Console.WriteLine(g_RowFileDic.Count)
|
|||
|
|
If g_RowFileDic.Count > 0 Then
|
|||
|
|
StartfileAnalysisThread()
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
Debug.WriteLine("正在同步")
|
|||
|
|
Trace.WriteLine("正在同步")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private g_fileAnalysisThread As Thread
|
|||
|
|
Public Sub StartfileAnalysisThread()
|
|||
|
|
If IsNothing(g_fileAnalysisThread) Then
|
|||
|
|
g_fileAnalysisThread = New Thread(AddressOf FileDataToSqlRuning)
|
|||
|
|
End If
|
|||
|
|
If g_fileAnalysisThread.IsAlive Then Return
|
|||
|
|
Try
|
|||
|
|
g_fileAnalysisThread = New Thread(AddressOf FileDataToSqlRuning)
|
|||
|
|
g_fileAnalysisThread.Start()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
|
|||
|
|
End Try
|
|||
|
|
End Sub
|
|||
|
|
Public Sub FileDataToSqlRuning()
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
|
|||
|
|
AddHandler logpar.Fileschedule, AddressOf SetUIProgressBar2
|
|||
|
|
SetUIProgressBar1("", 0, g_RowFileDic.Count)
|
|||
|
|
For Index As Integer = 0 To g_RowFileDic.Count - 1
|
|||
|
|
SetUIProgressBar1(g_RowFileDic.Values(Index), Index)
|
|||
|
|
Dim filepath As String = DirPath_txt.Text & "\" & g_RowFileDic.Values(Index)
|
|||
|
|
Dim starttime As Date = Date.Now
|
|||
|
|
Dim tsp As TimeSpan
|
|||
|
|
logpar.Parsefile(TextBox1.Text, filepath)
|
|||
|
|
tsp = Now - starttime
|
|||
|
|
Console.WriteLine($"文件{g_RowFileDic.Values(Index)}解析时间:" & tsp.TotalMilliseconds)
|
|||
|
|
Next
|
|||
|
|
SetUIProgressBar1("", g_RowFileDic.Count)
|
|||
|
|
'If IsAuto Then
|
|||
|
|
' Btn_refresh_Click(Nothing, Nothing)
|
|||
|
|
'End If
|
|||
|
|
End Sub
|
|||
|
|
Delegate Sub delegate_MatchingInfo_Change(filename As String, berval As Integer, bervalmax As Integer)
|
|||
|
|
|
|||
|
|
Public Sub SetUIProgressBar1(filename As String, berval As Integer, Optional bervalmax As Integer = Nothing)
|
|||
|
|
If InvokeRequired = True Then
|
|||
|
|
Dim dev As New delegate_MatchingInfo_Change(AddressOf SetUIProgressBar1)
|
|||
|
|
Me.Invoke(dev, New Object() {filename, berval, bervalmax})
|
|||
|
|
Else
|
|||
|
|
|
|||
|
|
If bervalmax > 0 Then
|
|||
|
|
PBar_1.Maximum = bervalmax
|
|||
|
|
End If
|
|||
|
|
PBar_1.Value = berval
|
|||
|
|
If Not String.IsNullOrEmpty(filename) Then
|
|||
|
|
Lab_4.Text = filename
|
|||
|
|
End If
|
|||
|
|
If PBar_1.Maximum = berval Then
|
|||
|
|
g_RowFileDic.Clear()
|
|||
|
|
Btn_refresh_Click(Nothing, Nothing)
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
Delegate Sub delegate_MatchingInfo(berval As Integer, ismax As Boolean)
|
|||
|
|
Public Sub SetUIProgressBar2(berval As Integer, ismax As Boolean)
|
|||
|
|
If InvokeRequired = True Then
|
|||
|
|
Dim dev As New delegate_MatchingInfo(AddressOf SetUIProgressBar2)
|
|||
|
|
Me.Invoke(dev, New Object() {berval, ismax})
|
|||
|
|
Else
|
|||
|
|
If ismax Then
|
|||
|
|
PBar_2.Value = berval
|
|||
|
|
Else
|
|||
|
|
PBar_2.Maximum = berval
|
|||
|
|
PBar_2.Value = 0
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
#Region "页面切换"
|
|||
|
|
Private Sub toopBtn_Fileloading_Selected(sender As Object, e As TabControlEventArgs) Handles toopBtn_Fileloading.Selected
|
|||
|
|
If toopBtn_Fileloading.SelectedIndex = 0 Then
|
|||
|
|
If g_RowFileDic.Count > 0 Then
|
|||
|
|
Btn_refresh.PerformClick()
|
|||
|
|
End If
|
|||
|
|
ElseIf toopBtn_Fileloading.SelectedIndex = 1 Then
|
|||
|
|
GetTablename()
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
#Region "查询页面"
|
|||
|
|
Public Sub GetTablename()
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
Dim li As List(Of String)
|
|||
|
|
Dim headnode As New TreeNode("LogService.db")
|
|||
|
|
li = logpar.Gettablename()
|
|||
|
|
Tree_View2.Nodes.Clear()
|
|||
|
|
Tree_View2.Nodes.Add(headnode)
|
|||
|
|
Tree_View2.Tag = headnode
|
|||
|
|
headnode.Expand()
|
|||
|
|
|
|||
|
|
If IsNothing(li) Or li.Count = 0 Then
|
|||
|
|
Return
|
|||
|
|
Else
|
|||
|
|
For Each index As String In li
|
|||
|
|
Dim Cnode As New TreeNode(index)
|
|||
|
|
headnode.Nodes.Add(Cnode)
|
|||
|
|
|
|||
|
|
Next
|
|||
|
|
End If
|
|||
|
|
If headnode.Nodes.Count > 0 Then
|
|||
|
|
Tree_View2.SelectedNode = headnode.Nodes(0)
|
|||
|
|
Tree_View2_NodeMouseClick(Nothing, Nothing)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Tree_View2_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles Tree_View2.NodeMouseClick
|
|||
|
|
|
|||
|
|
Dim node As TreeNode = Tree_View2.SelectedNode
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
If node Is Nothing Then Return
|
|||
|
|
If node.Level <> 1 Then Return
|
|||
|
|
Label6.Text = node.Text
|
|||
|
|
If Not IsNothing(g_TableLookup) AndAlso g_TableLookup.IsAlive Then
|
|||
|
|
g_TableLookup.Abort()
|
|||
|
|
txt_find.ReadOnly = False
|
|||
|
|
Button1.Enabled = True
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
End If
|
|||
|
|
Dim udt As DataTable = logpar.QueryDatabase(node.Text)
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
Grid_tab.SetDataBinding(udt)
|
|||
|
|
SetGridStyle()
|
|||
|
|
Grid_tab.AutoRedraw = True
|
|||
|
|
Grid_tab.Refresh()
|
|||
|
|
End Sub
|
|||
|
|
Public Sub SetGridStyle()
|
|||
|
|
'设置隐藏列
|
|||
|
|
Grid_tab.Column(0).Visible = False
|
|||
|
|
Grid_tab.Column(TableColName.TimeSpan).Visible = False
|
|||
|
|
Grid_tab.Column(TableColName.mac).Visible = False
|
|||
|
|
Grid_tab.Column(TableColName.logprojectid).Visible = False
|
|||
|
|
Grid_tab.Column(TableColName.logroomid).Visible = False
|
|||
|
|
Grid_tab.Column(TableColName.log_valid).Visible = False
|
|||
|
|
'全表 字体居中
|
|||
|
|
Grid_tab.Range(1, 1, Grid_tab.Rows - 1, Grid_tab.Cols - 1).Alignment = AlignmentEnum.CenterCenter
|
|||
|
|
'设置排序
|
|||
|
|
Grid_tab.AllowUserSort = True
|
|||
|
|
'设置列宽
|
|||
|
|
|
|||
|
|
|
|||
|
|
Grid_tab.Column(TableColName.ID).Width = 20
|
|||
|
|
Grid_tab.Column(TableColName.createdatetime).Width = 130
|
|||
|
|
Grid_tab.Column(TableColName.logfilename).Width = 220
|
|||
|
|
Grid_tab.Column(TableColName.log_sn).Width = 25
|
|||
|
|
Grid_tab.Column(TableColName.log_len).Width = 20
|
|||
|
|
Grid_tab.Column(TableColName.log_datetime).Width = 130
|
|||
|
|
Grid_tab.Column(TableColName.log_timespan).Width = 40
|
|||
|
|
Grid_tab.Column(TableColName.log_type).Width = 20
|
|||
|
|
Grid_tab.Column(TableColName.log_content).Width = 200
|
|||
|
|
Grid_tab.Column(TableColName.type_param_1).Width = 80
|
|||
|
|
Grid_tab.Column(TableColName.type_param_2).Width = 100
|
|||
|
|
Grid_tab.Column(TableColName.type_param_3).Width = 80
|
|||
|
|
Grid_tab.Column(TableColName.type_param_4).Width = 80
|
|||
|
|
|
|||
|
|
Grid_tab.Column(TableColName.type_param_5).Width = 80
|
|||
|
|
Grid_tab.Column(TableColName.type_param_6).Width = 180
|
|||
|
|
Grid_tab.Column(TableColName.type_param_7).Width = 180
|
|||
|
|
Grid_tab.Column(TableColName.type_param_8).Width = 180
|
|||
|
|
Grid_tab.Column(TableColName.type_param_9).Width = 180
|
|||
|
|
Grid_tab.Column(TableColName.type_param_10).Width = 180
|
|||
|
|
Grid_tab.Column(TableColName.remark).Width = 180
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_delete_Click(sender As Object, e As EventArgs) Handles btn_delete.Click
|
|||
|
|
Dim strInputMsg As String = InputBox("请输入密码", "密码确认")
|
|||
|
|
|
|||
|
|
If strInputMsg <> "Cc2022OK" Then Return
|
|||
|
|
Dim node As TreeNode = Tree_View2.SelectedNode
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
If node Is Nothing Then Return
|
|||
|
|
If node.Level <> 1 Then Return
|
|||
|
|
logpar.DeleteTable(node.Text)
|
|||
|
|
Dim headnode As TreeNode = Tree_View2.Tag
|
|||
|
|
headnode.Nodes.Remove(node)
|
|||
|
|
If Label6.Text.Equals(node.Text) Then
|
|||
|
|
Label6.Text = "----------"
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
If Not IsNothing(g_TableLookup) AndAlso g_TableLookup.IsAlive Then
|
|||
|
|
g_TableLookup.Abort()
|
|||
|
|
txt_find.ReadOnly = False
|
|||
|
|
Button1.Enabled = True
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
End If
|
|||
|
|
Dim udt As DataTable = logpar.QueryDatabase("Insqlite_UserTest")
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
Grid_tab.SetDataBinding(udt)
|
|||
|
|
SetGridStyle()
|
|||
|
|
Grid_tab.AutoRedraw = True
|
|||
|
|
Grid_tab.Refresh()
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub delete_all_Click(sender As Object, e As EventArgs) Handles delete_all.Click
|
|||
|
|
Dim strInputMsg As String = InputBox("请输入密码", "密码确认")
|
|||
|
|
If strInputMsg <> "Cc2022OK" Then Return
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
Dim headnode As TreeNode = Tree_View2.Tag
|
|||
|
|
For Each index As TreeNode In headnode.Nodes
|
|||
|
|
logpar.DeleteTable(index.Text)
|
|||
|
|
If Label6.Text.Equals(index.Text) Then
|
|||
|
|
Label6.Text = "----------"
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
If Not IsNothing(g_TableLookup) AndAlso g_TableLookup.IsAlive Then
|
|||
|
|
g_TableLookup.Abort()
|
|||
|
|
txt_find.ReadOnly = False
|
|||
|
|
Button1.Enabled = True
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
End If
|
|||
|
|
Dim udt As DataTable = logpar.QueryDatabase("Insqlite_UserTest")
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
If udt.Rows.Count > 0 Then
|
|||
|
|
Grid_tab.SetDataBinding(udt)
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
SetGridStyle()
|
|||
|
|
Grid_tab.AutoRedraw = True
|
|||
|
|
Grid_tab.Refresh()
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
headnode.Nodes.Clear()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Table_save_Click(sender As Object, e As EventArgs) Handles Table_save.Click
|
|||
|
|
Dim savePath As String
|
|||
|
|
Using dlg As New FolderBrowserDialog
|
|||
|
|
dlg.Description = "保存到"
|
|||
|
|
|
|||
|
|
dlg.SelectedPath = My.Settings.FileDir
|
|||
|
|
|
|||
|
|
If dlg.ShowDialog <> DialogResult.OK Then Return
|
|||
|
|
|
|||
|
|
savePath = dlg.SelectedPath
|
|||
|
|
Grid_tab.ExportToExcel(dlg.SelectedPath & $"\{Label6.Text }.xls", "数据表", True, False)
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Using
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub systemfont_TextChanged(sender As Object, e As EventArgs) Handles systemfont.TextChanged
|
|||
|
|
Dim str As String = systemfont.SelectedItem.ToString
|
|||
|
|
Dim theFont As New System.Drawing.Font(str, 9.ToString)
|
|||
|
|
Grid_tab.Selection.Font = theFont
|
|||
|
|
End Sub
|
|||
|
|
Private Sub Handles_TextChanged(sender As Object, e As EventArgs) Handles Textsize.TextChanged
|
|||
|
|
Grid_tab.Selection.FontSize = CType(Textsize.Text, Integer)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_bold_Click(sender As Object, e As EventArgs) Handles btn_bold.Click
|
|||
|
|
Grid_tab.Selection.FontBold = Not Grid_tab.ActiveCell.FontBold
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_lean_Click(sender As Object, e As EventArgs) Handles btn_lean.Click
|
|||
|
|
Grid_tab.Selection.FontItalic = Not Grid_tab.ActiveCell.FontItalic
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) Handles ToolStripButton5.Click
|
|||
|
|
Grid_tab.Selection.FontUnderline = Not Grid_tab.ActiveCell.FontUnderline
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub btn_txtcolor_ButtonClick(sender As Object, e As EventArgs) Handles btn_txtcolor.ButtonClick
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) AndAlso Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.ForeColor = btn_txtcolor.ForeColor
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_txtcolor_DropDownOpening(sender As Object, e As EventArgs) Handles btn_txtcolor.DropDownOpening
|
|||
|
|
If ColorDialog1.ShowDialog() = DialogResult.OK Then
|
|||
|
|
btn_txtcolor.ForeColor = ColorDialog1.Color
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) OrElse Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.ForeColor = btn_txtcolor.ForeColor
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_bcolor_DropDownOpening(sender As Object, e As EventArgs) Handles btn_bcolor.DropDownOpening
|
|||
|
|
If ColorDialog1.ShowDialog() = DialogResult.OK Then
|
|||
|
|
btn_bcolor.ForeColor = ColorDialog1.Color
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) OrElse Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.BackColor = btn_bcolor.ForeColor
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_bcolor_ButtonClick(sender As Object, e As EventArgs) Handles btn_bcolor.ButtonClick
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) AndAlso Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.BackColor = btn_bcolor.ForeColor
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub ToolStripMenuItem6_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem6.Click, ToolStripMenuItem5.Click, ToolStripMenuItem4.Click
|
|||
|
|
Dim MenuItem As ToolStripMenuItem = sender
|
|||
|
|
btn_center.Image = MenuItem.Image
|
|||
|
|
btn_center.Tag = MenuItem.Tag
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) AndAlso Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.Alignment = btn_center.Tag
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub btn_center_ButtonClick(sender As Object, e As EventArgs) Handles btn_center.ButtonClick
|
|||
|
|
If Not IsNothing(Grid_tab.Selection) AndAlso Grid_tab.Selection.FirstRow <> 0 Then
|
|||
|
|
Grid_tab.Selection.Alignment = btn_center.Tag
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private g_OldRowColor As Dictionary(Of Integer, Color())
|
|||
|
|
'Private Sub Grid_tab_MouseHover(Sender As Object, e As EventArgs) Handles Grid_tab.MouseHover
|
|||
|
|
' ' Grid_tab.MouseCol
|
|||
|
|
' Dim mosrow As Integer = Grid_tab.MouseRow
|
|||
|
|
' If mosrow < 1 Then Return
|
|||
|
|
' Dim rowcolor As New List(Of Color)
|
|||
|
|
' Console.WriteLine($"mosrow:{mosrow}")
|
|||
|
|
' For index As Integer = 0 To Grid_tab.Cols - 1
|
|||
|
|
' If g_OldRowColor.Count > 0 Then
|
|||
|
|
' Grid_tab.Cell(g_OldRowColor.Keys(0), index).BackColor = g_OldRowColor.Values(0)(index)
|
|||
|
|
' End If
|
|||
|
|
' rowcolor.Add(Grid_tab.Cell(mosrow, index).BackColor)
|
|||
|
|
' Next
|
|||
|
|
' g_OldRowColor.Clear()
|
|||
|
|
' g_OldRowColor.Add(mosrow, rowcolor.ToArray)
|
|||
|
|
|
|||
|
|
' Grid_tab.Range(mosrow, 1, mosrow, Grid_tab.Cols - 1).BackColor = Color.LightYellow
|
|||
|
|
'End Sub
|
|||
|
|
|
|||
|
|
Private Sub Grid_tab_MouseLeave(sender As Object, e As EventArgs) Handles Grid_tab.MouseLeave
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
For index As Integer = 0 To Grid_tab.Cols - 1
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
Grid_tab.Cell(g_OldRowColor.Keys(0), index).BackColor = g_OldRowColor.Values(0)(index)
|
|||
|
|
End If
|
|||
|
|
' rowcolor.Add(Grid_tab.Cell(Grid_tab.MouseRow, index).BackColor)
|
|||
|
|
Next
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Grid_tab_MouseMove(Sender As Object, e As MouseEventArgs) Handles Grid_tab.MouseMove
|
|||
|
|
Dim mosrow As Integer = Grid_tab.MouseRow
|
|||
|
|
If mosrow < 1 Then Return
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
If mosrow = g_OldRowColor.Keys(0) Then Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Dim rowcolor As New List(Of Color)
|
|||
|
|
' Console.WriteLine($"mosrow:{mosrow}")
|
|||
|
|
For index As Integer = 0 To Grid_tab.Cols - 1
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
Grid_tab.Cell(g_OldRowColor.Keys(0), index).BackColor = g_OldRowColor.Values(0)(index)
|
|||
|
|
End If
|
|||
|
|
rowcolor.Add(Grid_tab.Cell(mosrow, index).BackColor)
|
|||
|
|
If index = 0 Then Continue For
|
|||
|
|
Grid_RowConfig.Cell(index, 2).Text = Grid_tab.Cell(mosrow, index).Text
|
|||
|
|
Next
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
g_OldRowColor.Add(mosrow, rowcolor.ToArray)
|
|||
|
|
|
|||
|
|
Grid_tab.Range(mosrow, 1, mosrow, Grid_tab.Cols - 1).BackColor = Color.Yellow
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Grid_tab_KeyDown(Sender As Object, e As KeyEventArgs) Handles Grid_tab.KeyDown
|
|||
|
|
If e.KeyData = Keys.Up Then
|
|||
|
|
|
|||
|
|
Dim mosrow As Integer = Grid_tab.ActiveCell.Row - 1
|
|||
|
|
If mosrow < 1 Then Return
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
If mosrow = g_OldRowColor.Keys(0) Then Return
|
|||
|
|
End If
|
|||
|
|
Dim rowcolor As New List(Of Color)
|
|||
|
|
' Console.WriteLine($"mosrow:{mosrow}")
|
|||
|
|
For index As Integer = 0 To Grid_tab.Cols - 1
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
Grid_tab.Cell(g_OldRowColor.Keys(0), index).BackColor = g_OldRowColor.Values(0)(index)
|
|||
|
|
End If
|
|||
|
|
rowcolor.Add(Grid_tab.Cell(mosrow, index).BackColor)
|
|||
|
|
If index = 0 Then Continue For
|
|||
|
|
Grid_RowConfig.Cell(index, 2).Text = Grid_tab.Cell(mosrow, index).Text
|
|||
|
|
Next
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
g_OldRowColor.Add(mosrow, rowcolor.ToArray)
|
|||
|
|
|
|||
|
|
Grid_tab.Range(mosrow, 1, mosrow, Grid_tab.Cols - 1).BackColor = Color.Yellow
|
|||
|
|
ElseIf e.KeyData = Keys.Down Then
|
|||
|
|
|
|||
|
|
Dim mosrow As Integer = Grid_tab.ActiveCell.Row + 1
|
|||
|
|
If mosrow < 1 Then Return
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
If mosrow = g_OldRowColor.Keys(0) Then Return
|
|||
|
|
End If
|
|||
|
|
Dim rowcolor As New List(Of Color)
|
|||
|
|
' Console.WriteLine($"mosrow:{mosrow}")
|
|||
|
|
For index As Integer = 0 To Grid_tab.Cols - 1
|
|||
|
|
If g_OldRowColor.Count > 0 Then
|
|||
|
|
Grid_tab.Cell(g_OldRowColor.Keys(0), index).BackColor = g_OldRowColor.Values(0)(index)
|
|||
|
|
End If
|
|||
|
|
rowcolor.Add(Grid_tab.Cell(mosrow, index).BackColor)
|
|||
|
|
If index = 0 Then Continue For
|
|||
|
|
Grid_RowConfig.Cell(index, 2).Text = Grid_tab.Cell(mosrow, index).Text
|
|||
|
|
Next
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
g_OldRowColor.Add(mosrow, rowcolor.ToArray)
|
|||
|
|
|
|||
|
|
Grid_tab.Range(mosrow, 1, mosrow, Grid_tab.Cols - 1).BackColor = Color.Yellow
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub delete_flag_Click(sender As Object, e As EventArgs) Handles delete_flag.Click
|
|||
|
|
Dim headnode As TreeNode = Tree_View2.Nodes(0)
|
|||
|
|
If headnode.Nodes.Count > 0 Then
|
|||
|
|
'Tree_View2.SelectedNode = headnode.Nodes(0)
|
|||
|
|
'Tree_View2_NodeMouseClick(Nothing, Nothing)
|
|||
|
|
Dim logpar As New LogParsing
|
|||
|
|
If Not IsNothing(g_TableLookup) AndAlso g_TableLookup.IsAlive Then
|
|||
|
|
g_TableLookup.Abort()
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
txt_find.ReadOnly = False
|
|||
|
|
Button1.Enabled = True
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
Dim udt As DataTable = logpar.QueryDatabase(Label6.Text)
|
|||
|
|
Grid_tab.AutoRedraw = False
|
|||
|
|
Grid_tab.SetDataBinding(udt)
|
|||
|
|
SetGridStyle()
|
|||
|
|
Grid_tab.AutoRedraw = True
|
|||
|
|
Grid_tab.Refresh()
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
#Region "全表查找"
|
|||
|
|
Public g_TableLookup As Thread
|
|||
|
|
Private IsLookupflag As Boolean = False '默认模糊查找
|
|||
|
|
Public Sub FuzzyLookup()
|
|||
|
|
|
|||
|
|
txt_find.ReadOnly = True
|
|||
|
|
Button1.Enabled = False
|
|||
|
|
If IsNothing(g_TableLookup) Then
|
|||
|
|
g_TableLookup = New Thread(AddressOf StartTableLookup)
|
|||
|
|
g_TableLookup.Start()
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
If g_TableLookup.IsAlive Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
g_TableLookup = New Thread(AddressOf StartTableLookup)
|
|||
|
|
g_TableLookup.Start()
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Sub StartTableLookup()
|
|||
|
|
Dim ti As Date = Now
|
|||
|
|
Dim sp As TimeSpan
|
|||
|
|
If String.IsNullOrEmpty(txt_find.Text) Then
|
|||
|
|
ThreadSetTableCell(Grid_tab, 1, 1, Color.Red)
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
For i As Integer = 1 To Grid_tab.Rows - 1
|
|||
|
|
For j As Integer = 1 To Grid_tab.Cols - 1
|
|||
|
|
If j = TableColName.TimeSpan OrElse j = TableColName.mac AndAlso
|
|||
|
|
j = TableColName.logprojectid AndAlso j = TableColName.log_valid OrElse
|
|||
|
|
j = TableColName.logroomid Then Continue For
|
|||
|
|
If IsLookupflag Then
|
|||
|
|
If Grid_tab.Cell(i, j).Text.Equals(txt_find.Text) Then
|
|||
|
|
' Grid_tab.Cell(i, j).BackColor = Color.LightSalmon
|
|||
|
|
ThreadSetTableCell(Grid_tab, i, j, Color.LightSalmon)
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
If Grid_tab.Cell(i, j).Text.Contains(txt_find.Text) Then
|
|||
|
|
' Grid_tab.Cell(i, j).BackColor = Color.LightPink
|
|||
|
|
ThreadSetTableCell(Grid_tab, i, j, Color.LightPink)
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
Next
|
|||
|
|
Next
|
|||
|
|
ThreadSetTableCell(Grid_tab, 1, 1, Color.Red)
|
|||
|
|
sp = Now - ti
|
|||
|
|
Console.WriteLine($"查找耗时:{sp.TotalMilliseconds }")
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
Delegate Sub IsThreadSetTableCell(Gridtab As FlexCell.Grid, Inrow As Integer, Incol As Integer, thecolor As Color)
|
|||
|
|
Public Sub ThreadSetTableCell(Gridtab As FlexCell.Grid, Inrow As Integer, Incol As Integer, thecolor As Color)
|
|||
|
|
|
|||
|
|
If InvokeRequired = True Then
|
|||
|
|
Dim dev As New IsThreadSetTableCell(AddressOf ThreadSetTableCell)
|
|||
|
|
Me.Invoke(dev, New Object() {Gridtab, Inrow, Incol, thecolor})
|
|||
|
|
Else
|
|||
|
|
If thecolor = Color.Red Then
|
|||
|
|
txt_find.ReadOnly = False
|
|||
|
|
Button1.Enabled = True
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
Gridtab.Cell(Inrow, Incol).BackColor = thecolor
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|||
|
|
g_OldRowColor.Clear()
|
|||
|
|
FuzzyLookup()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
|
|||
|
|
IsLookupflag = CheckBox1.Checked
|
|||
|
|
End Sub
|
|||
|
|
Private IsAuto As Boolean
|
|||
|
|
Private Sub ONOFF_btn_Click(sender As Object, e As EventArgs) Handles ONOFF_btn.Click
|
|||
|
|
'ONOFF_btn.Enabled = Not ONOFF_btn.Enabled
|
|||
|
|
|
|||
|
|
|
|||
|
|
IsAuto = Not IsAuto
|
|||
|
|
If IsAuto Then
|
|||
|
|
ONOFF_btn.Text = "停止循环扫描"
|
|||
|
|
ONOFF_btn.ForeColor = Color.Red
|
|||
|
|
|
|||
|
|
Else
|
|||
|
|
ONOFF_btn.Text = "开始循环扫描"
|
|||
|
|
ONOFF_btn.ForeColor = Color.Black
|
|||
|
|
If Not IsNothing(g_fileAnalysisThread) Then
|
|||
|
|
g_fileAnalysisThread.Abort()
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
DirPath_txt.Enabled = Not IsAuto
|
|||
|
|
SelectFile_btn.Enabled = Not IsAuto
|
|||
|
|
Btn_refresh.Enabled = Not IsAuto
|
|||
|
|
Count_txt.Enabled = Not IsAuto
|
|||
|
|
btn_analysis.Enabled = Not IsAuto
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
Public AutoTime As Date
|
|||
|
|
Public Sub AotuDirToMySQL()
|
|||
|
|
|
|||
|
|
While (IsAuto And Not g_fileAnalysisThread.IsAlive)
|
|||
|
|
|
|||
|
|
AutoTime = Now
|
|||
|
|
If IsNewAnalyzeFile(DirPath_txt.Text, AutoTime) Then
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
Dim sp = Now - AutoTime
|
|||
|
|
Console.WriteLine(sp.TotalSeconds)
|
|||
|
|
Btn_refresh_Click(Nothing, Nothing)
|
|||
|
|
g_RowFileDic.Clear()
|
|||
|
|
Grid_File.Cell(1, 1).Text = 1
|
|||
|
|
btn_analysis_Click(Nothing, Nothing)
|
|||
|
|
sp = Now - AutoTime
|
|||
|
|
Console.WriteLine(sp.TotalSeconds)
|
|||
|
|
|
|||
|
|
Exit While
|
|||
|
|
End While
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|||
|
|
Using dlg As New FolderBrowserDialog
|
|||
|
|
dlg.Description = "请选择文件解析后存放文件夹路径!"
|
|||
|
|
If String.IsNullOrEmpty(DirPath_txt.Text) Or IO.Directory.Exists(DirPath_txt.Text) Then
|
|||
|
|
dlg.SelectedPath = My.Settings.FileDir
|
|||
|
|
Else
|
|||
|
|
dlg.SelectedPath = DirPath_txt.Text
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If dlg.ShowDialog <> DialogResult.OK Then Return
|
|||
|
|
|
|||
|
|
TextBox1.Text = dlg.SelectedPath
|
|||
|
|
|
|||
|
|
End Using
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
|
|||
|
|
If Label3.BackColor = SystemColors.ActiveCaption Then
|
|||
|
|
Label3.BackColor = SystemColors.GradientActiveCaption
|
|||
|
|
|
|||
|
|
Else
|
|||
|
|
|
|||
|
|
Label3.BackColor = SystemColors.ActiveCaption
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
End Class
|