예제 #1
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public StringMaker GetSharedStringMaker()
        {
            StringMaker maker = null;

            bool tookLock = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                Monitor.Enter(_sharedStatics, ref tookLock);

                if (_sharedStatics._maker != null)
                {
                    maker = _sharedStatics._maker;
                    _sharedStatics._maker = null;
                }
            }
            finally {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }

            if (maker == null)
            {
                maker = new StringMaker();
            }

            return(maker);
        }
예제 #2
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public void ReleaseSharedStringMaker(ref StringMaker maker)
        {
            // save this stringmaker so someone else can use it
            bool tookLock = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.Enter(_sharedStatics, ref tookLock);

                _sharedStatics._maker = maker;
                maker = null;
            }
            finally {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }
        }
예제 #3
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public StringMaker GetSharedStringMaker()
        {
            StringMaker maker = null;
            
            bool tookLock = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                Monitor.Enter(_sharedStatics, ref tookLock);

                if (_sharedStatics._maker != null)
                {
                    maker = _sharedStatics._maker;
                    _sharedStatics._maker = null;
                }
            }
            finally {
                if (tookLock)
                    Monitor.Exit(_sharedStatics);
            }
            
            if (maker == null)
            {
                maker = new StringMaker();
            }
            
            return maker;
        }
예제 #4
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public void ReleaseSharedStringMaker(ref StringMaker maker)
        {
            // save this stringmaker so someone else can use it
            bool tookLock = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                Monitor.Enter(_sharedStatics, ref tookLock);

                _sharedStatics._maker = maker;
                maker = null;
            }
            finally {
                if (tookLock)
                    Monitor.Exit(_sharedStatics);
            }
        }
        public String GetString(ref int position, bool bCreate)
        {
            int  stringEnd;
            bool bFoundEnd = false;

            for (stringEnd = position; stringEnd < m_data.Length - 1; stringEnd += 2)
            {
                if (m_data[stringEnd] == 0 && m_data[stringEnd + 1] == 0)
                {
                    bFoundEnd = true;
                    break;
                }
            }

            Contract.Assert(bFoundEnd, "Malformed string in parse data");

            StringMaker m = System.SharedStatics.GetSharedStringMaker();

            try
            {
                if (bCreate)
                {
                    m._outStringBuilder = null;
                    m._outIndex         = 0;

                    for (int i = position; i < stringEnd; i += 2)
                    {
                        char c = (char)(m_data[i] << 8 | m_data[i + 1]);

                        // add character  to the string
                        if (m._outIndex < StringMaker.outMaxSize)
                        {
                            // easy case
                            m._outChars[m._outIndex++] = c;
                        }
                        else
                        {
                            if (m._outStringBuilder == null)
                            {
                                // OK, first check if we have to init the StringBuilder
                                m._outStringBuilder = new StringBuilder();
                            }

                            // OK, copy from _outChars to _outStringBuilder
                            m._outStringBuilder.Append(m._outChars, 0, StringMaker.outMaxSize);

                            // reset _outChars pointer
                            m._outChars[0] = c;
                            m._outIndex    = 1;
                        }
                    }
                }

                position = stringEnd + 2;

                if (bCreate)
                {
                    return(m.MakeString());
                }
                else
                {
                    return(null);
                }
            }
            finally
            {
                System.SharedStatics.ReleaseSharedStringMaker(ref m);
            }
        }
예제 #6
0
		static public void ReleaseSharedStringMaker (ref StringMaker maker)
		{

		}
예제 #7
0
 static public void ReleaseSharedStringMaker(ref StringMaker maker)
 {
 }