示例#1
0
        public static Tokenizer.StringMaker GetSharedStringMaker()
        {
            Tokenizer.StringMaker maker = null;
            bool tookLock = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.ReliableEnter(_sharedStatics, ref tookLock);
                if (_sharedStatics._maker != null)
                {
                    maker = _sharedStatics._maker;
                    _sharedStatics._maker = null;
                }
            }
            finally
            {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }
            if (maker == null)
            {
                maker = new Tokenizer.StringMaker();
            }
            return(maker);
        }
示例#2
0
        public static Tokenizer.StringMaker GetSharedStringMaker()
        {
            Tokenizer.StringMaker stringMaker = (Tokenizer.StringMaker)null;
            bool lockTaken = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.Enter((object)SharedStatics._sharedStatics, ref lockTaken);
                if (SharedStatics._sharedStatics._maker != null)
                {
                    stringMaker = SharedStatics._sharedStatics._maker;
                    SharedStatics._sharedStatics._maker = (Tokenizer.StringMaker)null;
                }
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit((object)SharedStatics._sharedStatics);
                }
            }
            if (stringMaker == null)
            {
                stringMaker = new Tokenizer.StringMaker();
            }
            return(stringMaker);
        }
示例#3
0
        // Token: 0x06001C0B RID: 7179 RVA: 0x00060884 File Offset: 0x0005EA84
        public string GetString(ref int position, bool bCreate)
        {
            int i;

            for (i = position; i < this.m_data.Length - 1; i += 2)
            {
                if (this.m_data[i] == 0 && this.m_data[i + 1] == 0)
                {
                    break;
                }
            }
            Tokenizer.StringMaker sharedStringMaker = SharedStatics.GetSharedStringMaker();
            string result;

            try
            {
                if (bCreate)
                {
                    sharedStringMaker._outStringBuilder = null;
                    sharedStringMaker._outIndex         = 0;
                    for (int j = position; j < i; j += 2)
                    {
                        char c = (char)((int)this.m_data[j] << 8 | (int)this.m_data[j + 1]);
                        if (sharedStringMaker._outIndex < 512)
                        {
                            char[] outChars = sharedStringMaker._outChars;
                            Tokenizer.StringMaker stringMaker = sharedStringMaker;
                            int outIndex = stringMaker._outIndex;
                            stringMaker._outIndex = outIndex + 1;
                            outChars[outIndex]    = c;
                        }
                        else
                        {
                            if (sharedStringMaker._outStringBuilder == null)
                            {
                                sharedStringMaker._outStringBuilder = new StringBuilder();
                            }
                            sharedStringMaker._outStringBuilder.Append(sharedStringMaker._outChars, 0, 512);
                            sharedStringMaker._outChars[0] = c;
                            sharedStringMaker._outIndex    = 1;
                        }
                    }
                }
                position = i + 2;
                if (bCreate)
                {
                    result = sharedStringMaker.MakeString();
                }
                else
                {
                    result = null;
                }
            }
            finally
            {
                SharedStatics.ReleaseSharedStringMaker(ref sharedStringMaker);
            }
            return(result);
        }
