TextUtility 1.1.1

.NET Framework 4.5.2
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.
dotnet add package TextUtility --version 1.1.1
<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, C# scripting and .NET Interactive. 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 Versions
.NET Framework net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
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.1 0 10/1/2022
1.1.0 70 7/7/2022
1.0.9 71 7/6/2022
1.0.8 102 3/5/2022
1.0.7 89 2/15/2022
1.0.6 86 2/11/2022
1.0.5 100 12/31/2021
1.0.3 149 10/22/2021
1.0.2 179 10/19/2021