public static MappingDictionary ParseText(
            IList <string> fieldIDs,
            TextMappingParser parser)
        {
            MemoryStream memoryStream = new MemoryStream();

            try
            {
                StreamWriter streamWriter = new StreamWriter((Stream)memoryStream);
                try
                {
                    foreach (string fieldId in (IEnumerable <string>)fieldIDs)
                    {
                        streamWriter.WriteLine(fieldId);
                    }
                    streamWriter.Flush();
                    return(MappingDictionary.ParseText((Stream)memoryStream, parser));
                }
                finally
                {
                    streamWriter?.Close();
                }
            }
            finally
            {
                memoryStream?.Close();
            }
        }
        public static MappingDictionary ParseText(
            Assembly assembly,
            string resName,
            TextMappingParser parser)
        {
            Stream manifestResourceStream = assembly.GetManifestResourceStream(resName);

            try
            {
                return(MappingDictionary.ParseText(manifestResourceStream, parser));
            }
            finally
            {
                manifestResourceStream?.Close();
            }
        }
        public static MappingDictionary ParseText(
            string fileName,
            TextMappingParser parser)
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException(string.Format("Can't find mapping file:{0}", (object)fileName));
            }
            FileStream fileStream = File.OpenRead(fileName);

            try
            {
                return(MappingDictionary.ParseText((Stream)fileStream, parser));
            }
            finally
            {
                fileStream?.Close();
            }
        }