本文整理匯總了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();
}
}