本文整理汇总了C#中IXmpMeta.SetLocalizedText方法的典型用法代码示例。如果您正苦于以下问题:C# IXmpMeta.SetLocalizedText方法的具体用法?C# IXmpMeta.SetLocalizedText怎么用?C# IXmpMeta.SetLocalizedText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmpMeta
的用法示例。
在下文中一共展示了IXmpMeta.SetLocalizedText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetDescription
/**
* Sets a description.
*
* @param xmpMeta
* @param desc
* @param genericLang The name of the generic language
* @param specificLang The name of the specific language
*/
public static void SetDescription(IXmpMeta xmpMeta, String desc, String genericLang, String specificLang) {
xmpMeta.SetLocalizedText(XmpConst.NS_DC, DESCRIPTION, genericLang, specificLang, desc);
}
示例2: MigrateAudioCopyright
/// <summary>
/// The initial support for WAV files mapped a legacy ID3 audio copyright
/// into a new xmpDM:copyright property.
/// </summary>
/// <remarks>
/// The initial support for WAV files mapped a legacy ID3 audio copyright
/// into a new xmpDM:copyright property. This is special case code to migrate
/// that into dc:rights['x-default']. The rules:
/// <pre>
/// 1. If there is no dc:rights array, or an empty array -
/// Create one with dc:rights['x-default'] set from double linefeed and xmpDM:copyright.
/// 2. If there is a dc:rights array but it has no x-default item -
/// Create an x-default item as a copy of the first item then apply rule #3.
/// 3. If there is a dc:rights array with an x-default item,
/// Look for a double linefeed in the value.
/// A. If no double linefeed, compare the x-default value to the xmpDM:copyright value.
/// A1. If they match then leave the x-default value alone.
/// A2. Otherwise, append a double linefeed and
/// the xmpDM:copyright value to the x-default value.
/// B. If there is a double linefeed, compare the trailing text to the xmpDM:copyright value.
/// B1. If they match then leave the x-default value alone.
/// B2. Otherwise, replace the trailing x-default text with the xmpDM:copyright value.
/// 4. In all cases, delete the xmpDM:copyright property.
/// </pre>
/// </remarks>
/// <param name="xmp">the metadata object</param>
/// <param name="dmCopyright">the "dm:copyright"-property</param>
private static void MigrateAudioCopyright(IXmpMeta xmp, XmpNode dmCopyright)
{
try
{
var dcSchema = XmpNodeUtils.FindSchemaNode(((XmpMeta)xmp).GetRoot(), XmpConstants.NsDC, true);
var dmValue = dmCopyright.Value;
var doubleLf = "\n\n";
var dcRightsArray = XmpNodeUtils.FindChildNode(dcSchema, "dc:rights", false);
if (dcRightsArray == null || !dcRightsArray.HasChildren)
{
// 1. No dc:rights array, create from double linefeed and xmpDM:copyright.
dmValue = doubleLf + dmValue;
xmp.SetLocalizedText(XmpConstants.NsDC, "rights", string.Empty, XmpConstants.XDefault, dmValue, null);
}
else
{
var xdIndex = XmpNodeUtils.LookupLanguageItem(dcRightsArray, XmpConstants.XDefault);
if (xdIndex < 0)
{
// 2. No x-default item, create from the first item.
var firstValue = dcRightsArray.GetChild(1).Value;
xmp.SetLocalizedText(XmpConstants.NsDC, "rights", string.Empty, XmpConstants.XDefault, firstValue, null);
xdIndex = XmpNodeUtils.LookupLanguageItem(dcRightsArray, XmpConstants.XDefault);
}
// 3. Look for a double linefeed in the x-default value.
var defaultNode = dcRightsArray.GetChild(xdIndex);
var defaultValue = defaultNode.Value;
var lfPos = defaultValue.IndexOf(doubleLf);
if (lfPos < 0)
{
// 3A. No double LF, compare whole values.
if (!dmValue.Equals(defaultValue))
{
// 3A2. Append the xmpDM:copyright to the x-default
// item.
defaultNode.Value = defaultValue + doubleLf + dmValue;
}
}
else
{
// 3B. Has double LF, compare the tail.
if (!defaultValue.Substring (lfPos + 2).Equals(dmValue))
{
// 3B2. Replace the x-default tail.
defaultNode.Value = defaultValue.Substring (0, lfPos + 2 - 0) + dmValue;
}
}
}
// 4. Get rid of the xmpDM:copyright.
dmCopyright.Parent.RemoveChild(dmCopyright);
}
catch (XmpException)
{
}
}
示例3: SetTitle
/**
* Sets a title.
*
* @param xmpMeta
* @param title
* @param genericLang The name of the generic language
* @param specificLang The name of the specific language
*/
public static void SetTitle(IXmpMeta xmpMeta, String title, String genericLang, String specificLang) {
xmpMeta.SetLocalizedText(XmpConst.NS_DC, TITLE, genericLang, specificLang, title);
}