TextUtility 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TextUtility --version 1.1.1                
NuGet\Install-Package TextUtility -Version 1.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TextUtility" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TextUtility --version 1.1.1                
#r "nuget: TextUtility, 1.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TextUtility as a Cake Addin
#addin nuget:?package=TextUtility&version=1.1.1

// Install TextUtility as a Cake Tool
#tool nuget:?package=TextUtility&version=1.1.1                
internal partial class TextUtilityTester : Form
{
    public TextUtilityTester()
    {
        CheckBox checkBox = new CheckBox() { Parent = this, Text = "RemoveEmptyLines", Dock = DockStyle.Top, };
        FloatingLineTextViewer fltv = new FloatingLineTextViewer("FloatingLineTextViewer");
        FloatingTextViewer ftv = new FloatingTextViewer("FloatingTextViewer");

        Button ShowFloatingTextViewer = new Button() { Parent = this, Dock = DockStyle.Top, Text = "ShowFloatingTextViewer", };
        ShowFloatingTextViewer.Click += (sender, e) =>
        {
            fltv.Show();
            ftv.Show();
        };

        Button OpenUsingFloatingTextViewer = new Button() { Parent = this, Dock = DockStyle.Top, Text = "FloatingTextViewer", };
        OpenUsingFloatingTextViewer.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var option = checkBox.Checked ? StringSplitOptions.RemoveEmptyEntries : StringSplitOptions.None;
                var lines = TextReader.Read(ofd.FileName, option);
                fltv.Reset(lines);
                fltv.Show();

                ftv.Reset(string.Join(Environment.NewLine, lines));
                ftv.Show();
                return;
            }
        };


        Button OpenUsingFloatingTextViewer2 = new Button() { Parent = this, Dock = DockStyle.Top, Text = "FloatingTextViewer(open multiple at the same time)", };
        OpenUsingFloatingTextViewer2.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var option = checkBox.Checked ? StringSplitOptions.RemoveEmptyEntries : StringSplitOptions.None;
                var lines = TextReader.Read(ofd.FileName, option);
                /** Also can create everytime */
                FloatingLineTextViewer fltvl = new FloatingLineTextViewer("FloatingLineTextViewer");
                fltvl.Reset(lines);
                /** must be set true when locally declared */
                fltvl.Show(true);
            }
        };


        Button buttonOpenAsList = new Button() { Parent = this, Dock = DockStyle.Top, Text = "ReadAsList", };
        buttonOpenAsList.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var option = checkBox.Checked ? StringSplitOptions.RemoveEmptyEntries : StringSplitOptions.None;
                var lines = TextReader.Read(ofd.FileName, option);
                ListTextViewer.ShowDialog(lines, ofd.FileName);
                ListTextViewer.ShowDialog(ofd.FileName, option);

            }
        };

        Button buttonOpenAsBinary = new Button() { Parent = this, Dock = DockStyle.Top, Text = "ReadAsBinary", };
        buttonOpenAsBinary.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var bytes = BinaryReader.ReadAllBytes(ofd.FileName);
                TextViewer.ShowDialog(bytes, ofd.FileName);
            }
        };

        Button buttonOpenFile = new Button() { Parent = this, Dock = DockStyle.Top, Text = "Read", };
        buttonOpenFile.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                TextViewer.ShowDialog(ofd.FileName);
            }
        };

        Button buttonWrite = new Button() { Parent = this, Dock = DockStyle.Top, Text = "Write", };
        buttonWrite.Click += (sender, e) =>
        {
            var dt = DateTime.Now;
            var dst = string.Format(".\\{0:yyyyMMdd_HHmmss}.txt", dt);
            var dstbytes = string.Format(".\\{0:yyyyMMdd_HHmmss}_bytes.txt", dt);

            TextWriter.Write(dst, dt.ToString());
            TextWriter.Write(dst, new[] { "foo", "bar" }, true);
            if (!BinaryWriter.Write(dstbytes, Encoding.UTF8.GetBytes("abc")))
            {
                MessageBox.Show("Error!");
            }
            MessageBox.Show(string.Format("wrote to {0}", dst));
        };


        Button buttonGetEncoding = new Button() { Parent = this, Dock = DockStyle.Top, Text = "GetEncoding", };
        buttonGetEncoding.Click += (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var d = BinaryReader.ReadAllBytes(ofd.FileName);
                MessageBox.Show(TextHelper.GetCode(d).ToString());
            }
        };

        Width = 600;
        StartPosition = FormStartPosition.CenterScreen;
    }

}
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.6 170 12/7/2023
1.1.5 122 11/28/2023
1.1.4 117 11/26/2023
1.1.2 346 11/20/2022
1.1.1 397 10/1/2022
1.1.0 429 7/7/2022
1.0.9 391 7/6/2022
1.0.8 454 3/5/2022
1.0.7 433 2/15/2022
1.0.6 415 2/11/2022
1.0.5 248 12/31/2021
1.0.3 307 10/22/2021
1.0.2 353 10/19/2021