BinaryFormatterUtility 1.0.2

.NET Framework 4.5.2
Install-Package BinaryFormatterUtility -Version 1.0.2
dotnet add package BinaryFormatterUtility --version 1.0.2
<PackageReference Include="BinaryFormatterUtility" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BinaryFormatterUtility --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BinaryFormatterUtility, 1.0.2"
#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 BinaryFormatterUtility as a Cake Addin
#addin nuget:?package=BinaryFormatterUtility&version=1.0.2

// Install BinaryFormatterUtility as a Cake Tool
#tool nuget:?package=BinaryFormatterUtility&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
/// <summary>
/// Application Settings
/// Need Serializable attribute
/// </summary>
[Serializable]
public class BinaryFormatterUtilityTesterSettings
{
    public BinaryFormatterUtilityTesterSettings()
    {
        StartupHistory = new List<DateTime>();
        CurrentLocationAndSize = new Rectangle(100,100,400,200);
    }

    public Rectangle CurrentLocationAndSize;
    public DateTime LatestStartup;
    public List<DateTime> StartupHistory;

}

public partial class BinaryFormatterUtilityTester : Form
{
    const string SETTINGS_PATH = ".\\settings.dat";

    public BinaryFormatterUtilityTester()
    {
        /** load settings */
        var settings = BinaryFormatterUtility.BinaryFormatterUtil.Load<BinaryFormatterUtilityTesterSettings>(SETTINGS_PATH);

        FormClosing += (sender, e) =>
        {
            /** save settings when closing. */
            settings.CurrentLocationAndSize = new Rectangle(Top, Left, Width, Height);
            BinaryFormatterUtility.BinaryFormatterUtil.Save(SETTINGS_PATH, settings);
        };

        var statusStrip = new StatusStrip() { Parent = this, };
        var progress = new ToolStripStatusLabel()
        {
            TextAlign = ContentAlignment.MiddleLeft,
            Spring = true,
            Text = settings.LatestStartup != default(DateTime) ?
            string.Format("Last started: {0}", settings.LatestStartup) : "Last started: -",
        };

        statusStrip.Items.Add(progress);

        ListBox listBox = new ListBox() { Parent = this, Dock = DockStyle.Top, };

        SizeChanged += (sender, e) =>
        {
            listBox.Height = ClientSize.Height - progress.Height;
            progress.Width = statusStrip.Width - 10;
        };

        StartPosition = FormStartPosition.Manual;
        Location = new Point(settings.CurrentLocationAndSize.Top, settings.CurrentLocationAndSize.Left);
        Size = new Size(settings.CurrentLocationAndSize.Width, settings.CurrentLocationAndSize.Height);

        settings.LatestStartup = DateTime.Now;
        settings.StartupHistory.Add(DateTime.Now);
        if (settings.StartupHistory.Count > 5) settings.StartupHistory.RemoveAt(0);

        listBox.Items.AddRange(settings.StartupHistory.Select(x => x.ToString()).ToArray());

    }
}
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.0.2 100 1/7/2022

v1.0.2.0