An open API service indexing awesome lists of open source software.

https://github.com/jack251970/mdict.csharp

*.mdx/*.mdd interpreter csharp implements, support mdict index file
https://github.com/jack251970/mdict.csharp

csharp dictionary glodendict mdd mdict mdx

Last synced: 11 months ago
JSON representation

*.mdx/*.mdd interpreter csharp implements, support mdict index file

Awesome Lists containing this project

README

          

# MDict.Csharp

mdict (\*.mdd \*.mdx) file reader based on [terasum/js-mdict](https://github.com/terasum/js-mdict).

Thanks to [terasum](https://github.com/terasum).

## Usage

Use the `MdxDict` class to read \*.mdx files.

```csharp
using MDict.Csharp.Models;

var mdict = new MdxDict("resources/oald7.mdx");

var def = mdict.Lookup("ask");
Console.WriteLine(def.Definition);

/*
ask /ɑ:sk; NAmE æsk​/ verb
QUESTION 问题


1 ~ (sb) (about sb/ sth) to say or write sth in the form of a question, in order to get information 问;询问

[V speech]
'Where are you going?' she asked.
"你去哪里?"她问道。
[VN speech]
'Are you sure?' he asked her.
...

*/
```

Use the `MddDict` class to read \*.mdd files.

```csharp
using MDict.Csharp.Models;

var mdx = new MddDict("./tests/data/oale8.mdd");
Console.WriteLine(mdx.Locate("\\Logo.jpg"));

/*
$ git clone github.com/terasum/js-mdict
$ cd js-mdict
$ npx tsx ./example/oale8-mdd-example.ts

NOTE: the mdd's definition is base64 encoded bytes,
if your target is css/js content, please decode base64 and get the original text
if your target is images, you can use dataurl to show the images

{
keyText: '\\Logo.jpg',
definition: '/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQ...'
}
*/
```