Exemple #1
0
        /// <summary>
        /// End-of-line conversion with specific encoding.
        /// </summary>
        /// <param name="somePath"></param>
        /// <param name="encoder"></param>
        public static void ConvertToCrLf(string somePath, Encoding encoder)
        {
            if (String.IsNullOrWhiteSpace(somePath))
            {
                return;
            }
            if (!File.Exists(somePath))
            {
                return;
            }

            var fileContent = File.ReadAllText(somePath);

            fileContent = NfString.ConvertToCrLf(fileContent);

            File.WriteAllText(somePath, fileContent, encoder);
        }