Giter Site home page Giter Site logo

fluffynuts / peanutbutter Goto Github PK

View Code? Open in Web Editor NEW
175.0 10.0 32.0 40.38 MB

Tasty, versatile, nutritious; goes with many things in .net.

License: BSD 3-Clause "New" or "Revised" License

C# 95.12% Inno Setup 0.03% PowerShell 0.04% JavaScript 0.12% TSQL 0.33% Batchfile 0.01% Shell 0.01% Visual Basic .NET 4.11% TypeScript 0.24%
duck-typing utility csharp hacktoberfest testing mysql sqlserver sqlite

peanutbutter's Introduction

PeanutButter

Test status

Nuget current version badge

Download stats

Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge Nuget downloads badge

"Some tastiness to add to your dev sandwich"

PeanutButter is a collection of projects which provide useful bits of functionality that I've often had to re-use (and also provides some concrete examples of usage). Sometimes I can even be bothered to write about it at http://davydm.blogspot.co.za/search/label/PeanutButter.

Inside, you'll find, amongst other things:

  • Duck-typing for .NET (PeanutButter.DuckTyping)
    • rigid or fuzzy duck-typing, including the ability to wrap a dictionary with a strongly-typed interface, even if the starting dictionary is empty.
  • Randomisation utilities for testing with (PeanutButter.RandomGenerators)
    • Random Value Generators
      • Tests with random values are usually more useful because, if nothing else, after many runs, you've hit many test scenarios and often an edge case which would cause you production headaches pops out of the wood work. I prefer to test with random values wherever possible
      • In addition to the helpers in RandomValueGen which can be used to get randomised:
        • string values (arbitrary, alphabetic, or alphanumeric)
        • numeric values (decimal, long)
        • boolean values
        • datetime values there is also the GenericBuilder base which you can use as a very quick and easy way to create builders for complex types. These builders have the ability to generate randomised or directed objects.
  • Test utilities:
    • PeanutButter.TestUtils.Generic which allows easy TestCase scenarios for property get/set tests with PropertyAssert which allows easy comparison of properties by name or, indeed relative path from the objects provided
    • PeanutButter.TestUtils.MVC (sunset) which provides a JsonResultExtensions class to simplify testing MVC actions which return JsonResults
    • PeanutButter.MVC (sunset), which provides facades and interfaces to make script and style bundles testable
    • PeanutButter.TestUtils.Entity provides mechanisms for testing your EF-based project code against temporary databases so you can be sure that the code you deploy will work as expected. This library is supported by PeanutButter.TempDb, so you can test (out of the box) against LocalDb, Sqlite and SQLCE. You can also provide your own TempDb<> implmentation
  • Arbitrary utils
    • DecimalDecorator which provides relatively safe string/decimal interchange, irrespective of culture
    • XElementExtensions to make dealing with XElement text easier
  • On-the-fly HTTP server for testing when you simply need a WebRequest to work
  • TempDb implementations (LocalDb, SqlCe and Sqlite) so you can run tests which involve migrations and integration between your ORM and the actual db
  • WindowsServiceManagement
    • provides functionality for query of & interaction with win32 services using the native Win32 api, exposed in an easy-to-use C# POCO
  • PeanutButter.DatabaseHelpers
    • provides builders for Select, Update, Delete and Insert SQL statements for legacy projects where you can't (at least, not yet) get in an ORM. The builders are more testable and you can use compile-time constants for table/column names to help to harden your code against dev errors and code rot
    • provides OleDB database executors and a data reader builder
  • PeanutButter.ServiceShell
    • provides scaffolding for a polling win32 service: inherit from the ServiceShell class, configure name and interval and provide your custom logic in the RunOnce override
    • resultant services can install and uninstall themselves as well as be invoked for once-off runs from the commandline. The project also contains a simple, but effective log4net configuration for console and a log file
  • EmailSpooler.Win32Service
    • harnesses PeanutButter.ServiceShell to provide a generic SMTP email spooling service backed with a data store. You can (theoretically) use any database which Entity can connect to, though this project has only been tested against MSSQL
    • EmailSpooler.Win32Service.DB provides FluentMigrator and raw SQL script files for generating the required underlying data structures.

