IntToHex() 정적인 개인적인 메소드

static private IntToHex ( int n, char hex ) : void
n int
hex char
리턴 void
예제 #1
0
        // Token: 0x0600109E RID: 4254 RVA: 0x00061E94 File Offset: 0x00060094
        private void PutString(string str)
        {
            this.Put(string.Empty);
            this.writer.Write('"');
            int length = str.Length;
            int i      = 0;

            while (i < length)
            {
                char c = str[i];
                switch (c)
                {
                case '\b':
                    this.writer.Write("\\b");
                    break;

                case '\t':
                    this.writer.Write("\\t");
                    break;

                case '\n':
                    this.writer.Write("\\n");
                    break;

                case '\v':
                    goto IL_E4;

                case '\f':
                    this.writer.Write("\\f");
                    break;

                case '\r':
                    this.writer.Write("\\r");
                    break;

                default:
                    if (c != '"' && c != '\\')
                    {
                        goto IL_E4;
                    }
                    this.writer.Write('\\');
                    this.writer.Write(str[i]);
                    break;
                }
IL_141:
                i++;
                continue;
IL_E4:
                if (str[i] >= ' ' && str[i] <= '~')
                {
                    this.writer.Write(str[i]);
                    goto IL_141;
                }
                JsonWriter.IntToHex((int)str[i], this.hex_seq);
                this.writer.Write("\\u");
                this.writer.Write(this.hex_seq);
                goto IL_141;
            }
            this.writer.Write('"');
        }
예제 #2
0
        private void PutString(string str)
        {
            this.Put(string.Empty);
            this.writer.Write('"');
            int length = str.Length;

            for (int i = 0; i < length; i++)
            {
                char c = str[i];
                switch (c)
                {
                case '\b':
                    this.writer.Write("\\b");
                    break;

                case '\t':
                    this.writer.Write("\\t");
                    break;

                case '\n':
                    this.writer.Write("\\n");
                    break;

                default:
                    if (c != '"' && c != '\\')
                    {
                        if (str[i] >= ' ' && str[i] <= '~')
                        {
                            this.writer.Write(str[i]);
                        }
                        else
                        {
                            JsonWriter.IntToHex((int)str[i], this.hex_seq);
                            this.writer.Write("\\u");
                            this.writer.Write(this.hex_seq);
                        }
                    }
                    else
                    {
                        this.writer.Write('\\');
                        this.writer.Write(str[i]);
                    }
                    break;

                case '\f':
                    this.writer.Write("\\f");
                    break;

                case '\r':
                    this.writer.Write("\\r");
                    break;
                }
            }
            this.writer.Write('"');
        }
예제 #3
0
        private void PutString(string str, bool toHex = true)
        {
            this.Put(string.Empty);
            this.writer.Write('"');
            int length = str.Length;

            for (int index = 0; index < length; ++index)
            {
                switch (str[index])
                {
                case '\b':
                    this.writer.Write("\\b");
                    break;

                case '\t':
                    this.writer.Write("\\t");
                    break;

                case '\n':
                    this.writer.Write("\\n");
                    break;

                case '\f':
                    this.writer.Write("\\f");
                    break;

                case '\r':
                    this.writer.Write("\\r");
                    break;

                case '"':
                case '\\':
                    this.writer.Write('\\');
                    this.writer.Write(str[index]);
                    break;

                default:
                    if (str[index] >= ' ' && str[index] <= '~')
                    {
                        this.writer.Write(str[index]);
                        break;
                    }
                    if (toHex)
                    {
                        JsonWriter.IntToHex((int)str[index], this.hex_seq);
                        this.writer.Write("\\u");
                        this.writer.Write(this.hex_seq);
                        break;
                    }
                    this.writer.Write(str[index]);
                    break;
                }
            }
            this.writer.Write('"');
        }
예제 #4
0
        private void PutString(string str)
        {
            this.Put(string.Empty);
            this.writer.Write('"');
            int length = str.Length;

            for (int i = 0; i < length; i++)
            {
                char c = str[i];
                switch (c)
                {
                case '\b':
                    this.writer.Write("\\b");
                    goto IL_156;

                case '\t':
                    this.writer.Write("\\t");
                    goto IL_156;

                case '\n':
                    this.writer.Write("\\n");
                    goto IL_156;

                case '\v':
IL_4E:
                    if (c == '"' || c == '\\')
                    {
                        this.writer.Write('\\');
                        this.writer.Write(str[i]);
                        goto IL_156;
                    }
                    if (str[i] >= ' ' && str[i] <= '~')
                    {
                        this.writer.Write(str[i]);
                        goto IL_156;
                    }
                    JsonWriter.IntToHex((int)str[i], this.hex_seq);
                    this.writer.Write("\\u");
                    this.writer.Write(this.hex_seq);
                    goto IL_156;

                case '\f':
                    this.writer.Write("\\f");
                    goto IL_156;

                case '\r':
                    this.writer.Write("\\r");
                    goto IL_156;
                }
                goto IL_4E;
                IL_156 :;
            }
            this.writer.Write('"');
        }