{"id":21070801,"url":"https://github.com/fafalone/linebreakrepair","last_synced_at":"2026-03-16T08:36:20.290Z","repository":{"id":211628031,"uuid":"729608502","full_name":"fafalone/LinebreakRepair","owner":"fafalone","description":"GHFix: VB6 GitHub Linebreak Repair","archived":false,"fork":false,"pushed_at":"2025-03-10T13:00:36.000Z","size":9793,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T13:41:53.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fafalone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-09T19:09:21.000Z","updated_at":"2025-03-10T12:58:42.000Z","dependencies_parsed_at":"2023-12-09T20:28:50.119Z","dependency_job_id":"29782e55-444a-4d15-b01c-14a75b1db47f","html_url":"https://github.com/fafalone/LinebreakRepair","commit_stats":null,"previous_names":["fafalone/linebreakrepair"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FLinebreakRepair","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FLinebreakRepair/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FLinebreakRepair/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fafalone%2FLinebreakRepair/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fafalone","download_url":"https://codeload.github.com/fafalone/LinebreakRepair/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243513875,"owners_count":20303026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T18:48:26.108Z","updated_at":"2025-12-28T09:22:42.016Z","avatar_url":"https://github.com/fafalone.png","language":"Visual Basic 6.0","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LinebreakRepair\nGHFix: VB6 GitHub Linebreak Repair\n\n### Last updated: 10 Mar 2025 - v1.2.4\n\n![image](https://github.com/fafalone/LinebreakRepair/assets/7834493/48230542-0803-46f6-8004-5c490d226015)\n\nI've been downloading a lot of VB6 projects from GitHub to test in twinBASIC. When these have been uploaded with certain settings, GitHub replaces the vbCrLf line breaks with vbLf only, which results in a corrupt file that VB6 can't read. tB can-- but I need to confirm working in VB6 first. So I made this small project to automatically repair the line breaks of all VB6 files in a given directory, with a number of options to help. The file type list is preset, but you could change it to work on any file type instead.\n\nThis project uses my [WinDevLib project](https://github.com/fafalone/WinDevLib) for all the APIs (this is why the source file size is so large; however the compiled exe uses only what is neccessary, so is only 2MB). Can be compiled to both 32bit and 64bit. I've tested to confirm the output is byte for byte identical to using WinHex to manually replace 0x0A with 0x0D 0x0A, and the app checks whether the line breaks already appear to be correct.\n\n**Update** v1.2.4 fixes crashing issues relating to handle release (FindClose vs CloseHandle)\n\n**Update** v1.1.3 fixes the bug where not all files that match the filter are added to the list and processed.\n\n**Update** v1.0.2 fixes an unhandled error when canceling the choose path dialog.\n\n\n### How it works\n\nThe basic principle is two loops. First, we count how many Lf's (0x0A) there are while checking if there's already an 0x0D before it:\n\n```vb6\n\n            For j = 0 To UBound(btSrc)\n                If btSrc(j) = btFind Then\n                    If (nMatch = 0) And (bFlagOk = False) And (j \u003c\u003e 0) Then\n                        If btSrc(j - 1) = btApp Then\n                            Dim r As VbMsgBoxResult = MsgBox(\"Warning: The current file appears to already have correct line breaks; continue anyway?\" \u0026 vbCrLf \u0026 \"Press 'Try again' to skip to the next file, 'Continue' to proceed and suppress future warnings, or 'Cancel' to abort the entire operation.\", vbCritical Or vbCancelTryAgainContinue, sName)\n                            If r = vbCancel Then\n                                CloseHandle hFile\n                                Return 1\n                            ElseIf r = vbContinue Then\n                                bFlagOk = True\n                            ElseIf r = vbTryAgain Then\n                                CloseHandle hFile\n                                GoTo NextFile\n                            End If\n                        End If\n                    End If\n                    cbDst += 1\n                    nMatch += 1\n                End If\n            Next\n```\n\nThis is used to compute the total size we'll need for the repaired file, so we can copy it right in with ease:\n\n```vb6\n            ReDim btDst(cbDst - 1)\n            \n            \n            For j = 0 To UBound(btSrc)\n                If btSrc(j) = btFind Then\n                    btDst(k) = btApp\n                    btDst(k + 1) = btFind\n                    k += 2\n                Else\n                    btDst(k) = btSrc(j)\n                    k += 1\n                End If\n            Next\n```\n\nThen we just make sure the file pointer is at the beginning and save:\n\n```vb6\n            lRet = SetFilePointer(hFile, 0, ByVal 0, FILE_BEGIN)\n            If (lRet = INVALID_SET_FILE_POINTER) Or (Err.LastDllError \u003c\u003e NO_ERROR) Then\n                PostLog \"Failed to reset file pointer on \" \u0026 sName\n                CloseHandle hFile\n                Return 2\n            End If\n            lRet = WriteFile(hFile, btDst(0), cbDst, cbRet, vbNullPtr)\n            \n            If lRet Then\n                PostLog \"Successfully fixed \" \u0026 nMatch \u0026 IIf(nMatch = 1, \" line break\", \" line breaks\") \u0026 \" in \" \u0026 sName\n            Else\n                PostLog \"Failed to write output to \" \u0026 sName \u0026 \", \" \u0026 PrintError(Err.LastDllError)\n            End If\n            \n            CloseHandle hFile\n```\n\nAnd that's the core of it. The snippets above are just to illustrate technique, there's a lot of missing error checking and other stuff. Download the project or browse Export for the full source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Flinebreakrepair","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffafalone%2Flinebreakrepair","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffafalone%2Flinebreakrepair/lists"}