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); }
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); }