Beispiel #1
0
        /// <summary>
        /// Gets a sentence stream writer object for the language.
        /// </summary>
        /// <param name="language">Specifies a language.</param>
        /// <returns>Returns a valid sentence writer object.</returns>
        private SntWriter GetWriter(string language)
        {
            language = language.ToLower();

            Debug.Assert(!string.IsNullOrEmpty(language), "language is empty");
            SntWriter writer = null;

            if (this.sntWriters.ContainsKey(language))
            {
                writer = this.sntWriters[language];
            }
            else
            {
                Debug.Assert(!string.IsNullOrEmpty(this.fileName), "base file name is empty");
                Debug.Assert(this.sntWriters != null, "Snt writer container is null");

                string filePath = string.Format("{0}_{1}{2}", this.fileName, language, this.extension);

                writer = new SntWriter(filePath);
                this.sntWriters.Add(language.ToLower(), writer);
            }

            Debug.Assert(writer != null, "writer object is null");
            return(writer);
        }
        /// <summary>
        /// Gets a sentence stream writer object for the language.  
        /// </summary>
        /// <param name="language">Specifies a language.</param>
        /// <returns>Returns a valid sentence writer object.</returns>
        private SntWriter GetWriter(string language)
        {
            language = language.ToLower();

            Debug.Assert(!string.IsNullOrEmpty(language), "language is empty");
            SntWriter writer = null;

            if (this.sntWriters.ContainsKey(language))
            {
                writer = this.sntWriters[language];
            }
            else
            {
                Debug.Assert(!string.IsNullOrEmpty(this.fileName), "base file name is empty");
                Debug.Assert(this.sntWriters != null, "Snt writer container is null");

                string filePath = string.Format("{0}_{1}{2}", this.fileName, language, this.extension);

                writer = new SntWriter(filePath);
                this.sntWriters.Add(language.ToLower(), writer);
            }

            Debug.Assert(writer != null, "writer object is null");
            return writer;
        }