From d1e4d878cd8fdd95f5fbc1f436fbf0d22a85e8d6 Mon Sep 17 00:00:00 2001 From: Pr0metheus2 Date: Thu, 2 Jul 2026 15:59:01 +0200 Subject: [PATCH 1/3] UTF-8 Encoding fix - Fixed the Encoding Issue: Updated EncodingDetector.cs to enable heuristic-based detection by default, correctly handling UTF-8 files without a BOM. - Updated Version to 1.8.2 - Resolved Build Errors: Harmonized the target framework version between EncodingTools and FindAndReplace projects --- src/EncodingTools/EncodingTools.csproj | 2 +- src/FindAndReplace.App/Properties/AssemblyInfo.cs | 4 ++-- src/FindAndReplace/EncodingDetector.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EncodingTools/EncodingTools.csproj b/src/EncodingTools/EncodingTools.csproj index e6d51a9..0233f7e 100644 --- a/src/EncodingTools/EncodingTools.csproj +++ b/src/EncodingTools/EncodingTools.csproj @@ -10,7 +10,7 @@ Properties EncodingTools EncodingTools - v4.5 + v4.0 2.0 diff --git a/src/FindAndReplace.App/Properties/AssemblyInfo.cs b/src/FindAndReplace.App/Properties/AssemblyInfo.cs index 1eb1b16..4c50372 100644 --- a/src/FindAndReplace.App/Properties/AssemblyInfo.cs +++ b/src/FindAndReplace.App/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.1")] -[assembly: AssemblyFileVersion("1.8.1")] +[assembly: AssemblyVersion("1.8.2")] +[assembly: AssemblyFileVersion("1.8.2")] diff --git a/src/FindAndReplace/EncodingDetector.cs b/src/FindAndReplace/EncodingDetector.cs index 2852975..016eb81 100644 --- a/src/FindAndReplace/EncodingDetector.cs +++ b/src/FindAndReplace/EncodingDetector.cs @@ -18,7 +18,7 @@ public enum Options MLang = 4 } - public static Encoding Detect(byte[] bytes, EncodingDetector.Options opts = Options.KlerkSoftBom | Options.MLang, Encoding defaultEncoding = null) + public static Encoding Detect(byte[] bytes, EncodingDetector.Options opts = Options.KlerkSoftBom | Options.MLang | Options.KlerkSoftHeuristics, Encoding defaultEncoding = null) { Encoding encoding = null; From d00cb3350d41dfaff56a4e0e48c141fd593b538d Mon Sep 17 00:00:00 2001 From: Pr0metheus2 Date: Tue, 21 Jul 2026 15:08:44 +0200 Subject: [PATCH 2/3] The UI path truncation issue fix - the textbox will now automatically expand as the window or panel is resized, preventing the truncation of long paths - adjusted the positioning and anchor of the "..." button (btnSelectDir) to ensure it remains correctly placed on the right side of the expanded directory field. --- .gitignore | 3 +- src/BuildVersionedExe.bat | 48 +++++++++++++++++++ src/FindAndReplace.App/MainForm.Designer.cs | 9 ++-- .../Properties/AssemblyInfo.cs | 4 +- src/log.txt | 16 ------- 5 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 src/BuildVersionedExe.bat delete mode 100644 src/log.txt diff --git a/.gitignore b/.gitignore index 0d90f29..b5297f1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ Z.Lab/ *.userprefs _ReSharper.* *.ReSharper.user -*.resharper.user \ No newline at end of file +*.resharper.user +src/log.txt diff --git a/src/BuildVersionedExe.bat b/src/BuildVersionedExe.bat new file mode 100644 index 0000000..6904c4b --- /dev/null +++ b/src/BuildVersionedExe.bat @@ -0,0 +1,48 @@ +@echo off +setlocal enabledelayedexpansion + +:: Define paths +set ASSEMBLY_INFO=%~dp0FindAndReplace.App\Properties\AssemblyInfo.cs +set RELEASE_DIR=%~dp0FindAndReplace.App\bin\Debug\ +set ILMERGE_PATH="C:\Program Files (x86)\Microsoft\ILMerge\ilmerge.exe" + +:: Extract version +for /f "tokens=2 delims=()" %%a in ('findstr /c:"[assembly: AssemblyFileVersion" %ASSEMBLY_INFO%') do ( + set VERSION_RAW=%%~a +) + +:: Remove dots to get fnrXXX.exe format +set VERSION_CLEAN=%VERSION_RAW:.=% + +:: Set output name +set OUTPUT_NAME=fnr%VERSION_CLEAN%.exe + +echo Current Directory: %CD% +echo VERSION_RAW: [%VERSION_RAW%] +echo VERSION_CLEAN: [%VERSION_CLEAN%] +echo OUTPUT_NAME: [%OUTPUT_NAME%] +echo RELEASE_DIR: [%RELEASE_DIR%] + +echo ILMERGE_PATH: [%ILMERGE_PATH%] +if not exist %ILMERGE_PATH% ( + echo ERROR: ILMerge not found at %ILMERGE_PATH% + pause + exit /b 1 +) + +echo Building %OUTPUT_NAME%... + +pushd %RELEASE_DIR% +echo Working Directory (in pushd): %CD% +echo Files present: +dir /b fnr.exe FindAndReplace.dll CommandLine.dll EncodingTools.dll +%ILMERGE_PATH% /log:log.txt /targetplatform:4 /out:%OUTPUT_NAME% fnr.exe FindAndReplace.dll CommandLine.dll EncodingTools.dll +popd + +echo Checking if %OUTPUT_NAME% exists in %RELEASE_DIR%... +if exist "%RELEASE_DIR%%OUTPUT_NAME%" ( + echo Success: %OUTPUT_NAME% created. +) else ( + echo ERROR: %OUTPUT_NAME% not found. + echo Check %RELEASE_DIR%log.txt for details. +) diff --git a/src/FindAndReplace.App/MainForm.Designer.cs b/src/FindAndReplace.App/MainForm.Designer.cs index db06540..16349ea 100644 --- a/src/FindAndReplace.App/MainForm.Designer.cs +++ b/src/FindAndReplace.App/MainForm.Designer.cs @@ -127,15 +127,13 @@ private void InitializeComponent() // // txtDir // - this.txtDir.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.txtDir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.errorProvider1.SetIconPadding(this.txtDir, 30); this.txtDir.Location = new System.Drawing.Point(79, 2); this.txtDir.Margin = new System.Windows.Forms.Padding(0); - this.txtDir.MinimumSize = new System.Drawing.Size(539, 20); this.txtDir.Name = "txtDir"; - this.txtDir.Size = new System.Drawing.Size(539, 20); + this.txtDir.Size = new System.Drawing.Size(441, 20); this.txtDir.TabIndex = 0; this.txtDir.Validating += new System.ComponentModel.CancelEventHandler(this.txtDir_Validating); // @@ -254,8 +252,7 @@ private void InitializeComponent() // // btnSelectDir // - this.btnSelectDir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); + this.btnSelectDir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnSelectDir.CausesValidation = false; this.btnSelectDir.Location = new System.Drawing.Point(526, 1); this.btnSelectDir.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0); diff --git a/src/FindAndReplace.App/Properties/AssemblyInfo.cs b/src/FindAndReplace.App/Properties/AssemblyInfo.cs index 4c50372..f9a6f27 100644 --- a/src/FindAndReplace.App/Properties/AssemblyInfo.cs +++ b/src/FindAndReplace.App/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.2")] -[assembly: AssemblyFileVersion("1.8.2")] +[assembly: AssemblyVersion("1.8.3")] +[assembly: AssemblyFileVersion("1.8.3")] diff --git a/src/log.txt b/src/log.txt deleted file mode 100644 index eef266b..0000000 --- a/src/log.txt +++ /dev/null @@ -1,16 +0,0 @@ -ILMerge version 2.12.803.0 -Copyright (C) Microsoft Corporation 2004-2006. All rights reserved. -ILMerge /log:log.txt /targetplatform:4 /out:fnr2.exe fnr.exe FindAndReplace.dll CommandLine.dll EncodingTools.dll -Set platform to '4', using directory 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\..\v4.0.30319' for mscorlib.dll -Running on Microsoft (R) .NET Framework v2.0.50727 -mscorlib.dll version = 2.0.0.0 -The list of input assemblies is: - fnr.exe - FindAndReplace.dll - CommandLine.dll - EncodingTools.dll -Could not find the file 'fnr.exe'. -An exception occurred during merging: -ILMerge.Merge: Could not find the file 'fnr.exe'. - at ILMerging.ILMerge.Merge() - at ILMerging.ILMerge.Main(String[] args) From b3afd15ee9fa23d7cd61fb70e0e7a53007159154 Mon Sep 17 00:00:00 2001 From: Pr0metheus Date: Tue, 21 Jul 2026 15:23:07 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85f73e7..0dc92b5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ +**Note:** +Original [FindAndReplace project](https://github.com/zzzprojects/findandreplace) does not seem to be maintained anymore, so I've decided to forked and fix some bugs. Feel free to use it as you wish. + # What's Find and Replace (FNR)? Find and Replace (FNR) is an open source tool to find and replace text in multiple files. It can quickly search through large numbers of files and also find the information using regular expressions specifying the form of what you want, instead of literal text. +image + + Read more on our [Website](http://findandreplace.io/). -[Download](http://findandreplace.io/download) +[Download](https://github.com/Pr0metheus2/findandreplace/releases) ## Sponsors