Skip to content

Commit

Permalink
doc: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ZGGSONG committed Oct 1, 2024
1 parent fb7a7d9 commit 62715e8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
49 changes: 45 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
# [WeChatOcr](https://github.com/ZGGSONG/WeChatOcr/)
# [WeChatOcr](https://github.com/ZGGSONG/WeChatOcr/)

[![Language](https://img.shields.io/badge/language-C%23-blue.svg?style=flat-square)](https://github.com/ZGGSONG/WeChatOcr/search?l=C%23&o=desc&s=&type=Code)

Description

<!--### Nuget
### Nuget

[![NuGet](https://img.shields.io/nuget/dt/WeChatOcr.svg?style=flat-square&label=WeChatOcr)](https://www.nuget.org/packages/WeChatOcr/)

```
Install-Package WeChatOcr-
```-->
Install-Package WeChatOcr
```

### Usage

- [WeChatOcr](./src/WeChatOcr/README.md)
- Example Code

```cs
var weChatPath = @"D:\Apps\WeChat\[3.9.12.11]"; //Your WeChat installation directory
//1. image file
var imgPath = @"C:\Users\admin\Desktop\test.png"; //Your image file path
//2. image bytes
var imgBytes = new Byte[] {}; //Your image binary data
using var ocr = new ImageOcr(weChatPath);
ocr.Run(imgPath, //imgPath or imgBytes
(path, result) =>
{
try
{
if (result == null) return;
var list = result?.OcrResult?.SingleResult;
if (list == null)
{
//避免重复触发
_tcs.SetResult("WeChatOCR get result is null");
return;
}

var sb = new StringBuilder();
for (var i = 0; i < list?.Count; i++)
{
if (list[i] is not { } item || string.IsNullOrEmpty(item.SingleStrUtf8))
continue;

sb.AppendLine(item.SingleStrUtf8);
}

_tcs.SetResult(sb.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
});
```


### presentation

Expand Down
2 changes: 1 addition & 1 deletion src/WeChatOcr/WeChatOcr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PropertyGroup Label="Nuget">
<Version>1.0.0</Version>
<Title>WeChatOcr</Title>
<Description>WeChatOcr</Description>
<Description>WeChatOcr, Study only, do not use for commercial purposes</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>WeChatOcr</PackageTags>
</PropertyGroup>
Expand Down

0 comments on commit 62715e8

Please sign in to comment.