Barring the last item, none of these are stand-alone: they're all just building blocks which I've had to repeat and refine, so I figure they may be of use to others. As far as possible, the code should be under test, though some projects are more difficult to unit test (eg the PeanutButter.WindowsServiceManagement project, which was developed TDD-style but which would sometimes flake out on tests because the windows service management would be hit too hard or often. But it does work (:) And some are libraries to help with testing, so you'll soon find that they work as expected.

A shout out to:

Jetbrains Logo

The work on PeanutButter would have been a lot more effort without ReSharper from JetBrains. The good people at JetBrains have provided free licensing for all of their products for open-source projects like this one. To learn more about JetBrains products, please [visit them](http://jetbrains.com)

peanutbutter's People

Contributors

andrewkeepcoding avatar andreyserenkov avatar dependabot[bot] avatar fluffynuts avatar gabbyhershey avatar geosong avatar kevinbosman avatar less0 avatar rohland avatar tammylotter avatar xiaoy312 avatar yinyue200 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peanutbutter's Issues

IniFile should not use ordinal Dictionary

We have big issues with the BOM at the beginning of the ini-Text-File being added to the first section (or first entry if there is no section header). So finding the sections or entrys fails, because StringComparer.OrdinalIgnoreCase also takes the BOM into account. Why are you using OrdinalIgnoreCase?
Could you either check for the BOM character or change the Dictionary to use InvariantCultureIgnoreCase?

StringComparer.OrdinalIgnoreCase

20210202.txt

FeatReq: Add Extra Parameters to Services PeanutButter.WindowsServiceManagement

I'm currently managing our Installer App with WMI calls to install and repair our app,
I was looking to your package to replace WMI as System.Management isn't AOT compatible.

Unfortunately, You only expose the basic features for the service, I am looking for the

  • Startup User/Pass
  • DesktopInteraction
  • ErrorControl

It's not urgent for my problem at the moment, If you could expose those, that would be awesome.
Otherwise when it gets more urgent, I might look if I can add the features.

RenameSection Method Needed for INI

Currently, the only way to rename a section is to create a new one and delete the old one.
That removes all comments and changes the position of the section within the ini file.

Please consider adding a RenameSection() method.

How to use PeanutButterINI

C# Windows Forms. I am new to C# and cannot follow how to use this. Do you have simple instructions anywhere for a novice? I have created a test app in C# Win forms. I installed PeanutButterINI using NuGet and have copied the tests to the project. I get many errors about missing namespaces and strings not existing in current context (amongst other errors).

In my project (not the test) I have successfully used Application Settings to save and load user settings for the values of controls on my form. I have a checkbox and code where I can set whether this happens automatically (at application start and close), or not. I also have a menu so I can load them and save them during runtime. This is all using the default user.config.

Does INI read the Application Settings or is it completely separate?

I want to be able to save and load Application settings to different files so I can have multiple Application Setting sets.
Can PeanutButterINI be configured to do this?

Nice-to-have: nuget icons

Seeing warnings that <iconUrl> is deprecated in the nuspecs raises the question of new icons, which would be checked into the PB repo.

1st prize: icons with a constant theme which communicate the purpose of each library, even if they just have a common frame/background with a little text on them.

2nd prize: a unified icon for all packages.

Preferred design:

  • minimal
  • flat
  • catchy color
  • perhaps a mascot design? Not imperitive: minimal, communicative icons would work great.

PeanutButter.INI request for new Load overload

Expected Behavior

Load() a non-existing file should not create folders nor file.
It should just work in memory until the .Persist() calling.

Actual Behavior

Load() creates full path directories path and a 0 byte file, in case of missing.
The creation is performed into GetLinesFrom() and there's no way to avoid it.

Steps to Reproduce the Problem

  1. call Load() to a non-existing file

Specifications

  • Platform: Windows 10 x64
  • PeanutButter Component: PeanutButter .INI
  • PeanutButter Version: 3.0.180

Suggestions:

  1. create an Load overload method with bool ensureFileExist (= false)
  2. create a new method (example: Create(string fileName) that doesn't write anything until .Persist()
  3. allow to set this.Path from outside (now it's read-only)

Thank you.

Add Option (or default) for Section Gaps

Currently, after persisting, there are no gaps between sections.
This makes it difficult to review the ini when opened in notepad.

Please consider adding a default separator such as blank row, blank comment (; ), or line comment (; -----).

PeanutButter.INI exception

Expected Behavior

Work

Actual Behavior

Exception
immagine

Steps to Reproduce the Problem

  1. Use a customized parser with ' as comment char
    class IniFileLineParser : BestEffortLineParser
    {
    public IniFileLineParser()
    {
    base.CommentDelimiter = "'";
    }
    }

  2. Load a file containing one or two ' in the value, not as comment
    DATI.TXT

Specifications

  • Platform: VS 2022
  • PeanutButter Component: INI
  • PeanutButter Version: 2.0.75

PeanutButter.TempDb.Runner *nix issues

Mainly around start-tempdb.sh

  • should have unix line-endings
  • should not attempt to run .exe from within netcoreapp folder with mono
    • netcoreapp 2.2 didn't provide an exe, but now we have one
      • current netcoreapp executable is a win32 image!
      • if the auto-gen for package.nuspec simply omits the .exe from the netcoreapp folder
        then the existing start-tempdb.sh should work.

semi-colon ini text value causes truncation (2022)

I'm trying to use PeanutButter.INI but it truncates text at every ; because it considers that sign a comment.
I suppose I should create a new ILineParser to tell the library to do not stop reading at ; but I cannot figure out how.
Do you have any documentation?

Use case:
[PATHS]
'The line below contains the SQL connection string to customer DB
DBPATH=DRIVER={SQL Server};SERVER=192.168.85.130\SQLEXPRESS02;DATABASE=OneSQL;UID=sa;PWD=pazzword;TRUSTED_CONNECTION=NO;CONNECTION TIMEOUT=60;

In my case, comments are full lines only, started with ' char, while ; it's a valid char.

Suggested solutions:

  1. allow to choose comment char. For example, ' instead of ; (current default)
  2. allow to choose comment detection as:
    -contains (current default)
    -startsWith
    -never
  3. document how to create a class to implement ILineParser with as small as possibile code needed

Thank you,
Matteo Farina

Quotes

Quotes are added to all values. For example, i cannot save a number without quotes.
It needs to be saved like this:
speed = 6

but it turns out:
speed = "6"

ini Remove method leaves the key behind

The ini Remove method deletes the key value but leaves the key behind.

Before the call:
[mySection]
myKey="myValue"

After calling gINIFile.Item("mySection").Remove("myKey"):
[mySection]
myKey

Expected behavior is for myKey to be completely removed.

SetValue return value

Could you add a return value to SetValue() function?
Example: bool
true: succeeded
false: failed
Thank you.

PeanutButter.DuckTyping: Parameter count error when trying to invoke overloaded method

Expected Behavior

Ducktyped object's method should invoke the underlying object's method matching the same signature

Actual Behavior

Invalid Parameter count exception is thrown

Steps to Reproduce the Problem

  1. ducktype object with overloaded method(s)
  2. try to invoke one of those methods from the ducktyped object
  3. Exception thrown

Specifications

  • Platform: Windows 10, X64
  • PeanutButter Component: DuckTyping
  • PeanutButter Version: 3.0.8

Feature: maintain order of sections and settings within file

Currently, in-memory storage for INIFile is performed via .net generic dictionaries, which do not guarantee order when enumerating. The feature to rename sections has highlighted the volatility of order. It would be nice to (perhaps optionally? perhaps always?) retain ordering, which would require some custom work -- possibly an internal implementation if IDictionary<TKey, TValue> since OrderedDictionary isn't generic.

PeanutButterINI Encoding

We are having issues with chinese characters being displayed in Notepad, when PeanutButterINI
creates / saves a file. I use notepad++ in development but the help desk needs open the INI in notepad, which encodes the strings into chinese characters, for some reason.

I have a WPF application in which, i hold the global object
public INIFile dvINI { get; set; }
Before the app is initialized, i'm doing some checks
if (Directory.Exists(assyPath))
{
if (File.Exists(assyPath + "\DVSettings.ini"))
{
dvINI = new INIFile(assyPath + "\DVSettings.ini");
Then Checking and setting some properties:
ex: //If Key doesnt exist, Create it
if (!dvINI.HasSetting("DrawingViewer", "EnableLogging"))
{
dvINI["DrawingViewer"]["EnableLogging"] = "False";
}
enableLogging = Convert.ToBoolean(dvINI["DrawingViewer"]["EnableLogging"]);

I've tried changing the encoding in notepad++ but PBINI only reads UTF-8 correctly.

When the app runs it creates the ini with preset variables with string paths
ex: [Main-WHQ]
DEVPath="\XXXX\XXXXX\XXX\manufacturing"
MaxHistory="60"

Then when the app closes it resaves certain variables.
I tried to save these to a different file, in which at first glance seemed to work, but then
the chinese characters came back.

Is there any fix that i can look at to resolve this issue?
Is there any option to force the encoding to UTF-8?

Update PeanutButter.EasyArgs to be AOT-friendly

Expected Behavior

I'd like to be able to compile cli apps AOT, and use PeanutButter.EasyArgs because it's easy!

Actual Behavior

I can't, because under the hood, EasyArgs uses the DuckTyper, which emits code - which isn't supported on AOT targets

Steps to Reproduce the Problem

  1. Build a CLI app using EasyArgs AOT
  2. Attempt to run
  3. ๐Ÿ’ฅ

Specifications

  • Platform: All
  • PeanutButter Component: EasyARgs
  • PeanutButter Version: current

Nice-to-have: Nuget flavored package icons

A recent PR has provided an SVG source icon (resources/logo.svg) which now needs to be applied to the arduous task of copying, applying textural labels & exporting as png for each of the published projects. There's limited space considering the final size of the icon, so here are suggestions:

PeanutButter.Utils - "Utils"
PeanutButter.RandomGenerators - "Random"
PeanutButter.INI - "INI"
PeanutButter.TrayIcon - "Tray"
PeanutButter.ServiceShell - "Service"
PeanutButter.WindowsServiceManagement - "SvcMgr"
PeanutButter.SimpleHttpServer - "HTTP"
PeanutButter.TempDb - "TempDb"
PeanutButter.XmlUtils - "Xml"
PeanutButter.DatabaseHelpers - "SQL"
PeanutButter.DatabaseHelpers.Testability - "SQL-T"
PeanutButter.FluentMigrator - "Migrate"
PeanutButter.Async - "Async"
PeanutButter.Utils.Entity - "EF"
PeanutButter.TestUtils.Generic - "TestUtils"
PeanutButter.TinyEventAggregator - "Events"
PeanutButter.DuckTyping - "Quack"
PeanutButter.TestUtils.Async - "TestAsync"
PeanutButter.SimpleHTTPServer.Testability - "HttpTest"
PeanutButter.SimpleTcpServer - "TCP"
PeanutButter.JObjectExtension - "{}"
PeanutButter.TempDb.Sqlite - "Sqlite"
PeanutButter.TempDb.LocalDb - "LocalDb"
PeanutButter.TestUtils.MVC - "MVC"
PeanutButter.TempDb.SqlCe - "SqlCe"
PeanutButter.TempDb.Runner - "DbRunner"
PeanutButter.TempDb.MySql.Connector - "MySql.Connector"
PeanutButter.TempDb.MySql.Data - "MySql.Data"

A pull request does not have to satisfy all icon requirements. Feel free to PR with as many icons as you like, or as few (: This would be a good beginner task, especially if you're wanting to learn about SVG, or the PR process (:

Project restructuring to simplify dev, especially multi-platform dev

Some projects haven't received updates in a very long time - simply because I'm not using them.
Some of these aren't even on nuget.org, eg:

  • PeanutButter.MVC
  • PeanutButter.NetUtils

Other projects are on nuget.org, but are unlikely to receive functional updates because I'm not using them, but I'll support issues, if anyone brings them up. In particular, I'd want to target packages which depend on other nuget packages (thus which should have maintenance updates for dependencies) or packages where the same functionality can be found in actively-maintained packages

  • PeanutButter.Utils.Entity (I don't use EF, and even if I did, I'd probably use EFCore, not EF itself - deps are way outdated on this)
  • PeanutButter.TestUtils.Generic (NExpect does a better job)

In addition, PeantuButter.ServiceShell and PeanutButter.WindowsServiceManagement should probably move off into their own area as they can't build or test on anything but Windows (which is their intended target) and they are relatively stable - so they hold back being able to work on PB on Linux for no real benefit.

There may be others, but the idea should be to make build, test & publish possible cross-platform (this would also require updating to use dotnet to build and push nuget packages - see #53)

Switch build, pack & push to use `dotnet`

I'd like to be able to hack on PB on any machine - so I'd like to embrace dotnet for build & targeting.

This raises the issue of minimum framework support (currently net452) - though the included MonoForFramework.targets file may suffice with a reasonable system Mono install, conversely the solution at https://stackoverflow.com/a/45380046 would allow build & test on !windows, but release would still have to happen on a windows machine.

This also raises the issue of platform-specific packages:

  • PeanutButter.ServiceShell
  • PeanutButter.WindowsServiceManagement

These are quite stable and should probably be moved into their own repos, much like https://github.com/fluffynuts/PeanutButter.TrayIcon

If tooling can be switched to dotnet, then packaging metadata would come from the .csproj files, meaning zarro would just build packages (remove custom package building), zarro could increment package versions (remove NugetPackageIncrementer) and the Package.nuspec files could be removed too.

CORS policy

i use SimpleHTTPServer.

Can i set allows CORS Policy in response header?

Optimise PeanutButter.TempDb.MySql.Data for higher throughput on beefier machines

TempDbMySql can be instantiated with a number of the settings which would be written to the temporary instance's my.ini. There is a POCO which exposes the settings I found via a quick trawl of Oracle's documentation, but apparently there are many advanced settings which aren't currently tweakable via this interface, particularly some which could improve performance (meaning tests run faster!), especially on higher-end machines which can handle it.

These options largely center around disk I/O.

I would like:

  1. These options to be available via the ctor parameter to TempDbMySql so that a savvy user can tweak them to her heart's content
  2. Reasonable values should be applied by default for these options, assuming a reasonably beefy machine to run on (16Gb RAM, SSD, 4 cores)
  3. Simple helper methods to produce options for:
    a. a low-end machine
    b. a high-end machine (these should be used by default)
    c. no-holds-barred, fastest performance, I don't care about the ram or disk requirements.

How to set encoding?

How to set encoding for Persist() method?
The file seems to be written always in UTF-8 but in some occasions I have to save it in ANSI.
Thank you.

semi-colon ini text value causes truncation

The following ini entry was saved properly. But this entry gets truncated starting with the first semi-colon when reading the value.

Email_Message=" <title>message</title> <style type="text/css"> body{font-family: Verdana, Geneva, sans-serif; font-size:10pt;} td{font-family: Verdana, Geneva, sans-serif;font-size:10pt;} p{margin-top: 10px; margin-bottom: 10px;} ol,ul{margin-top: -10px; margin-bottom: -10px;} </style> test {MovedFileFullPath} "

So when reading that entry, the text starting with the first semi-colon is lost, resulting in just this text:
" <title>message</title> <meta http-equiv="content-type" content="text/html

Looks like the value-embedded semi-colon is falsely handled as a start of a comment.
Looks like there's a need to improve comment detection.

Consistent behavior of GetRandom{numeric}

GetRandom{Int|Long|Decimal|Float|Double) should be friendlier when providing only a lower-bound for the range of acceptable values, and, instead of using the default parameter value and then potentially swapping them, should rather use the default range, added onto the minimum

ie if the user asks for GetRandomInt(100), then she probably expects a number of value at least 100, but the current implementation defaults the max to 10 and tries to protect the caller against accidental flipping of min & max, so the call above results in a number between 10 and 100 (inclusive). Probably not the original intention of the call, and not clear.

[PeanutButter.INI] - Not possible to persist ini file if there is a SectionSeparator and no section

In case, I have ini file and I remove a last section from that file and try to save via Persist(), it fails on trying to remove non existing item.

Expected Behavior

Persist doesn't throw an exception and the file is empty after the call.

Actual Behavior

An exception "Exception is "Index was out of range. Must be non-negative and less than the size of the collection." is thrown.

Steps to Reproduce the Problem

  1. Load ini file that contains one section
  2. Remove the section
  3. Call Persist()

Specifications

  • Platform: Windows
  • PeanutButter Component: INI
  • PeanutButter Version: 3.0.160

Stack

   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.RemoveAt(Int32 index)
   at PeanutButter.INI.INIFile.GetLinesForCurrentData(PersistStrategies persistStrategy) in C:\source\PeanutButter\source\INI\PeanutButter.INI\INIFile.cs:line 1092
   at PeanutButter.INI.INIFile.Persist(String saveToPath, PersistStrategies persistStrategy, Encoding encoding) in C:\source\PeanutButter\source\INI\PeanutButter.INI\INIFile.cs:line 980
   at PeanutButter.INI.INIFile.Persist(Encoding encoding) in C:\source\PeanutButter\source\INI\PeanutButter.INI\INIFile.cs:line 919
   at PeanutButter.INI.INIFile.Persist() in C:\source\PeanutButter\source\INI\PeanutButter.INI\INIFile.cs:line 913
   at PeanutButter.INI.Tests.TestINIFile.Construction.MergingConfigurations.Persistence.PersistEmptyIniWithLineSeparator() in C:\source\PeanutButter\source\INI\PeanutButter.INI.Tests\TestINIFile.cs:line 347

Per-project documentation

It would be great to spend some time on documenting individual projects, even if only briefly in a README.md in each project's folder. The natural knock-on for this would be to make the readme available in the nuget package via the nuspec options outlined at https://devblogs.microsoft.com/nuget/add-a-readme-to-your-nuget-package/, specifically:

<package>
    <metadata>
    ...
    <readme>docs\README.md</readme>
    ...
    </metadata>
    <files>
    ...
    <file src="..\README.md" target="docs\" />
    ...
    </files>
</package>

this would:

  • make it easier for someone not acquainted with the projects to use them
  • surface this documentation at nuget.org

Projects to consider (probably best candidates in bold):

  • PeanutButter.Async
  • PeanutButter.TestUtils.Async
  • PeanutButter.DatabaseHelpers
  • PeanutButter.DatabaseHelpers.Testability
  • PeanutButter.INI
  • PeanutButter.SimpleHTTPServer
  • PeanutButter.SimpleTcpServer
  • PeanutButter.TempDb
  • PeanutButter.TempDb.LocalDb
  • PeanutButter.TempDb.MySql.Connector
  • PeanutButter.TempDb.MySql.Data
  • PeanutButter.TempDb.SqlCe
  • PeanutButter.TempDb.Sqlite
  • PeanutButter.TempRedis
  • PeanutButter.RandomGenerators
  • PeanutButter.TestUtils.Entity
  • PeanutButter.TestUtils.Generic
  • PeanutButter.TestUtils.MVC
  • PeanutButter.TinyEventAggregator
  • PeanutButter.DuckTyping
  • PeanutButter.EasyArgs
  • PeanutButter.FileSystem
  • PeanutButter.FluentMigrator
  • PeanutButter.JObjectExtensions
  • PeanutButter.MVC
  • PeanutButter.NetUtils
  • PeanutButter.Utils
  • PeanutButter.Utils.Entity
  • PeanutButter.Utils.Windsor
  • PeanutButter.XmlUtils
  • PeanutButter.ServiceShell
  • PeanutButter.WindowsServiceManagement

[PeanutButter.INI] How can I add an empty line at the last line?

I'm working with an old library that load an INI file and I'm editing its INI file with PeanutButter.INI. The problem I'm facing is that PeanutButter.INI removes empty lines in at the bottom of the file. Apparently, the library needs those empty lines.

Expected Behavior

Not removing empty lines at the bottom.

Actual Behavior

Removes all empty lines at the bottom.

Steps to Reproduce the Problem

  1. Load an exsiting INI file.
  2. Call Persit().

Specifications

  • Platform: Win11
  • PeanutButter Component: PeanutButter.INI
  • PeanutButter Version: v3.04

Possibility of port conflicts

I've seen a mysql tempdb attempt to start up and fail with this in the error log:

2020-06-12T08:35:11.547292Z 0 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
2020-06-12T08:35:11.547717Z 0 [ERROR] Do you already have another mysqld server running on port: 49932 ?

Perhaps TempDbMySql could look for mysql-err.log and try to grok this issue; if found, re-randomize the port and try again.

Random builder dependency chain

I'm still using 1.0.155 so this might have been resolved already.

I'm using the generic builders in the RandomGenerators and when calling .BuildRandom() or .WithRandomProps() I don't get a random object, I get default values. It requires the TestUtils.Generic package to be installed to get real random values, It seems like there is a dependency requirement missing because BuildRandom doesn't actually work without it so I was pretty confused until I debugged my tests to find the lack of randomness.

PeanutButter.INI: CommentDelimiter not respected when saving

If .CommentDelimiter has been set, for example to CommentDelimiter = "'";
after calling .Persist()
the result file contains both ; and ' are the comment header.

Expected Behavior

[DBJUMPING]
'NOJUMPRANGE=1

Actual Behavior

[DBJUMPING]
;'NOJUMPRANGE=1

Steps to Reproduce the Problem

  1. set CommentDelimiter = "'"; for BestEffortLineParser derived class
  2. read the INI file
  3. save the INI file calling .Persist()

Specifications

  • Version: 2.0.72
  • Platform: Windows 10
  • Component: Visual Studio 2022

GenericBuilder should not b0rk when attempting to randomise props which are Actions or Funcs

Currently, if you have a class or interface with a property like:

public interface IMooCow
{
	Action<string> LogAction { get; set; }
}

Then GenericBuilder will explode when attempting default randomisation of an entity constructed for this type as you can't Activator.CreateInstance on an Action or Func.

What should really happen here is that the randomiser should just create an action or func which matches the required call signature and does nothing (in the case of the func should return the default value for the return type).

Servicepath can not be set // any documentation?

Hi,
neigther the constructor nor the "Install" method of WindowsServiceUtil provide a way to set the exe file path. There is the "ServiceExe" property, but its read only.

Is this a bug? How do you install a service?

TrayIcon NuGet package empty

Hi @fluffynuts!

I wanted to try out your TrayIcon component today but noticed that the current PeanutButter.TrayIcon NuGet package unfortunately doesn't contain any assemblies at all.
Then I looked back a bit and I think that version 1.1.44 is the last one that was actually not empty.

Am I missing something or could there be an error in the NuGet build for this package since version 1.2.0?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.