mirror of
https://github.com/tonytins/Lorem.NET.git
synced 2025-03-15 04:32:23 +00:00
all
This commit is contained in:
parent
4d5f21b34a
commit
12a803ac54
17 changed files with 83 additions and 18 deletions
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Lorem.NET
|
||||
namespace LoremNET
|
||||
{
|
||||
internal static class Extensions
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<ProjectGuid>{787D3BA7-DB6C-4704-B89C-8D91A4392442}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Lorem.NET</RootNamespace>
|
||||
<AssemblyName>Lorem.NET</AssemblyName>
|
||||
<RootNamespace>LoremNET</RootNamespace>
|
||||
<AssemblyName>LoremNET</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
|
|
6
Lorem.NET/Lorem.NET.csproj.user
Normal file
6
Lorem.NET/Lorem.NET.csproj.user
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Lorem.NET
|
||||
namespace LoremNET
|
||||
{
|
||||
public class Lorem
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Lorem.NET
|
||||
namespace LoremNET
|
||||
{
|
||||
/*
|
||||
* http://stackoverflow.com/a/1785821/234132
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Lorem.NET
|
||||
namespace LoremNET
|
||||
{
|
||||
internal class Source
|
||||
{
|
||||
|
|
BIN
Lorem.NET/bin/Release/LoremNET.dll
Normal file
BIN
Lorem.NET/bin/Release/LoremNET.dll
Normal file
Binary file not shown.
BIN
Lorem.NET/bin/Release/LoremNET.pdb
Normal file
BIN
Lorem.NET/bin/Release/LoremNET.pdb
Normal file
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
C:\AJ\Personal\GitHub\Lorem.NET\Lorem.NET\bin\Release\LoremNET.dll
|
||||
C:\AJ\Personal\GitHub\Lorem.NET\Lorem.NET\bin\Release\LoremNET.pdb
|
||||
C:\AJ\Personal\GitHub\Lorem.NET\Lorem.NET\obj\Release\LoremNET.dll
|
||||
C:\AJ\Personal\GitHub\Lorem.NET\Lorem.NET\obj\Release\LoremNET.pdb
|
BIN
Lorem.NET/obj/Release/LoremNET.dll
Normal file
BIN
Lorem.NET/obj/Release/LoremNET.dll
Normal file
Binary file not shown.
BIN
Lorem.NET/obj/Release/LoremNET.pdb
Normal file
BIN
Lorem.NET/obj/Release/LoremNET.pdb
Normal file
Binary file not shown.
BIN
NuGet/Lorem.NET.0.0.1.nupkg
Normal file
BIN
NuGet/Lorem.NET.0.0.1.nupkg
Normal file
Binary file not shown.
BIN
NuGet/Lorem.NET.0.0.2.nupkg
Normal file
BIN
NuGet/Lorem.NET.0.0.2.nupkg
Normal file
Binary file not shown.
55
readme.html
Normal file
55
readme.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<h1>Lorem.NET</h1>
|
||||
|
||||
<p>A .NET library for all things random!</p>
|
||||
|
||||
<h2>Usage</h2>
|
||||
|
||||
<h3>Text Helpers</h3>
|
||||
|
||||
<p>```csharp
|
||||
// this will generate a string with three words:
|
||||
string words = LoremNET.Lorem.Words(3);</p>
|
||||
|
||||
<p>// this will generate a string with two to five words:
|
||||
string words = LoremNET.Lorem.Words(2, 5);</p>
|
||||
|
||||
<p>// this will generate a string with five to ten words with "uppercaseFirstLetter" set to "false" and "includePunctuation" set to "true":
|
||||
string words = LoremNET.Lorem.Words(5, 10, false, true);</p>
|
||||
|
||||
<p>// a sentence is the same as "Words" except that it will include punctuation by default and will include a "." at the end of a string:
|
||||
string sentence = LoremNET.Lorem.Sentence(5, 10);</p>
|
||||
|
||||
<p>// a paragraph is a string composed of multiple sentences; this paragraph will have five to six words per sentence, and four to ten sentences:
|
||||
string paragraph = LoremNET.Lorem.Paragraph(5, 6, 4, 10);</p>
|
||||
|
||||
<p>// paragraphs is an array of paragraphs; this method will have eight to nine words per sentence, four to five sentences per paragraph, and one to three paragraphs:
|
||||
string[] paragraphs = LoremNET.Lorem.Paragraphs(8, 9, 4, 5, 1, 3);
|
||||
```</p>
|
||||
|
||||
<h3>Extras</h3>
|
||||
|
||||
<p>```csharp
|
||||
// this will generate a random valid email address:
|
||||
string email = LoremNET.Lorem.Email();</p>
|
||||
|
||||
<p>// this will generate a random DateTime object between 1/1/1950 and the current DateTime:
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime();</p>
|
||||
|
||||
<p>// this will generate a random DateTime object between 1/1/1995 and 12/31/2020:
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime(new DateTime(1995, 1, 1), new DateTime(2020, 12, 31))</p>
|
||||
|
||||
<p>// this will return "true" 55% of the time:
|
||||
bool isTruth = LoremNET.Lorem.Chance(55, 100);</p>
|
||||
|
||||
<p>// this will randomly select an item from the group:
|
||||
string[] numbers = GetNumbers();
|
||||
string number = LoremNET.Lorem.Random(numbers);
|
||||
```</p>
|
||||
|
||||
<h3>RandomHelper</h3>
|
||||
|
||||
<p>Lorem.NET includes a thread-safe System.Random instance.</p>
|
||||
|
||||
<p><code>csharp
|
||||
int i = LoremNET.RandomHelper.Instance.Next(1, 2)
|
||||
</code></p>
|
24
readme.md
24
readme.md
|
@ -10,42 +10,42 @@ Usage
|
|||
|
||||
```csharp
|
||||
// this will generate a string with three words:
|
||||
string words = Lorem.NET.Lorem.Words(3);
|
||||
string words = LoremNET.Lorem.Words(3);
|
||||
|
||||
// this will generate a string with two to five words:
|
||||
string words = Lorem.NET.Lorem.Words(2, 5);
|
||||
string words = LoremNET.Lorem.Words(2, 5);
|
||||
|
||||
// this will generate a string with five to ten words with "uppercaseFirstLetter" set to "false" and "includePunctuation" set to "true":
|
||||
string words = Lorem.NET.Lorem.Words(5, 10, false, true);
|
||||
string words = LoremNET.Lorem.Words(5, 10, false, true);
|
||||
|
||||
// a sentence is the same as "Words" except that it will include punctuation by default and will include a "." at the end of a string:
|
||||
string sentence = Lorem.NET.Lorem.Sentence(5, 10);
|
||||
string sentence = LoremNET.Lorem.Sentence(5, 10);
|
||||
|
||||
// a paragraph is a string composed of multiple sentences; this paragraph will have five to six words per sentence, and four to ten sentences:
|
||||
string paragraph = Lorem.NET.Lorem.Paragraph(5, 6, 4, 10);
|
||||
string paragraph = LoremNET.Lorem.Paragraph(5, 6, 4, 10);
|
||||
|
||||
// paragraphs is an array of paragraphs; this method will have eight to nine words per sentence, four to five sentences per paragraph, and one to three paragraphs:
|
||||
string[] paragraphs = Lorem.NET.Lorem.Paragraphs(8, 9, 4, 5, 1, 3);
|
||||
string[] paragraphs = LoremNET.Lorem.Paragraphs(8, 9, 4, 5, 1, 3);
|
||||
```
|
||||
|
||||
### Extras
|
||||
|
||||
```csharp
|
||||
// this will generate a random valid email address:
|
||||
string email = Lorem.NET.Lorem.Email();
|
||||
string email = LoremNET.Lorem.Email();
|
||||
|
||||
// this will generate a random DateTime object between 1/1/1950 and the current DateTime:
|
||||
DateTime dateTime = Lorem.NET.Lorem.DateTime();
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime();
|
||||
|
||||
// this will generate a random DateTime object between 1/1/1995 and 12/31/2020:
|
||||
DateTime dateTime = Lorem.NET.Lorem.DateTime(new DateTime(1995, 1, 1), new DateTime(2020, 12, 31))
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime(new DateTime(1995, 1, 1), new DateTime(2020, 12, 31))
|
||||
|
||||
// this will return "true" 55% of the time:
|
||||
bool isTruth = Lorem.NET.Lorem.Chance(55, 100);
|
||||
bool isTruth = LoremNET.Lorem.Chance(55, 100);
|
||||
|
||||
// this will randomly select an item from the group:
|
||||
string[] numbers = GetNumbers();
|
||||
string number = Lorem.NET.Lorem.Random(numbers);
|
||||
string number = LoremNET.Lorem.Random(numbers);
|
||||
```
|
||||
|
||||
### RandomHelper
|
||||
|
@ -53,5 +53,5 @@ string number = Lorem.NET.Lorem.Random(numbers);
|
|||
Lorem.NET includes a thread-safe System.Random instance.
|
||||
|
||||
```csharp
|
||||
int i = Lorem.NET.RandomHelper.Instance.Next(1, 2)
|
||||
int i = LoremNET.RandomHelper.Instance.Next(1, 2)
|
||||
```
|
Loading…
Add table
Reference in a new issue