예제 #1
0
파일: NfPath.cs 프로젝트: nofuture-git/31g
        /// <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);
        }