Пример #1
0
        public static void OnBeforeScriptRead(HostedScriptEngine engine)
        {
            var cfg = engine.GetWorkingConfig();

            string openerEncoding = cfg["encoding.script"];

            if (!String.IsNullOrWhiteSpace(openerEncoding))
            {
                if (StringComparer.InvariantCultureIgnoreCase.Compare(openerEncoding, "default") == 0)
                {
                    engine.Loader.ReaderEncoding = FileOpener.SystemSpecificEncoding();
                }
                else
                {
                    engine.Loader.ReaderEncoding = Encoding.GetEncoding(openerEncoding);
                }
            }

            var strictWebRequest = ConvertSettingValueToBool(cfg["http.strictWebRequest"]);

            if (!strictWebRequest)
            {
                SetAllowUnsafeHeaderParsing();
            }
        }
Пример #2
0
        private void SetEncodingFromConfig(HostedScriptEngine engine)
        {
            var cfg = engine.GetWorkingConfig();

            string openerEncoding = cfg["encoding.script"];

            if (!String.IsNullOrWhiteSpace(openerEncoding) && StringComparer.InvariantCultureIgnoreCase.Compare(openerEncoding, "default") != 0)
            {
                engine.Loader.ReaderEncoding = Encoding.GetEncoding(openerEncoding);
            }
        }
Пример #3
0
        public static void OnBeforeScriptRead(HostedScriptEngine engine)
        {
            var cfg = engine.GetWorkingConfig();

            string openerEncoding = cfg["encoding.script"];

            if (!String.IsNullOrWhiteSpace(openerEncoding))
            {
                if (StringComparer.InvariantCultureIgnoreCase.Compare(openerEncoding, "default") == 0)
                {
                    engine.Loader.ReaderEncoding = FileOpener.SystemSpecificEncoding();
                }
                else
                {
                    engine.Loader.ReaderEncoding = Encoding.GetEncoding(openerEncoding);
                }
            }
        }