TextUtility 1.1.6
dotnet add package TextUtility --version 1.1.6
NuGet\Install-Package TextUtility -Version 1.1.6
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.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TextUtility --version 1.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TextUtility, 1.1.6"
#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.6 // Install TextUtility as a Cake Tool #tool nuget:?package=TextUtility&version=1.1.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TextUtility;
namespace TextViewerTester
{
internal partial class TextUtilityTester : Form
{
public TextUtilityTester()
{
CheckBox checkBox = new CheckBox() { Parent = this, Text = "RemoveEmptyLines", Dock = DockStyle.Top, };
FloatingListTextViewer fltv = new FloatingListTextViewer("FloatingListTextViewer");
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 */
FloatingListTextViewer fltvl = new FloatingListTextViewer("FloatingListTextViewer");
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 buttonShow = new Button() { Parent = this, Dock = DockStyle.Top, Text = "ShowText", };
buttonShow.Click += (sender, e) =>
{
var text = string.Join(Environment.NewLine, "abc", "def", "ghi");
TextViewer.ShowDialog(text, "ShowText");
};
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());
}
};
Button buttonInputBox = new Button() { Parent = this, Dock = DockStyle.Top, Text = "InputBox", };
buttonInputBox.Click += (sender, e) =>
{
var t = "abc";
if( InputBox.ShowDialog(ref t, "input", "inputbox", true)== DialogResult.OK)
{
MessageBox.Show(t);
}
};
Width = 600;
StartPosition = FormStartPosition.CenterScreen;
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. 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.
-
.NETFramework 4.6.1
- 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.