'------自动备份,存在D驱,则存在D盘,否则存在我的文档下.
Dim zip As New zipFile
Dim idx As Integer = ProjectFile.LastIndexOf(".")
Dim idx1 As Integer = ProjectFile.LastIndexOf("\")
Dim proname As String = ProjectFile.SubString(idx1+1,idx-idx1-1) & "bak"
Dim bakfolder As String
If FileSys.DirectoryExists("D:\") Then '如果目录C:\MyFolder存在
bakfolder="d:\ftaxbak\" & proname & "\"
Else
bakfolder=SpecialFolder.MyDocuments & "\ftaxbak\" & proname & "\"
End If
If FileSys.DirectoryExists(bakfolder)=False Then '如果备份目录存在
FileSys.CreateDirectory(bakfolder) '创建备份目录
End If
zip.Create( bakfolder & proname & Format(now(),"yyyyMMddHHmm") & ".zip")
zip.AddFile(ProjectFile)
'--添加压缩项目路径下文件
For Each File As String In FileSys.GetFiles(ProjectPath )
zip.AddFile(File,FileSys.GetName(File))
Next
'--添加压缩子文件夹下文件
For Each wjj As String In FileSys.GetDirectories(ProjectPath)
Functions.Execute("zipinputfile",zip,wjj)
'递归函数的代码
'Dim zip As zipFile = args(0)
'Dim wjj As String =args(1)
'For Each wjpath As String In FileSys.GetFiles(wjj)
''Output.Show( wjj.Replace(ProjectPath,"") & "\" & FileSys.GetName(wjpath))
'zip.AddFile(wjpath, wjj.Replace(ProjectPath,"") & "\" & FileSys.GetName(wjpath))
'Next
'For Each zwjj As String In FileSys.GetDirectories(wjj)
'Functions.Execute("zipinputfile",zip,zwjj)
'Next
Next
zip.Close()
'在程序项目退出事件中
For Each dt As DataTable In DataTables
If dt.HasChanges Then
dt.Save()
End If
Next