Exemplo n.º 1
0
        public Anki(string name, ApkgFile file)
        {
            _cardsMetadatas  = new Queue <CardMetadata>();
            _revLogMetadatas = new List <RevLogMetadata>();

            _assembly = Assembly.GetExecutingAssembly();
            _path     = Path.Combine(Path.GetDirectoryName(_assembly.Location) ?? throw new InvalidOperationException(), "tmp");

            if (Directory.Exists(_path) == false)
            {
                Directory.CreateDirectory(_path);
            }

            Init(_path, name);

            _collectionFilePath = Path.Combine(_path, "collection.db");

            ReadApkgFile(file.Path());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create anki object from an Apkg file
        /// </summary>
        /// <param name="name">Specify the name of apkg file and deck</param>
        /// <param name="file">Apkg file</param>
        public Anki(string name, ApkgFile file, MediaInfo info = null)
        {
            _cardsMetadatas  = new Queue <CardMetadata>();
            _revLogMetadatas = new List <RevLogMetadata>();

            _assembly = Assembly.GetExecutingAssembly();
            _path     = Path.Combine(Path.GetDirectoryName(_assembly.Location), "tmp");

            _mediaInfo = info;

            if (Directory.Exists(_path) == false)
            {
                Directory.CreateDirectory(_path);
            }

            Init(_path, name);

            _collectionFilePath = Path.Combine(_path, "collection.db");

            ReadApkgFile(file.Path());
        }