AnkiSharp
1.0.0
?终于来了!您可以从C#应用程序自动创建ANKI卡。 ?
我正在寻找一些开发人员开发Java,JavaScript和Python版本,如果您对此有兴趣,请在此处与我联系:https://clement-jean.github.io/contact/
您可以在此处找到一个待办事项清单:待办事项列表
Ankisharp使用Sourcelink(https://github.com/dotnet/sourcelink)。它可以帮助您使用此Nuget调试程序。
如果您遇到来自Ankisharp的例外:
- Put a breakpoint on the function which as a problem
- Once on the breakpoint, click on the 'Step Into' button (F11)
然后,您将在Ankisharp Nuget代码中重定向。最后,请报告问题并开始贡献。
这个回购是Wiki:Wiki。您可以单独查看任何功能,或单击每个页面末尾的下一个链接。
AnkiSharp . Anki test = new AnkiSharp . Anki ( _NAME_OF_ANKI_PACKAGE_ ) ;
test . AddItem ( "Hello" , "Bonjour" ) ;
test . AddItem ( "How are you ?" , "Comment ca va ?" ) ;
test . AddItem ( "Flower" , "fleur" ) ;
test . AddItem ( "House" , "Maison" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; AnkiSharp . Anki test = new AnkiSharp . Anki ( _NAME_OF_ANKI_PACKAGE_ ) ;
//Permits to set more than two fields
test . SetFields ( "English" , "Spanish" , "French" ) ;
test . AddItem ( "Hello" , "Hola" , "Bonjour" ) ;
test . AddItem ( "How are you ?" , "Como estas?" , "Comment ca va ?" ) ;
test . AddItem ( "Flower" , "flor" , "fleur" ) ;
test . AddItem ( "House" , "Casa" , "Maison" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; AnkiSharp . Anki test = new AnkiSharp . Anki ( _NAME_OF_ANKI_PACKAGE_ ) ;
//Permits to change the css of your cards by providing it a css string
test . SetCss ( _CSS_CONTENT_ ) ;
test . AddItem ( "Hello" , "Bonjour" ) ;
test . AddItem ( "How are you ?" , "Comment ca va ?" ) ;
test . AddItem ( "Flower" , "fleur" ) ;
test . AddItem ( "House" , "Maison" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; AnkiSharp . Anki test = new AnkiSharp . Anki ( _NAME_OF_ANKI_PACKAGE_ ) ;
test . SetFields ( "English" , "Spanish" , "French" ) ;
//Everything before '<hr id=answer>' is the front of the card, everything after is the behind
test . SetFormat ( "{0} - {1} \ n<hr id=answer> \ n {2}" ) ;
test . AddItem ( "Hello" , "Hola" , "Bonjour" ) ;
test . AddItem ( "How are you ?" , "Como estas?" , "Comment ca va ?" ) ;
test . AddItem ( "Flower" , "Flor" , "fleur" ) ;
test . AddItem ( "House" , "Casa" , "Maison" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; Anki test = new Anki ( _NAME_OF_ANKI_PACKAGE_ , new ApkgFile ( _PATH_TO_APKG_FILE_ ) ) ) ;
// Be careful, keep the same format !
test . AddItem ( "Fork" , "El tenedor" , "La fourchette" ) ;
test . AddItem ( "Knife" , "El cuchillo" , "Le couteau" ) ;
test . AddItem ( "Chopsticks" , "Los palillos" , "Les baguettes" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; Anki test = new Anki ( _NAME_OF_ANKI_PACKAGE_ , new ApkgFile ( _PATH_TO_APKG_FILE_ ) ) ;
// Be careful, keep the same fields !
var item = test . CreateAnkiItem ( ( "Fork" , "El tenedor" , "La fourchette" ) ;
if ( test . ContainsItem ( ankiItem ) == false ) // will not add if the card is entirely the same (same fields' value)
test . AddItem ( ankiItem ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; Anki test = new Anki ( _NAME_OF_ANKI_PACKAGE_ , new ApkgFile ( _PATH_TO_APKG_FILE_ ) ) ;
var item = test . CreateAnkiItem ( "Hello" , "Bonjour" ) ;
if ( test . ContainsItem ( x => { return Equals ( item [ "FrontSide" ] , x [ "FrontSide" ] ) ; } ) == false ) // will not add if front of the card already exists
test . AddItem ( item ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ; MediaInfo info = new MediaInfo ( )
{
cultureInfo = new System . Globalization . CultureInfo ( _CULTURE_INFO_STRING_ ) ,
field = _FIELD_IN_WHICH_THE_AUDIO_WILL_BE_PLAYED_
} ;
Anki ankiObject = new Anki ( _NAME_OF_ANKI_PACKAGE_ , info ) ;
.. .当前的音频具有每秒8000的样品,每个样品16位,在单通道中。如果您想更改它,则可以这样做(请注意,质量迅速增加或减小甲板的大小):
MediaInfo info = new MediaInfo ( )
{
cultureInfo = new System . Globalization . CultureInfo ( _CULTURE_INFO_STRING_ ) ,
field = _FIELD_IN_WHICH_THE_AUDIO_WILL_BE_PLAYED_ ,
audioFormat = new SpeechAudioFormatInfo ( _SAMPLES_PER_SECOND_ , _BITS_PER_SAMPLE_ , _AUDIO_CHANNEL_ )
} ;
Anki ankiObject = new Anki ( _NAME_OF_ANKI_PACKAGE_ , info ) ;
.. . Anki test = new Anki ( _NAME_OF_ANKI_PACKAGE_ ) ;
test . SetFields ( "Front" , "hint:Hint" , "Back" ) ;
test . SetFormat ( "{0} - {1} \ n<hr id=answer(.*?)> \ n {2}" ) ;
test . AddItem ( "好的" , "ok" , "d'accord" ) ;
test . CreateApkgFile ( _PATH_FOR_ANKI_FILE_ ) ;