示例#4
0
        public string GetString(ref int position, bool bCreate)
        {
            int index1 = position;

            while (index1 < this.m_data.Length - 1 && ((int)this.m_data[index1] != 0 || (int)this.m_data[index1 + 1] != 0))
            {
                index1 += 2;
            }
            Tokenizer.StringMaker sharedStringMaker = SharedStatics.GetSharedStringMaker();
            try
            {
                if (bCreate)
                {
                    sharedStringMaker._outStringBuilder = (StringBuilder)null;
                    sharedStringMaker._outIndex         = 0;
                    int index2 = position;
                    while (index2 < index1)
                    {
                        char ch = (char)((uint)this.m_data[index2] << 8 | (uint)this.m_data[index2 + 1]);
                        if (sharedStringMaker._outIndex < 512)
                        {
                            char[] chArray = sharedStringMaker._outChars;
                            Tokenizer.StringMaker stringMaker = sharedStringMaker;
                            int num1 = stringMaker._outIndex;
                            int num2 = num1 + 1;
                            stringMaker._outIndex = num2;
                            int index3 = num1;
                            int num3   = (int)ch;
                            chArray[index3] = (char)num3;
                        }
                        else
                        {
                            if (sharedStringMaker._outStringBuilder == null)
                            {
                                sharedStringMaker._outStringBuilder = new StringBuilder();
                            }
                            sharedStringMaker._outStringBuilder.Append(sharedStringMaker._outChars, 0, 512);
                            sharedStringMaker._outChars[0] = ch;
                            sharedStringMaker._outIndex    = 1;
                        }
                        index2 += 2;
                    }
                }
                position = index1 + 2;
                if (bCreate)
                {
                    return(sharedStringMaker.MakeString());
                }
                return((string)null);
            }
            finally
            {
                SharedStatics.ReleaseSharedStringMaker(ref sharedStringMaker);
            }
        }
示例#5
0
        public string GetString(ref int position, bool bCreate)
        {
            string str;
            int    index = position;

            while (index < (this.m_data.Length - 1))
            {
                if ((this.m_data[index] == 0) && (this.m_data[index + 1] == 0))
                {
                    break;
                }
                index += 2;
            }
            Tokenizer.StringMaker sharedStringMaker = SharedStatics.GetSharedStringMaker();
            try
            {
                if (bCreate)
                {
                    sharedStringMaker._outStringBuilder = null;
                    sharedStringMaker._outIndex         = 0;
                    for (int i = position; i < index; i += 2)
                    {
                        char ch = (char)((this.m_data[i] << 8) | this.m_data[i + 1]);
                        if (sharedStringMaker._outIndex < 0x200)
                        {
                            sharedStringMaker._outChars[sharedStringMaker._outIndex++] = ch;
                        }
                        else
                        {
                            if (sharedStringMaker._outStringBuilder == null)
                            {
                                sharedStringMaker._outStringBuilder = new StringBuilder();
                            }
                            sharedStringMaker._outStringBuilder.Append(sharedStringMaker._outChars, 0, 0x200);
                            sharedStringMaker._outChars[0] = ch;
                            sharedStringMaker._outIndex    = 1;
                        }
                    }
                }
                position = index + 2;
                if (bCreate)
                {
                    return(sharedStringMaker.MakeString());
                }
                str = null;
            }
            finally
            {
                SharedStatics.ReleaseSharedStringMaker(ref sharedStringMaker);
            }
            return(str);
        }
示例#6
0
        public static void ReleaseSharedStringMaker(ref Tokenizer.StringMaker maker)
        {
            bool lockTaken = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.Enter((object)SharedStatics._sharedStatics, ref lockTaken);
                SharedStatics._sharedStatics._maker = maker;
                maker = (Tokenizer.StringMaker)null;
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit((object)SharedStatics._sharedStatics);
                }
            }
        }
        public static void ReleaseSharedStringMaker(ref Tokenizer.StringMaker maker)
        {
            bool flag = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.Enter(SharedStatics._sharedStatics, ref flag);
                SharedStatics._sharedStatics._maker = maker;
                maker = null;
            }
            finally
            {
                if (flag)
                {
                    Monitor.Exit(SharedStatics._sharedStatics);
                }
            }
        }
示例#8
0
        public static void ReleaseSharedStringMaker(ref Tokenizer.StringMaker maker)
        {
            bool tookLock = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.ReliableEnter(_sharedStatics, ref tookLock);
                _sharedStatics._maker = maker;
                maker = null;
            }
            finally
            {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }
        }
示例#9
0
        public static Tokenizer.StringMaker GetSharedStringMaker() => default;         // 0x00000001808BFD70-0x00000001808BFF90

        public static void ReleaseSharedStringMaker(ref Tokenizer.StringMaker maker)
        {
        }                                                                                       // 0x00000001808BFF90-0x00000001808C00F0