Esempio n. 1
0
        /// <summary>
        /// Saves the contents of the dictionary to a file at the specified path.
        /// </summary>
        /// <param name="path">The path to the file to save.</param>
        /// <param name="useDiffmark">Specifies whether to generate Diffmarked entries.</param>
        public void Save(string path, bool useDiffmark = false)
        {
            using (var writer = new StreamWriter(path))
            {
                writer.WriteLine("#name {0}", Name);
                writer.WriteLine("#subs {0}", Subtypes.Aggregate((c, n) => c + " " + n));
                foreach (string hiddenClass in _hidden)
                {
                    writer.WriteLine($"#hidden {hiddenClass}");
                }
                // TODO: Export types for tables
                writer.WriteLine();

                WriteEntries(writer, _entriesHash, useDiffmark);
            }
        }
        /// <summary>
        /// Saves the contents of the dictionary to a file at the specified path.
        /// </summary>
        /// <param name="path">The path to the file to save.</param>
        public void Save(string path)
        {
            using (var writer = new StreamWriter(path))
            {
                writer.WriteLine("#version {0}", Version);
                writer.WriteLine("#name {0}", Name);
                writer.WriteLine("#subs {0}", Subtypes.Aggregate((c, n) => c + " " + n));
                writer.WriteLine();

                var entriesClean = GetEntries().Where(entry => !entry.NSFW);
                var entriesDirty = GetEntries().Where(entry => entry.NSFW);

                WriteEntries(writer, entriesClean);
                if (entriesDirty.Any())
                {
                    writer.WriteLine();
                    writer.WriteLine("#nsfw");
                    writer.WriteLine();
                    WriteEntries(writer, entriesDirty);
                }
            }
        }