Exemplo n.º 1
0
		protected void DoTemplateElement(TextWriter contentsStream, XmlNode node)
		{
			m_templateRootNode = node;
			string sIcuNormalizationMode = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "normalization", "NFC");
			if (sIcuNormalizationMode == "NFD")
				m_eIcuNormalizationMode = Icu.UNormalizationMode.UNORM_NFD;
			else
				m_eIcuNormalizationMode = Icu.UNormalizationMode.UNORM_NFC;
			string style = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "writingSystemAttributeStyle", WritingSystemAttrStyles.FieldWorks.ToString());
			m_writingSystemAttrStyle = (WritingSystemAttrStyles) System.Enum.Parse(typeof(WritingSystemAttrStyles), style);
			string sFormatOutput = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "stringFormatOutputStyle", StringFormatOutputStyle.None.ToString());
			m_eStringFormatOutput = (StringFormatOutputStyle)System.Enum.Parse(typeof(StringFormatOutputStyle), sFormatOutput);
			m_requireClassTemplatesForEverything = XmlUtils.GetBooleanAttributeValue(node,"requireClassTemplatesForEverything");
			m_doUseBaseClassTemplatesIfNeeded = XmlUtils.GetBooleanAttributeValue(node, "doUseBaseClassTemplatesIfNeeded");

			if (UpdateProgress != null)
				UpdateProgress(this);
			string sProgressMsgId = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "messageId");
			if (!String.IsNullOrEmpty(sProgressMsgId) && SetProgressMessage != null)
			{
				var ma = new ProgressMessageArgs
					{
						MessageId = sProgressMsgId,
						Max = XmlUtils.GetOptionalIntegerValue(m_templateRootNode, "progressMax", 20)
					};
				SetProgressMessage.Invoke(this, ma);
			}
			if (String.IsNullOrEmpty(m_sAuxiliaryFxtFile))	// don't recurse in Go() more than once.
				ComputeAuxiliaryFilename(contentsStream, node);

			DumpObject(contentsStream, m_rootObject, null);
		}
Exemplo n.º 2
0
		protected void DoTemplateElement(TextWriter contentsStream, XmlNode node)
		{
			m_templateRootNode = node;
			string sIcuNormalizationMode = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "normalization", "NFC");
			if (sIcuNormalizationMode == "NFD")
				m_eIcuNormalizationMode = Icu.UNormalizationMode.UNORM_NFD;
			else
				m_eIcuNormalizationMode = Icu.UNormalizationMode.UNORM_NFC;
			string style = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "writingSystemAttributeStyle", WritingSystemAttrStyles.FieldWorks.ToString());
			m_writingSystemAttrStyle = (WritingSystemAttrStyles) System.Enum.Parse(typeof(WritingSystemAttrStyles), style);
			string sFormatOutput = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "stringFormatOutputStyle", StringFormatOutputStyle.None.ToString());
			m_eStringFormatOutput = (StringFormatOutputStyle)System.Enum.Parse(typeof(StringFormatOutputStyle), sFormatOutput);
			m_requireClassTemplatesForEverything = XmlUtils.GetBooleanAttributeValue(node,"requireClassTemplatesForEverything");
			m_doUseBaseClassTemplatesIfNeeded = XmlUtils.GetBooleanAttributeValue(node, "doUseBaseClassTemplatesIfNeeded");

			// kalpLoadForAllOfObjectClass is much slower in the presence of null data,
			// especially for multiple vernacular and analysis writing systems!  Use the faster
			// policy if requested.
			string sAutoloadPolicy = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "autoloadPolicy", String.Empty);
			if (sAutoloadPolicy.ToLowerInvariant() == "readonly")
				m_cache.VwOleDbDaAccessor.AutoloadPolicy = AutoloadPolicies.kalpLoadAllOfClassForReadOnly;

			if (UpdateProgress != null)
				UpdateProgress(this);
			string sProgressMsgId = XmlUtils.GetOptionalAttributeValue(m_templateRootNode, "messageId");
			if (!String.IsNullOrEmpty(sProgressMsgId) && SetProgressMessage != null)
			{
				MessageArgs ma = new MessageArgs();
				ma.MessageId = sProgressMsgId;
				ma.Max = XmlUtils.GetOptionalIntegerValue(m_templateRootNode, "progressMax", 20);
				SetProgressMessage.Invoke(this, ma);
			}
			if (String.IsNullOrEmpty(m_sAuxiliaryFxtFile))	// don't recurse in Go() more than once.
				ComputeAuxiliaryFilename(contentsStream, node);

			DumpObject(contentsStream, m_rootObject, null);
		}