Skip to content

Commit

Permalink
Updated namespaces and change the version to 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bezzad committed May 28, 2023
1 parent 0b7cd4c commit f55b40e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Captcha Generator is a simple cross-platform library for generating image captch

## Usage:
```csharp
using CaptchaGenerator;
using Captcha.Net;

namespace ConsoleAppSample
{
Expand All @@ -36,6 +36,8 @@ namespace ConsoleAppSample
var key = captchaGenerator.GenerateCaptchaCode();
var result = captchaGenerator.GenerateCaptchaImage(200, 100, key);
File.WriteAllBytes($"captcha.png", result.CaptchaByteData);

Console.WriteLine(result.CaptchBase64Data);
}
}
}
Expand Down
18 changes: 14 additions & 4 deletions src/Captcha.Net.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Captcha.Net;
using System.Diagnostics;

var captchaGenerator = new CaptchaGenerator();
// Create path: "...\CaptchaGenerator\src\CaptchaGenerator.Sample\bin\debug\net6.0\captcha"
Directory.CreateDirectory("captcha");
var currentDirectory = Directory.CreateDirectory("captcha");

for (int i = 0; i < 100; i++)
{
Expand All @@ -12,6 +12,16 @@
Console.WriteLine(result.CaptchBase64Data);
Console.WriteLine();

File.WriteAllBytes($"captcha/captcha-{i}.png", result.CaptchaByteData);

File.WriteAllBytes($"{currentDirectory.FullName}/captcha-{i}.png", result.CaptchaByteData);
}

// open the directory after completion
if (OperatingSystem.IsWindows())
{
Process.Start("explorer.exe", currentDirectory.FullName);
}
else if (OperatingSystem.IsLinux())
{
// Start a new process to open the folder
Process.Start("xdg-open", currentDirectory.FullName);
}
2 changes: 1 addition & 1 deletion src/Captcha.Net/Captcha.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>Captcha.Net</PackageId>
<Title>Captcha.Net</Title>
<FileVersion>1.0.1</FileVersion>
<FileVersion>1.1.1</FileVersion>
<Authors>Bezzad</Authors>
<Description>CAPTCHA Generator with .Net 6.0</Description>
<Copyright>2023</Copyright>
Expand Down

0 comments on commit f55b40e

Please sign in to comment.