Lpd.ImageFaker.Windows
1.0.1
dotnet add package Lpd.ImageFaker.Windows --version 1.0.1
NuGet\Install-Package Lpd.ImageFaker.Windows -Version 1.0.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.
<PackageReference Include="Lpd.ImageFaker.Windows" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lpd.ImageFaker.Windows --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lpd.ImageFaker.Windows, 1.0.1"
#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 Lpd.ImageFaker.Windows as a Cake Addin #addin nuget:?package=Lpd.ImageFaker.Windows&version=1.0.1 // Install Lpd.ImageFaker.Windows as a Cake Tool #tool nuget:?package=Lpd.ImageFaker.Windows&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Lpd.ImageFaker.Windows - Overview
- You may use this class library for creating Image from text lines or any object in apps for Windows
- You should use core version of this library - Lpd.ImageFaker.Core in dotnet core apps
- It was created for Lpd.ObjectFaker as utility for dotnet framework projects
- Lpd.ObjectFaker was created for Lpd tests via Personal Data Fake objects
- Reminder: You would use Lpd class library for GDPR and/or PCI DSS requirements implementation in your apps
Lpd.ImageFaker.Windows - Classes
- ImageOptions
- ImagePainter: draw text lines
- ObjectPainter: draw serialization of object
- Library tested for .net462
Example of images as result
Lpd.ImageFaker.Windows - Example of images for 'Person' object
- Create Console App for .net framework
- Install-package Lpd.ObjectFaker
- Install-package Lpd.ImageFaker.Windows
- Install-package Newtonsoft.Json
- Replace default source code for
using System;
using System.IO;
using Lpd.ObjectFaker;
using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;
namespace Lpd.ImageFaker.Windows.Example
{
internal class Program
{
public class SimplePerson
{
public string Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Email { get; set; }
public byte[] Image { get; set; } = null;
public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
public static class PersonGenerator
{
public static GeneratorBuilder<SimplePerson> CreateBuilderFor_RandomSimplePerson()
{
var builder = new GeneratorBuilder<SimplePerson>(new SimplePerson());
builder
.With(x => x.Id, () => System.Guid.NewGuid().ToString())
.With(x => x.Name, () => Lpd.ObjectFaker.RandomItem<string>.Random(new Lpd.ObjectFaker.Pops.NamesList().ToArray()))
.With(x => x.Surname, () => Lpd.ObjectFaker.RandomItem<string>.Random(new Lpd.ObjectFaker.Pops.SurnamesList().ToArray()))
.WithSelf(x => x.Email, it => $"{it.GetCurrentState().Name}-{it.GetCurrentState().Surname}@example.com")
.WithSelf(x => x.Image, it => ObjectPainter.Get(new ImageOptions().SetFontName(@"c:\windows\fonts\arial.ttf"), it.GetCurrentState()).ToArray()
)
;
//it will generate by setters when you call Get()
return builder;
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var SimplePersonRandom = PersonGenerator.CreateBuilderFor_RandomSimplePerson();
for (int i = 0; i < 10; i++)
{
var person = SimplePersonRandom.Get();
File.WriteAllBytes($@"c:\02\{person.Name}-{person.Surname}-{Environment.TickCount}.png", person.Image);
Console.WriteLine(person);
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net462 is compatible. 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.2
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
It would be a part of Lpd.ObjectFaker