diff --git a/source/dbs-properties.json b/source/dbs-properties.json index b70bfe3..57da749 100644 --- a/source/dbs-properties.json +++ b/source/dbs-properties.json @@ -101,7 +101,7 @@ "Type": 4 }, "NavPane Width": { - "Value": 215, + "Value": 494, "Type": 4 }, "Never Cache": { diff --git a/source/forms/ACLibImportWizardForm.bas b/source/forms/ACLibImportWizardForm.bas index 5baa5fa..2116f91 100644 --- a/source/forms/ACLibImportWizardForm.bas +++ b/source/forms/ACLibImportWizardForm.bas @@ -16,11 +16,11 @@ Begin Form GridY =10 Width =10214 DatasheetFontHeight =11 - ItemSuffix =91 - Left =3255 - Top =2940 - Right =15975 - Bottom =12750 + ItemSuffix =93 + Left =5355 + Top =3278 + Right =17190 + Bottom =10020 OnUnload ="[Event Procedure]" RecSrcDt = Begin 0x212b6fd80e9ce340 @@ -733,7 +733,7 @@ Begin Form Width =561 Height =228 FontSize =8 - TabIndex =2 + TabIndex =3 BackColor =14151142 BorderColor =0 ForeColor =0 @@ -764,71 +764,100 @@ Begin Form SpecialEffect =0 OldBorderStyle =0 OverlapFlags =93 - Left =113 - Top =105 - Width =8330 - Height =397 - TabIndex =3 + Left =53 + Top =53 + Width =9414 + Height =454 + TabIndex =2 Name ="ogRepositorySource" AfterUpdate ="[Event Procedure]" - LayoutCachedLeft =113 - LayoutCachedTop =105 - LayoutCachedWidth =8443 - LayoutCachedHeight =502 + LayoutCachedLeft =53 + LayoutCachedTop =53 + LayoutCachedWidth =9467 + LayoutCachedHeight =507 Begin Begin OptionButton OverlapFlags =87 - Left =3855 - Top =203 - OptionValue =1 + Left =3878 + Top =195 + OptionValue =2 Name ="Option56" - LayoutCachedLeft =3855 - LayoutCachedTop =203 - LayoutCachedWidth =4115 - LayoutCachedHeight =443 + LayoutCachedLeft =3878 + LayoutCachedTop =195 + LayoutCachedWidth =4138 + LayoutCachedHeight =435 Begin Begin Label OverlapFlags =247 - Left =4085 - Top =173 + Left =4108 + Top =165 Width =1921 Height =293 Name ="Label57" Caption ="GitHub (web access)" - LayoutCachedLeft =4085 - LayoutCachedTop =173 - LayoutCachedWidth =6006 - LayoutCachedHeight =466 + LayoutCachedLeft =4108 + LayoutCachedTop =165 + LayoutCachedWidth =6029 + LayoutCachedHeight =458 End End End Begin OptionButton OverlapFlags =87 - Left =6292 - Top =203 + Left =6180 + Top =195 + Width =365 TabIndex =1 - OptionValue =2 + OptionValue =6 + Name ="Option91" + + LayoutCachedLeft =6180 + LayoutCachedTop =195 + LayoutCachedWidth =6545 + LayoutCachedHeight =435 + Begin + Begin Label + OverlapFlags =247 + Left =6410 + Top =165 + Width =1013 + Height =293 + Name ="Label92" + Caption ="Packages" + LayoutCachedLeft =6410 + LayoutCachedTop =165 + LayoutCachedWidth =7423 + LayoutCachedHeight =458 + End + End + End + Begin OptionButton + OverlapFlags =87 + Left =7507 + Top =195 + TabIndex =2 + OptionValue =1 Name ="Option58" - LayoutCachedLeft =6292 - LayoutCachedTop =203 - LayoutCachedWidth =6552 - LayoutCachedHeight =443 + LayoutCachedLeft =7507 + LayoutCachedTop =195 + LayoutCachedWidth =7767 + LayoutCachedHeight =435 Begin Begin Label OverlapFlags =247 - Left =6522 - Top =173 + Left =7737 + Top =165 Width =1643 Height =293 Name ="Label59" Caption ="Local repository" - LayoutCachedLeft =6522 - LayoutCachedTop =173 - LayoutCachedWidth =8165 - LayoutCachedHeight =466 + LayoutCachedLeft =7737 + LayoutCachedTop =165 + LayoutCachedWidth =9380 + LayoutCachedHeight =458 End End End @@ -900,9 +929,9 @@ Begin Form OverlapFlags =85 TextAlign =1 IMESentenceMode =3 - Left =6135 + Left =6143 Top =960 - Width =1703 + Width =1786 Height =293 TabIndex =8 Name ="txtRepoName" @@ -912,9 +941,9 @@ Begin Form BottomPadding =150 HorizontalAnchor =2 - LayoutCachedLeft =6135 + LayoutCachedLeft =6143 LayoutCachedTop =960 - LayoutCachedWidth =7838 + LayoutCachedWidth =7929 LayoutCachedHeight =1253 ColumnStart =4 ColumnEnd =4 @@ -952,7 +981,7 @@ Begin Form OverlapFlags =85 TextAlign =1 IMESentenceMode =3 - Left =3600 + Left =3608 Top =960 Width =1703 Height =293 @@ -963,9 +992,9 @@ Begin Form GroupTable =1 BottomPadding =150 - LayoutCachedLeft =3600 + LayoutCachedLeft =3608 LayoutCachedTop =960 - LayoutCachedWidth =5303 + LayoutCachedWidth =5311 LayoutCachedHeight =1253 ColumnStart =2 ColumnEnd =2 @@ -1023,7 +1052,7 @@ Begin Form OverlapFlags =85 TextAlign =1 IMESentenceMode =3 - Left =8805 + Left =8813 Top =960 Width =1290 Height =293 @@ -1035,9 +1064,9 @@ Begin Form BottomPadding =150 HorizontalAnchor =2 - LayoutCachedLeft =8805 + LayoutCachedLeft =8813 LayoutCachedTop =960 - LayoutCachedWidth =10095 + LayoutCachedWidth =10103 LayoutCachedHeight =1253 ColumnStart =6 ColumnEnd =6 @@ -1050,15 +1079,15 @@ Begin Form Begin Label OverlapFlags =85 TextAlign =3 - Left =7905 + Left =7988 Top =960 - Width =840 + Width =757 Height =293 Name ="Label78" Caption ="Branch:" GroupTable =1 BottomPadding =150 - LayoutCachedLeft =7905 + LayoutCachedLeft =7988 LayoutCachedTop =960 LayoutCachedWidth =8745 LayoutCachedHeight =1253 diff --git a/source/forms/ACLibImportWizardForm.cls b/source/forms/ACLibImportWizardForm.cls index 1217013..9abdf77 100644 --- a/source/forms/ACLibImportWizardForm.cls +++ b/source/forms/ACLibImportWizardForm.cls @@ -19,8 +19,9 @@ Option Explicit ' verwendete Erweiterungen Private Const EXTENSION_KEY_APPFILE As String = "AppFile" Private Const APPFILE_PROPNAME_APPICON As String = "AppIcon" -Private Const RepositorySource_GitHub As Long = 1 -Private Const RepositorySource_LocalRepository As Long = 2 +Private Const RepositorySource_LocalRepository As Long = 1 +Private Const RepositorySource_GitHub As Long = 2 +Private Const RepositorySource_Package As Long = 4 Private Const TEMPDB_TABNAME As String = "tRepositoryFiles" Private Const TEMPDB_TABDDL As String = "create table " & TEMPDB_TABNAME & " (LocalRepositoryPath varchar(255) primary key, ObjectName varchar(255), Description memo)" @@ -171,7 +172,7 @@ On Error GoTo HandleErr Me.Repaint Set ACLibFileMngr = CurrentACLibFileManager - If Me.ogRepositorySource = RepositorySource_GitHub Then + If (Me.ogRepositorySource And RepositorySource_GitHub) = RepositorySource_GitHub Then Set m_ACLibFileManager = ACLibFileMngr Else ' Set m_ACLibFileManager = Nothing @@ -409,7 +410,9 @@ On Error GoTo HandleErr Loop End If - StartFolder = CurrentLocalRepositoryPath & StartFolder + If Mid(StartFolder, 2, 1) <> ":" Then + StartFolder = CurrentLocalRepositoryPath & StartFolder + End If Do While Not DirExists(StartFolder) Pos = InStrRev(StartFolder, "\") If Pos = 0 Then Exit Do @@ -670,13 +673,30 @@ Private Sub ConfigReproSourceMode(Optional NewMode As Long = 0) End Sub Private Sub SetACLibGitHubImporterConfig() - If Me.ogRepositorySource = RepositorySource_GitHub Then - If Len(Me.txtGitHubAuthPersonalAccessToken.Value) > 0 Then - ACLibGitHubImporter.GitHubApiAuthorizationToken = Me.txtGitHubAuthPersonalAccessToken.Value - End If + If (Me.ogRepositorySource.Value And RepositorySource_GitHub) = RepositorySource_GitHub Then + If Len(Me.txtGitHubAuthPersonalAccessToken.Value) > 0 Then + ACLibGitHubImporter.GitHubApiAuthorizationToken = Me.txtGitHubAuthPersonalAccessToken.Value + End If + If (Me.ogRepositorySource.Value And RepositorySource_Package) = RepositorySource_Package Then + SetRepositoryData "AccessCodeLib", "ACLibImportWizard-Package", "main" + ElseIf Me.txtRepoName.Value = "ACLibImportWizard-Package" Then + SetRepositoryData "AccessCodeLib", "AccessCodeLib", "master" + End If End If End Sub +Private Sub SetRepositoryData(ByVal RepositoryOwner As String, ByVal RepositoryName As String, ByVal BranchName As String) + + Me.txtRepoOwner.Value = RepositoryOwner + Me.txtRepoName.Value = RepositoryName + Me.txtRepoBranch.Value = BranchName + + ACLibGitHubImporter.RepositoryOwner = RepositoryOwner + ACLibGitHubImporter.RepositoryName = RepositoryName + ACLibGitHubImporter.BranchName = BranchName + +End Sub + Private Sub Form_Unload(ByRef Cancel As Integer) On Error Resume Next If Not (m_TempDb Is Nothing) Then @@ -846,7 +866,7 @@ Private Sub AddFileFromFileName(ByVal ACLibFileString As String) On Error GoTo HandleErr - If Me.ogRepositorySource = RepositorySource_GitHub Then + If (Me.ogRepositorySource.Value And RepositorySource_GitHub) = RepositorySource_GitHub Then FileArray(0) = ACLibFileString DownLoadFiles FileArray @@ -1139,7 +1159,7 @@ Private Sub OpenRepositoryFileInTextViewer(ByVal ACLibPath As String) Dim FullPath As String - If Me.ogRepositorySource = RepositorySource_GitHub Then + If (Me.ogRepositorySource.Value And RepositorySource_GitHub) = RepositorySource_GitHub Then FullPath = DownLoadFile(ACLibPath) Else FullPath = CurrentACLibFileManager.GetRepositoryFullPath(ACLibPath) diff --git a/source/modules/ACLibFileManager.cls b/source/modules/ACLibFileManager.cls index afba0b0..e9e750a 100644 --- a/source/modules/ACLibFileManager.cls +++ b/source/modules/ACLibFileManager.cls @@ -338,12 +338,14 @@ Public Sub ImportRepositoryFiles(ByRef RepositoryPathArray() As String, _ Dim i As Long Dim PathString As String Dim TempFile As Object + Dim DownloadBase As String ArraySize = UBound(RepositoryPathArray) For i = LBound(RepositoryPathArray) To ArraySize - 1 - PathString = GetRepositoryFullPath(RepositoryPathArray(i)) + DownloadBase = vbNullString + PathString = GetRepositoryFullPath(RepositoryPathArray(i), DownloadBase) Set TempFile = fso.GetFile(PathString) - AddMissingFile TempFile, ImportMode + AddMissingFile TempFile, ImportMode, DownloadBase Next Set TempFile = Nothing @@ -357,6 +359,7 @@ Private Sub ImportFilesFromImportCollection( _ Dim TempFile As Object Dim FileImportMode As CodeLibImportMode + Dim DownloadBase As String Dim i As Long Dim MaxCnt As Long @@ -373,28 +376,29 @@ Private Sub ImportFilesFromImportCollection( _ DoCmd.RunCommand acCmdCompileAndSaveAllModules End If - MaxCnt = m_ImportFileCollection.Count + MaxCnt = m_ImportFileCollection.Count - '/* - ' * TODO: Determination of the number of all files (incl. dependencies) before the import - ' * TODO: Conversion AccessProgressBar to single pass (Init only once) - ' */ + '/* + ' * TODO: Determination of the number of all files (incl. dependencies) before the import + ' * TODO: Conversion AccessProgressBar to single pass (Init only once) + ' */ - i = 1 - Do While i <= MaxCnt - ColItem = m_ImportFileCollection(i) - Set TempFile = ColItem(0) - FileImportMode = ColItem(1) + i = 1 + Do While i <= MaxCnt + ColItem = m_ImportFileCollection(i) + Set TempFile = ColItem(0) + FileImportMode = ColItem(1) + DownloadBase = ColItem(2) - AccessProgressBar.Init "Importiere " & TempFile & "...", 2, 1 - AccessProgressBar.PerformStep + AccessProgressBar.Init "Importiere " & TempFile & "...", 2, 1 + AccessProgressBar.PerformStep - ImportFile TempFile, FileImportMode, ImportTestFiles + ImportFile TempFile, FileImportMode, ImportTestFiles, DownloadBase - AccessProgressBar.PerformStep - MaxCnt = m_ImportFileCollection.Count - i = i + 1 - Loop + AccessProgressBar.PerformStep + MaxCnt = m_ImportFileCollection.Count + i = i + 1 + Loop @@ -633,7 +637,7 @@ Private Property Let PrivateRepositoryRootDirectory(ByVal PrivatePath As String) End Property -Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String +Public Function GetRepositoryFullPath(ByVal ReleativPath As String, Optional ByRef DownloadBase As String) As String Dim RepPath As String Dim FullPath As String @@ -655,7 +659,20 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String ElseIf Left(ReleativPath, Len(REPOSTITORY_ROOT_CODE_GITHUBROOT)) = REPOSTITORY_ROOT_CODE_GITHUBROOT Then ' %GITHUB%\owner\repo@branch\Path ReleativPath = Replace(ReleativPath, "\", "/") - If Not DownLoadFromGitHub(ReleativPath, RepPath) Then + If Not DownLoadFromGitHub(ReleativPath, RepPath, DownloadBase) Then + Err.Raise vbObjectError, "getRepositoryFullPath", "Download aus GitHub ist fehlgeschlagen" + Exit Function + End If + + If Len(RepPath) = 0 Then + Err.Raise vbObjectError, "getRepositoryFullPath", "Wert für lokales GitHub-Temp-Verzeichnis fehlt." + Exit Function + End If + + ElseIf Len(DownloadBase) > 0 Then + ' %GITHUB%\owner\repo@branch\Path + ReleativPath = Replace(ReleativPath, "/", "\") + If Not DownLoadFromGitHub(ReleativPath, RepPath, DownloadBase) Then Err.Raise vbObjectError, "getRepositoryFullPath", "Download aus GitHub ist fehlgeschlagen" Exit Function End If @@ -694,7 +711,7 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String End Function -Private Function DownLoadFromGitHub(ByRef ReleativPath As String, ByRef RepPath As String) As Boolean +Private Function DownLoadFromGitHub(ByRef ReleativPath As String, ByRef RepPath As String, ByRef DownloadBase As String) As Boolean ' %GITHUB%/owner/repo@branch/Path Dim FullFilePath As String @@ -704,16 +721,26 @@ Private Function DownLoadFromGitHub(ByRef ReleativPath As String, ByRef RepPath Dim GitHubUrlData() As String Dim RelativeFileUrl As String - '%GITHUB%/owner/repo@branch/Path - GitHubPath = Mid(Replace(ReleativPath, "\", "/"), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2) - GitHubDataCutPos = InStr(InStr(1, GitHubPath, "@") + 1, GitHubPath, "/") - GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1) - RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1) - GitHubUrlDataString = Replace(GitHubUrlDataString, "@", "/") + If Len(DownloadBase) > 0 And InStr(1, ReleativPath, REPOSTITORY_ROOT_CODE_GITHUBROOT) = 0 Then + GitHubUrlDataString = DownloadBase + ReleativPath = Replace(ReleativPath, "/", "\") + If Left(ReleativPath, 1) = "\" Then + ReleativPath = Mid(ReleativPath, 2) + End If + RelativeFileUrl = Replace(ReleativPath, "\", "/") + Else + '%GITHUB%/owner/repo@branch/Path + GitHubPath = Mid(Replace(ReleativPath, "\", "/"), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2) + GitHubDataCutPos = InStr(InStr(1, GitHubPath, "@") + 1, GitHubPath, "/") + GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1) + RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1) + ReleativPath = Replace(RelativeFileUrl, "/", "\") + GitHubUrlDataString = Replace(GitHubUrlDataString, "@", "/") + DownloadBase = GitHubUrlDataString + End If GitHubUrlData = Split(GitHubUrlDataString, "/") - RepPath = GitHubTempRepositoryPath & "\" - ReleativPath = Replace(RelativeFileUrl, "/", "\") + RepPath = GitHubTempRepositoryPath & "\" & Replace(GitHubUrlDataString, "/", "\") & "\" FullFilePath = RepPath & ReleativPath If Not FileTools.FileExists(FullFilePath) Then @@ -737,7 +764,7 @@ Private Property Get GitHubTempRepositoryPath() As String End Property Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibImportMode, _ - Optional ByVal ImportTestFiles As Boolean = False) + Optional ByVal ImportTestFiles As Boolean = False, Optional ByVal DownloadBase As String) Dim i As Long Dim TempFile As Object @@ -750,6 +777,12 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm AddReplacedFilePath GetRepositoryFullPath(m_CLI.RepositoryFileReplacement) End If + If Len(DownloadBase) > 0 Then + m_CLI.ForceRemoveIfExists = True + Else + Stop + End If + 'Enable abort RaiseEvent ImportRepositoryFile(m_CLI.Name, m_CLI.RepositoryFile, m_CLI.Type, m_CLI.Dependency, ImportFile, CancelImport) If CancelImport Then @@ -758,19 +791,19 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm 'License (LICENSE block) If Len(m_CLI.LicenseFile) > 0 Then - FilePath = GetRepositoryFullPath(m_CLI.LicenseFile) + FilePath = GetRepositoryFullPath(m_CLI.LicenseFile, DownloadBase) Set TempFile = fso.GetFile(FilePath) - AddMissingFile TempFile, clim_ImportMissingItems + AddMissingFile TempFile, clim_ImportMissingItems, DownloadBase End If 'Required modules (USE block) If ImportMode <> clim_ImportSelectedOnly Then If (0 / 1) + (Not Not m_CLI.Dependency) Then For i = 0 To UBound(m_CLI.Dependency) - FilePath = GetRepositoryFullPath(m_CLI.Dependency(i)) + FilePath = GetRepositoryFullPath(m_CLI.Dependency(i), DownloadBase) If fso.FileExists(FilePath) Then Set TempFile = fso.GetFile(FilePath) - AddMissingFile TempFile, ImportMode + AddMissingFile TempFile, ImportMode, DownloadBase End If Next End If @@ -801,10 +834,10 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm If ImportTestFiles Then If (0 / 1) + (Not Not m_CLI.TestFiles) Then For i = 0 To UBound(m_CLI.TestFiles) - FilePath = GetRepositoryFullPath(m_CLI.TestFiles(i)) + FilePath = GetRepositoryFullPath(m_CLI.TestFiles(i), DownloadBase) If fso.FileExists(FilePath) Then Set TempFile = fso.GetFile(FilePath) - AddMissingFile TempFile, ImportMode + AddMissingFile TempFile, ImportMode, DownloadBase End If Next End If @@ -844,7 +877,7 @@ Private Sub AddMissingReference(ByRef NewCodeLibRef As CodeLibInfoReference) End Sub -Private Sub AddMissingFile(ByVal UsedFile As Object, ByVal ImportMode As CodeLibImportMode) +Private Sub AddMissingFile(ByVal UsedFile As Object, ByVal ImportMode As CodeLibImportMode, Optional ByVal DownloadBase As String = vbNullString) Dim FileColItem As Variant Dim TempFile As Object @@ -863,7 +896,7 @@ Private Sub AddMissingFile(ByVal UsedFile As Object, ByVal ImportMode As CodeLib End If Next - FileColItem = Array(UsedFile, ImportMode) + FileColItem = Array(UsedFile, ImportMode, DownloadBase) m_ImportFileCollection.Add FileColItem, UsedFile.Path End Sub @@ -1021,7 +1054,7 @@ Private Sub ImportVbComponent(ByRef CodeLibInf As CodeLibInfo, ByRef ImportFile Dim CodeModuleExists As Boolean If Len(Trim$(CodeLibInf.Name)) = 0 Then - Err.Raise vbObjectError, "ADF_ImportExport.importVbComponent", "Es wurde versucht ein Module ohne Namen zu erstellen." + Err.Raise vbObjectError, "ImportExport.importVbComponent", "Es wurde versucht ein Module ohne Namen zu erstellen." Exit Sub End If @@ -1041,7 +1074,7 @@ Private Sub ImportVbComponent(ByRef CodeLibInf As CodeLibInfo, ByRef ImportFile Next If CodeModuleExists Then ' check if types match - If vbc.Type <> CodeLibInf.Type Then + If CodeLibInf.ForceRemoveIfExists Or vbc.Type <> CodeLibInf.Type Then VbcCol.Remove vbc Set vbc = Nothing CodeModuleExists = False @@ -1135,7 +1168,7 @@ Private Sub ImportAccessObject(ByRef AcOjbType As AcObjectType, ByRef CodeLibInf Dim AcObj As AccessObject If Len(Trim$(CodeLibInf.Name)) = 0 Then - Err.Raise vbObjectError, "ADF_ImportExport.importVbComponent", "An attempt was made to create a module without a name." + Err.Raise vbObjectError, "ImportExport.importVbComponent", "An attempt was made to create a module without a name." Exit Sub End If @@ -1295,7 +1328,9 @@ Private Function CodeModuleExits(ByVal CodeModuleName As String) As Boolean #End If For Each vbc In CurrentVbProject.VBComponents +#If DEBUGMODE Then Debug.Print vbc.Name, CodeModuleName +#End If If vbc.Name = CodeModuleName Then CodeModuleExits = True Exit Function diff --git a/source/modules/_config_Application.bas b/source/modules/_config_Application.bas index b72dc3e..63551fd 100644 --- a/source/modules/_config_Application.bas +++ b/source/modules/_config_Application.bas @@ -13,7 +13,7 @@ Option Compare Database Option Explicit 'Versionsnummer -Private Const APPLICATION_VERSION As String = "1.4.0" +Private Const APPLICATION_VERSION As String = "1.4.1" #Const USE_CLASS_ApplicationHandler_AppFile = 1 #Const USE_CLASS_ApplicationHandler_DirTextbox = 1 diff --git a/source/modules/defGlobal_ACLibImportWizard.bas b/source/modules/defGlobal_ACLibImportWizard.bas index 7745fc3..90264e7 100644 --- a/source/modules/defGlobal_ACLibImportWizard.bas +++ b/source/modules/defGlobal_ACLibImportWizard.bas @@ -50,6 +50,7 @@ Public Type CodeLibInfo ExecuteList() As String LicenseFile As String Description As String + ForceRemoveIfExists As Boolean End Type