コード例 #1
0
 public abstract bool SaveDictionary(Stream stream, Dictionary dictionary, SettingsBase options = null);
コード例 #2
0
        public override bool SaveDictionary(Stream stream,
                                            Dictionary dictionary,
                                            SettingsBase options = null)
        {
            try
            {
                // let's begin by writing the file's header.
                stream.Write(FieldHeaders.DictionaryMagicNumber, 0, FieldHeaders.DictionaryMagicNumber.Length);
                stream.Write(FieldHeaders.ByteOrderMark, 0, FieldHeaders.ByteOrderMark.Length);
                stream.Write(FieldHeaders.VersionMark, 0, FieldHeaders.VersionMark.Length);

                // now let's first begin by writing the dictionary's
                // info.
                _Write(stream, dictionary.Info);

                // now that that's done, let's write the abbreviations.
                foreach (var abbrev in dictionary.Abbreviations)
                    _Write(stream, abbrev);

                // now let's write the entries.
                foreach (var entry in dictionary.Entries)
                    _Write(stream, entry);

                // finally, let's write the images.
                foreach (var img in dictionary.Images)
                    _Write(stream, img);

                // finally, since we expect that everything's written
                // to the output stream.
                return true;
            }
            catch (IOException)
            {
                return false;
            }
        }