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
- Host: GitHub
- URL: https://github.com/jack251970/mdict.csharp
- Owner: Jack251970
- License: mit
- Created: 2025-07-04T04:58:29.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-05T03:00:54.000Z (12 months ago)
- Last Synced: 2025-07-05T03:07:00.159Z (12 months ago)
- Topics: csharp, dictionary, glodendict, mdd, mdict, mdx
- Language: C#
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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...'
}
*/
```