//-------------------------------------------------------------------------------
  //    Name           : GetUniStrInvalidAnsi
  //    Purpose        : To return a string of Unicode characters. These unicode characters
  //                        are random invalid ansi characters when converted to ansi.
  //    Inputs         : iMaxChar -- maximum number of character to be generated
  //                   : bAbsolute -- if set true, exact number (iMaxChar) will be generated,
  //                        if set falise, number of generated chars will be random.
  //                   : intCodeType -- Type of conversion to make. 
  //                   : enulcidType -- Current Locale ID.
  //-------------------------------------------------------------------------------
  public String GetUniStrInvalidAnsi(int iMaxChar, bool bAbsolute, enuCodeType intCodeType, enuLCIDList enulcidType ){
  String strText; 

  int iOldLCID = iCurrentLCID ;
  VerifyLCIDAndLoadResource( (int)enulcidType );                                                  
            
  if ( iMaxChar <= 0 )  // If the string length is <= zero, return an empty string
    return String.Empty;

  if ((int)intCodeType < 0 || (int)intCodeType > 3)  // invalid conversion type
    intCodeType = enuCodeType.CURRENT;

  strText = RetrieveSectionInfo( enuDataSectionTypes.RANDOM_INVALID_ANSI_CHAR, true  );
  strText = RemoveAdditionalnfoChars(strText);  // Remove all the line feeds, carriage return and the additional information that we have each char.

  strText = strText.Replace( "\r\n" , "" );  // Remove all the line feeds and carriage return characters from the data.

  VerifyLCIDAndLoadResource( iOldLCID  );
            
  return strText ;
  }              
  //-------------------------------------------------------------------------------
  //    Name           : GetUniStrMappedAnsi
  //    Purpose        : To return a string of Unicode characters. These unicode characters
  //                        are random valid ansi characters when converted to ansi.
  //    Inputs         : iMaxChar -- maximum number of character to be generated
  //                   : bAbsolute -- if set true, exact number (iMaxChar) will be generated,
  //                        if set falise, number of generated chars will be random.
  //                   : intType -- Type of conversion to make. 
  //                   : enulcidType -- Locale id.
  //-------------------------------------------------------------------------------
  public String GetUniStrMappedAnsi(Int16 iMaxChar, bool bAbsolute, enuCodeType intCodeType, enuLCIDList enuLCIDType ){
  String strText; 

  // always ansi characters are mapped to unicode. Runtime supports unicode characters, We don't need this method
  // any more.
  int iOldLCID = iCurrentLCID ;
  VerifyLCIDAndLoadResource( (int)enuLCIDType );                                                  
            
  if ((int)intCodeType < 0 || (int)intCodeType > 3)  // invalid conversion type
    intCodeType = enuCodeType.CODE_UNI;

  strText = GetRandStrLCID( iMaxChar, bAbsolute, false, enuLCIDType );
        
  VerifyLCIDAndLoadResource( iOldLCID  );
            
  return strText ;
  }
    public String GetUniStrRandAnsi(int iMaxChar, bool bAbsolute, bool bValidate, enuCodeType intCodeType, enuLCIDList enulcidType, bool bNoLeadNum ){
  String strText; 
            
  int iOldLCID = iCurrentLCID ;
  VerifyLCIDAndLoadResource( (int)enulcidType );                                                  
            
  if ((int)intCodeType < 0 || (int)intCodeType > 3)  // invalid conversion type
    intCodeType = enuCodeType.CODE_UNI;

  // Even if you read a string from UTF8 encoding file the string is always unicode. We cann't really 
  // do much here. Just return the string not to break the existing testcases,
  strText = GetString( iMaxChar, bAbsolute, bValidate, false );

  VerifyLCIDAndLoadResource( iOldLCID  );
                        
  return strText ;
  }
  //-------------------------------------------------------------------------------
  //    Name           : GetUniStrRandAnsiBytes
  //    Purpose        : This function returns a Byte array of Unicode,UTF7 or UTF8 characters.
  //    Inputs         : iMaxChar -- maximum number of character to be generated
  //                   : bAbsolute -- if set true, exact number (iMaxChar) will be generated,
  //                       if set falise, number of generated chars will be random.
  //                   : bValidate -- boolean, if true, verify generated characters are valid
  //                       if false, does not verify generated characters
  //                   : intType -- Type of conversion to make. CODE_UNI, CODE_UTF7, CODE_UTF8.
  //    Note           : enulcidType -- Locale ID.
  //-------------------------------------------------------------------------------
  public Byte[] GetUniStrRandAnsiBytes(int iMaxChar, bool bAbsolute, bool bValidate, enuCodeType intCodeType, enuLCIDList enulcidType, bool bNoLeadNum ){
  String strText; 
  Byte[] bArrEncoded = null;
            
  int iOldLCID = iCurrentLCID ;
  VerifyLCIDAndLoadResource( (int)enulcidType );                                                  
            
  if ( iMaxChar <= 0 )  // If the string length is <= zero, return an empty string
    return bArrEncoded;

  if ((int)intCodeType < 0 || (int)intCodeType > 3)  // invalid conversion type
    intCodeType = enuCodeType.CURRENT; //use default system code page. 

  strText = GetString( iMaxChar, bAbsolute, bValidate );

  switch( intCodeType ){
  case enuCodeType.CODE_UTF8:
    UTF8Encoding encUTF8 = new UTF8Encoding();
    bArrEncoded = encUTF8.GetBytes( strText );
    break ;
  case enuCodeType.CODE_UTF7:
    UTF7Encoding encUTF7 = new UTF7Encoding();
    bArrEncoded = encUTF7.GetBytes( strText );
    break ;
  case enuCodeType.CODE_UNI:
    UnicodeEncoding encUnicode = new UnicodeEncoding();
    bArrEncoded = encUnicode.GetBytes( strText );
    break ;
  case enuCodeType.CURRENT: //In case if you need the encoding bytes for default system code page.
    Encoding encode = Encoding.Default;
    bArrEncoded = encode.GetBytes( strText );
    break;
  default:
    break ; 
  }

  VerifyLCIDAndLoadResource( iOldLCID  );
                        
  return bArrEncoded ;
  }
 public String GetProbURTCStrLCID(Int16 iMaxChar, bool bAbsolute, bool bValidate, enuLCIDList enulcidType ){
 String strText = null ;
 int iOldLCID = iCurrentLCID ;
 VerifyLCIDAndLoadResource( (int)enulcidType );                                          
 strText = GetProbURTCString(iMaxChar, bAbsolute, bValidate);
 VerifyLCIDAndLoadResource( iOldLCID  );
 return strText ;                                                                              
 }
 public String GetProbCharStrLCID(Int16 iMaxChar, bool bAbsolute, bool bValidate, enuLCIDList enulcidType ){
 String strText = null;
 int iOldLCID = iCurrentLCID ;
 VerifyLCIDAndLoadResource( (int)enulcidType );  //Load the specified resource.                                        
           
 strText = GetProbCharString(iMaxChar, bAbsolute, bValidate);
 VerifyLCIDAndLoadResource( iOldLCID  );   //Switch back to the default resource.
 return strText ;                                                                              
 }
  public String GetStrLcid(Int16 iMaxChar, bool bAbsolute, bool bValidate, enuLCIDList enulcidType , bool bNoLeadNum){                                     
  String strText = null ;
  int iOldLCID = iCurrentLCID ;

  if ( iMaxChar <= 0 )  // If the string length is <= zero, return an empty string
    return String.Empty;

  VerifyLCIDAndLoadResource( (int)enulcidType );                                          
            
  strText = MakeString(iMaxChar, bAbsolute, bValidate, bNoLeadNum);
  VerifyLCIDAndLoadResource( iOldLCID  ); 
  return strText ;
  }
 public String GetStrLcid(Int16 iMaxChar, bool bAbsolute, bool bValidate, enuLCIDList enulcidType){                                     
 return GetStrLcid( iMaxChar, bAbsolute, bValidate, enulcidType, false ); 
 }
  public String GetRandStrLCID(Int16 iMaxChar, bool bAbsolute, bool bValidate,enuLCIDList enulcidType, bool bNoLeadNum){
  String strText = null ;
  int iOldLCID = iCurrentLCID ;
  if ( iMaxChar <= 0 )  // If the string length is <= zero, return an empty string
    return String.Empty;

  VerifyLCIDAndLoadResource( (int)enulcidType );   // Change the current Locale ID to the requested one.                                          
            
  //MakeRandString generates a random ansi string for the specified Locale type.
  strText = MakeRandString(iMaxChar, bAbsolute, bValidate, bNoLeadNum);

  VerifyLCIDAndLoadResource( iOldLCID  );  //Change back to the default one.
  return strText ;                                  
  }