本文整理汇总了C#中WritingSystemDefinition.SetAllComponents方法的典型用法代码示例。如果您正苦于以下问题:C# WritingSystemDefinition.SetAllComponents方法的具体用法?C# WritingSystemDefinition.SetAllComponents怎么用?C# WritingSystemDefinition.SetAllComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WritingSystemDefinition
的用法示例。
在下文中一共展示了WritingSystemDefinition.SetAllComponents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadIdentityElement
private void ReadIdentityElement(XmlReader reader, WritingSystemDefinition ws)
{
Debug.Assert(reader.NodeType == XmlNodeType.Element && reader.Name == "identity");
using (XmlReader identityReader = reader.ReadSubtree())
{
identityReader.MoveToContent();
identityReader.ReadStartElement("identity");
if (FindElement(identityReader, "version"))
{
ws.VersionNumber = identityReader.GetAttribute("number") ?? string.Empty;
if (!identityReader.IsEmptyElement)
{
ws.VersionDescription = identityReader.ReadString();
identityReader.ReadEndElement();
}
}
string dateTime = GetSubNodeAttributeValue(identityReader, "generation", "date");
DateTime modified = DateTime.UtcNow;
if (!string.IsNullOrEmpty(dateTime.Trim()) && !DateTime.TryParse(dateTime, out modified))
{
//CVS format: "$Date: 2008/06/18 22:52:35 $"
modified = DateTime.ParseExact(dateTime, "'$Date: 'yyyy/MM/dd HH:mm:ss $", null,
DateTimeStyles.AssumeUniversal);
}
ws.DateModified = modified;
string language = GetSubNodeAttributeValue(identityReader, "language", "type");
string script = GetSubNodeAttributeValue(identityReader, "script", "type");
string region = GetSubNodeAttributeValue(identityReader, "territory", "type");
string variant = GetSubNodeAttributeValue(identityReader, "variant", "type");
if ((language.StartsWith("x-", StringComparison.OrdinalIgnoreCase) || language.Equals("x", StringComparison.OrdinalIgnoreCase)))
{
var flexRfcTagInterpreter = new FlexConformPrivateUseRfc5646TagInterpreter();
flexRfcTagInterpreter.ConvertToPalasoConformPrivateUseRfc5646Tag(language, script, region, variant);
ws.SetAllComponents(flexRfcTagInterpreter.Language, flexRfcTagInterpreter.Script, flexRfcTagInterpreter.Region, flexRfcTagInterpreter.Variant);
_wsIsFlexPrivateUse = true;
}
else
{
ws.SetAllComponents(language, script, region, variant);
_wsIsFlexPrivateUse = false;
}
//Set the id simply as the concatenation of whatever was in the ldml file.
ws.Id = String.Join("-", new[] {language, script, region, variant}.Where(subtag => !String.IsNullOrEmpty(subtag)).ToArray());
// move to end of identity node
while (identityReader.Read()) ;
}
if (!reader.IsEmptyElement)
{
reader.ReadEndElement();
}
}