Getting Component List with Unicode / Part 2

In Part 1 of my problem i get some infos about components via “USER OPTIONS”.

Link: Getting Component List

Now we have another problem.

I expect the User Options" as in the picture / assempart67, including the wanted infos “refname=…” and “config=…”.

But there are different ways. In other parts (73, 75) there additional “UNICODE OPTIONS” and refname/config in other syntax, see Secreenshot.

I don’t found a way to get this “UNICODE OPTIONS”. Do you have a hint for me?

In the moment we get the USER OPTIONS via:

      HCS_KEY geometry_key;
      StringBuilder geometry_type = new StringBuilder(1024);

      HCS.Open_Segment(path);

      HCS.Begin_Contents_Search("...", "USER OPTIONS");

      while (HCS.Find_Contents(geometry_type, out geometry_key))
      {
        try
        {
          int laengeUserOptions;

          HCS.Show_User_Options_Length(out laengeUserOptions);

          StringBuilder textUserOptions = new StringBuilder(laengeUserOptions + 1);

          HCS.Show_User_Options(textUserOptions);

          string xml = Convert.ToString(textUserOptions);

          if (!(xml.IndexOf("refname=") > 0 && xml.IndexOf("configname=") > 0))
            continue;

Thanks again for your help!

Leaving this here but looks like you have already figured it out!

Hi,

Have you tried HCS.Show_Unicode_Options()?

Thanks,
Guido

Yes and no. Tried this method “HCS.Show_Unicode_Options()”

But Result is length0 / empty string. Maybe i make something false. Therefore i’m asking for a hint. Or a code fragment with this functions.

Hi Stefan,

HCS.Show_Unicode_Options() should be enough as long as you have the right segment open which has a unicode option in it. I don’t think there is anything else to it unless we have a bug. Maybe try explicitly setting unicode options in a segment and check if they can be retrieved.

Thanks,
Guido

Hi Guido, thank you for your posts. I think we get ist with this Code Fragment:

static ushort uniArray = new ushort[1000];

  HCS.Open_Segment(path);

  HCS.Begin_Contents_Search("...", "UNICODE OPTIONS");

  try
  {
   int uniLength=0;
    HCS.Show_Unicode_Options_Length(out uniLength);
    string uniOptions="";
    if (uniLength > 0)
    {
      HCS.Show_Unicode_Options(out uniArray[0]);
      if (uniArray[0] > 0)
      {
        for (int i = 0; i < uniLength;  i++)
        {
          uniOptions += Convert.ToChar(uniArray[i]);
        }
      }
    }
    HCS.End_Contents_Search();
    HCS.Close_Segment();
  }
  catch (Exception)
  {

  }
1 Like