[C#] ActiveWorkspace.ConfigurationVariableValue() translates slash

It seems that ActiveWorkspace.ConfigurationVariableValue() translates / to \\ when returning the values of a variable. If I look in [Workspace - Configuration] the / is replaced with \. My string could contain either so I really need to get the original string (it's a password key). Is there any other way to get the original the value?

In the ucf-file: EAAAAMjKgUkIPwSmU/dpKk+pyvuYSxObomZLQN+NoYNkgLh1

In MicroStation: EAAAAMjKgUkIPwSmU\dpKk+pyvuYSxObomZLQN+NoYNkgLh1

In C#:           EAAAAMjKgUkIPwSmU\\dpKk+pyvuYSxObomZLQN+NoYNkgLh1

/Krister

Parents
  • Krister,

    Michael is correct.  A MicroStation configuration file is not the best location to store special character data, but is a great facility to create and use values that are string parts that can be equated to either a file name, directory, or simple data type for display or interpretation.

    When config var "values" are read into MicroStation, MicroStation will convert any values containing "forwardslashes" to operating specific directory separators (e.g. For Windows a directory seperator is "\", not "/" that is preferred and used in MicroStation config files).  Caution is taken on our part a.) not to modify the original config file when doing so (in memory), and b.) process UNC mounts and URLs as expected.

    You have at least two choices available.  a.) you could use C# String.Replace() to safely replace the backslashes to forward slashes for your in memory copy of the original buffer, or b.) store data containing special characters in an alternate location.

    HTH,

    Bob



    Answer Verified By: Krister Surell 

Reply
  • Krister,

    Michael is correct.  A MicroStation configuration file is not the best location to store special character data, but is a great facility to create and use values that are string parts that can be equated to either a file name, directory, or simple data type for display or interpretation.

    When config var "values" are read into MicroStation, MicroStation will convert any values containing "forwardslashes" to operating specific directory separators (e.g. For Windows a directory seperator is "\", not "/" that is preferred and used in MicroStation config files).  Caution is taken on our part a.) not to modify the original config file when doing so (in memory), and b.) process UNC mounts and URLs as expected.

    You have at least two choices available.  a.) you could use C# String.Replace() to safely replace the backslashes to forward slashes for your in memory copy of the original buffer, or b.) store data containing special characters in an alternate location.

    HTH,

    Bob



    Answer Verified By: Krister Surell 

Children