TextUtility 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package TextUtility --version 1.0.9
NuGet\Install-Package TextUtility -Version 1.0.9
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.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TextUtility --version 1.0.9
#r "nuget: TextUtility, 1.0.9"
#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.0.9

// Install TextUtility as a Cake Tool
#tool nuget:?package=TextUtility&version=1.0.9
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();

                /** Also can create everytime */
                //                    FloatingLineTextViewer fltvl = new FloatingLineTextViewer("FloatingLineTextViewer");
                //                  fltvl.Reset(lines);
                //                fltvl.Show();

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

        };
        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 = TextReader.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);
            TextWriter.Write(dstbytes, Encoding.UTF8.GetBytes("abc"));
            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 = TextReader.ReadAllBytes(ofd.FileName);
                MessageBox.Show(TextHelper.GetCode(d).ToString());
            }
        };

        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 133 12/7/2023
1.1.5 100 11/28/2023
1.1.4 88 11/26/2023
1.1.2 324 11/20/2022
1.1.1 373 10/1/2022
1.1.0 402 7/7/2022
1.0.9 380 7/6/2022
1.0.8 422 3/5/2022
1.0.7 412 2/15/2022
1.0.6 392 2/11/2022
1.0.5 228 12/31/2021
1.0.3 287 10/22/2021
1.0.2 331 10/19/2021