System.Yaml.YamlDoubleQuoteEscaping.YamlDoubleQuoteEscaping C# (CSharp) Méthode

YamlDoubleQuoteEscaping() static private méthode

Initialize tables
static private YamlDoubleQuoteEscaping ( ) : System.Collections.Generic
Résultat System.Collections.Generic
        static YamlDoubleQuoteEscaping()
        {
            // Create (additional) escaping table
            escapeTable['\\'] = @"\\";
            escapeTable['"'] = "\\\"";
            escapeTable['/'] = @"\/";
            escapeTable['\x85'] = @"\N";
            escapeTable['\xa0'] = @"\_";
            escapeTable['\u2028'] = @"\L";
            escapeTable['\u2029'] = @"\P";

            // Create escaping regexp
            escapeRegexp = new Regex(@"[\x00-\x1f\/\x85\xa0\u2028\u2029" + "\"]");
            escapeNonprintable = new Regex(@"[\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]");

            // Create unescaping table
            for ( char c = '\0'; c < controlCodes.Length; c++ )
                unescapeTable[controlCodes[c]] = c.ToString();
            foreach ( var c in escapeTable.Keys )
                unescapeTable[escapeTable[c]] = c.ToString();

            // Create unescaping regex
            var pattern = "";
            unescapeTable.Keys.ToList().ForEach(esc => {
                if ( pattern != "" )
                    pattern += "|";
                pattern += Regex.Escape(esc);
            });
            unescapeRegexp = new Regex(pattern +
                @"|\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}");
        }