private int getWsFromId(string id)
{
// special case, the only few we support so far (and only for a few fields).
if (id == "best analysis")
return WritingSystemServices.kwsFirstAnal;//LangProject.kwsFirstAnal;
else if (id == "vern in para")
return WritingSystemServices.kwsVernInParagraph;
Debug.Assert(!XmlViewsUtils.GetWsRequiresObject(id), "Writing system is magic. These should never be used in the Interlinear area.");
int ws = -50;
try
{
if (!XmlViewsUtils.GetWsRequiresObject(id))
{
// Try to convert the ws parameter into an int. Sometimes the parameter
// cannot be interpreted without an object, such as when the ws is a magic
// string that will change the actual ws depending on the contents of the
// object. In these cases, we give -50 as a known constant to check for.
// This can possibly throw an exception, so we'll enclose it in a try block.
ws = WritingSystemServices.InterpretWsLabel(m_cache, id, null, 0, 0, null);
}
}
catch
{
Debug.Assert(ws != -50, "InterpretWsLabel was not able to interpret the Ws Label. The most likely cause for this is that a magic ws was passed in.");
}
return ws;
}