|
| 1 | +# Drycodes.NET-Wrapper |
| 2 | +A [names.drycodes.com](https://names.drycodes.com) API wrapper for .NET, serving the purpose of random name generation. |
| 3 | + |
| 4 | +## What actually is this? |
| 5 | +This is an API wrapper for the site listed above. This site provides a variety of random name and number generators through an API. All of which is deserialized via JSON and fed to you in an easy-to-use form via a variety of methods. |
| 6 | + |
| 7 | +## How can I use it? |
| 8 | +You have two options, you can either reference the [NuGet package](https://www.nuget.org/packages/Drycodes.NET/), or you can download one of the releases and directly reference the DLL assembly. |
| 9 | + |
| 10 | +### Okay, I've added it to my project... what now? |
| 11 | +Drycodes.NET is super simple, and extremely easy. To begin using it in your code, do the following: |
| 12 | + |
| 13 | +```csharp |
| 14 | +DrycodesApi api = new(); |
| 15 | +``` |
| 16 | + |
| 17 | +Now you have created a Drycodes API object and you can use a variety of the methods via your `api` object. |
| 18 | + |
| 19 | +Here is an example: |
| 20 | +```csharp |
| 21 | +string boyName = api.GenerateBoyName(); |
| 22 | +Console.WriteLine(boyName); |
| 23 | +``` |
| 24 | +And... boom! It's as simple as that. The following code will simply generate one random boy name and output it to the console. |
| 25 | + |
| 26 | +If you want to generate a list (or array, to be more specific) of names, you can do the following: |
| 27 | +```csharp |
| 28 | +string[] objects = api.GenerateObjects(); |
| 29 | +foreach(string obj in objects){ |
| 30 | + Console.WriteLine(obj); |
| 31 | +} |
| 32 | +``` |
| 33 | +The following code will retrieve 10 random objects, iterate through each one and output it to the console. |
| 34 | + |
| 35 | +There are a couple of parameters that are defaulted, but you can modify them to your liking, here are a couple examples: |
| 36 | +```csharp |
| 37 | +string[] planets = api.GeneratePlanets(100); |
| 38 | +``` |
| 39 | +This will generate 100 planets and store them in the string array. The default quantity, without any arguments is 10. |
| 40 | + |
| 41 | +The last parameter is a seperator between the spaces between words, this is really done for one reason, and that's because the API automatically swaps spaces for underscores. With this wrapper, I made it a bit easier for all of you and got rid of all those by default, but you can change the seperator (if you want) like so: |
| 42 | +```csharp |
| 43 | +string game = api.GenerateGame("_!_"); |
| 44 | +Console.WriteLine(game); |
| 45 | +``` |
| 46 | + |
| 47 | +This will generate something along the lines of `Mario_!_Party`. You can even remove the space entirely by just using `""` for the seperator and that'll remove all spaces. |
| 48 | + |
| 49 | +Thanks for checking this out. If you have any questions, or issues, feel free to let me know! PRs are always welcome :) |
| 50 | + |
0 commit comments