示例#1
0
        private Encoding GetEncoding(string sourceFile, VariableDictionary variables)
        {
            var requestedEncoding = variables.Get(SpecialVariables.Package.SubstituteInFilesOutputEncoding);

            if (requestedEncoding == null)
            {
                return(fileSystem.GetFileEncoding(sourceFile));
            }

            try
            {
                return(Encoding.GetEncoding(requestedEncoding));
            }
            catch (ArgumentException)
            {
                return(fileSystem.GetFileEncoding(sourceFile));
            }
        }