예제 #1
0
        private static RESOURCE_STRING ReadStringOrID(BinaryReader fhIn)
        {
            // Reads a String structure from fhIn
            // If the first word is 0xFFFF then this is an ID
            // return the ID instead

            RESOURCE_STRING pstring = new RESOURCE_STRING();

            WCHAR firstWord = fhIn.ReadChar();

            if (firstWord == 0xFFFF)
            {
                // An ID

                pstring.Ordinal = fhIn.ReadUInt16();
            }
            else
            {
                // A string
                pstring.Ordinal = 0xFFFF;

                //keep reading until null reached.

                StringBuilder sb = new StringBuilder();

                WCHAR curChar = firstWord;

                do
                {
                    sb.Append(curChar);
                    curChar = fhIn.ReadChar();
                }while (curChar != 0);


                pstring.theString = sb.ToString();
            }

            return(pstring);
        }
예제 #2
0
파일: CvtRes.cs 프로젝트: GloryChou/roslyn
        private static RESOURCE_STRING ReadStringOrID(BinaryReader fhIn)
        {
            // Reads a String structure from fhIn
            // If the first word is 0xFFFF then this is an ID
            // return the ID instead

            RESOURCE_STRING pstring = new RESOURCE_STRING();

            WCHAR firstWord = fhIn.ReadChar();

            if (firstWord == 0xFFFF)
            {
                // An ID

                pstring.Ordinal = fhIn.ReadUInt16();
            }
            else
            {
                // A string
                pstring.Ordinal = 0xFFFF;

                //keep reading until null reached.

                StringBuilder sb = new StringBuilder();

                WCHAR curChar = firstWord;

                do
                {
                    sb.Append(curChar);
                    curChar = fhIn.ReadChar();
                }
                while (curChar != 0);


                pstring.theString = sb.ToString();
            }

            return (pstring);
        }