本文整理汇总了C#中System.Resources.ResXDataNode类的典型用法代码示例。如果您正苦于以下问题:C# ResXDataNode类的具体用法?C# ResXDataNode怎么用?C# ResXDataNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResXDataNode类属于System.Resources命名空间,在下文中一共展示了ResXDataNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(ResXDataNode entry, bool isSource = true)
{
try
{
if (isSource)
{
// ソース
this.ResxTranslatorTable.AddResxTranslatorTableRow(
entry.Name,
entry.GetValue((ITypeResolutionService)null).ToString(),
string.Empty,
entry.Comment
);
}
else
{
// ターゲット
this.ResxTranslatorTable.AddResxTranslatorTableRow(
entry.Name,
string.Empty,
entry.GetValue((ITypeResolutionService)null).ToString(),
entry.Comment
);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
示例2: Update
public void Update(ResxTranslatorTableRow row, ResXDataNode entry, bool isSource = true)
{
try
{
if (null == row) return;
if (isSource)
{
// ソース
row.SourceValue = entry.GetValue((ITypeResolutionService)null).ToString();
}
else
{
// ターゲット
row.TargetValue = entry.GetValue((ITypeResolutionService)null).ToString();
}
// コメント
if (string.IsNullOrWhiteSpace(row.Comment))
{
row.Comment = entry.Comment;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
示例3: ITRSNotUsedWhenNodeCreatedNew
public void ITRSNotUsedWhenNodeCreatedNew ()
{
ResXDataNode node;
node = new ResXDataNode ("along", 34L);
string returnedType = node.GetValueTypeName (new ReturnIntITRS ());
Assert.AreEqual ((typeof (long)).AssemblyQualifiedName, returnedType, "#A1");
}
示例4: ITRSNotUsedWhenCreatedNew
public void ITRSNotUsedWhenCreatedNew ()
{
ResXDataNode node;
node = new ResXDataNode ("along", 34L);
object obj = node.GetValue (new ReturnIntITRS ());
Assert.IsInstanceOfType (typeof (long), obj, "#A1");
}
示例5: ITRSUsedWithNodeFromReader
public void ITRSUsedWithNodeFromReader ()
{
ResXDataNode returnedNode, originalNode;
originalNode = new ResXDataNode ("aNumber", 23L);
returnedNode = GetNodeFromResXReader (originalNode);
Assert.IsNotNull (returnedNode, "#A1");
string returnedType = returnedNode.GetValueTypeName (new ReturnIntITRS ());
Assert.AreEqual ((typeof (Int32)).AssemblyQualifiedName, returnedType, "#A2");
}
示例6: ToResXDataNode
/// <summary>
/// May return null.
/// </summary>
public virtual ResXDataNode ToResXDataNode()
{
ResXDataNode result = null;
if (!String.IsNullOrEmpty(_name)) {
result = new ResXDataNode(_name, _value);
if (!String.IsNullOrEmpty(Metadata_Comment)) result.Comment = Metadata_Comment;
}
return result;
}
示例7: ITRSUsedEachTimeWhenNodeFromReader
public void ITRSUsedEachTimeWhenNodeFromReader ()
{
ResXDataNode returnedNode, originalNode;
originalNode = new ResXDataNode ("aNumber", 23L);
returnedNode = GetNodeFromResXReader (originalNode);
Assert.IsNotNull (returnedNode, "#A1");
string newType = returnedNode.GetValueTypeName (new ReturnIntITRS ());
Assert.AreEqual (typeof (int).AssemblyQualifiedName, newType, "#A2");
string origType = returnedNode.GetValueTypeName ((ITypeResolutionService) null);
Assert.AreEqual (typeof (long).AssemblyQualifiedName, origType, "#A3");
}
示例8: BuildResX
public void BuildResX(string outputPath)
{
using (ResXResourceWriter w2 = new ResXResourceWriter(outputPath))
{
foreach (Item item in _items)
{
ResXDataNode node = new ResXDataNode(item.Name, item.Value);
node.Comment = item.Comment;
w2.AddResource(item.Name, node);
}
}
}
示例9: ResXNullRef_WriteBack
public void ResXNullRef_WriteBack ()
{
ResXDataNode node = new ResXDataNode ("NullRef", (object) null);
node.Comment = "acomment";
ResXDataNode returnedNode = GetNodeFromResXReader (node);
Assert.IsNotNull (returnedNode, "#A1");
Assert.IsNull (returnedNode.GetValue ((AssemblyName []) null), "#A2");
Assert.AreEqual ("acomment", returnedNode.Comment,"#A3");
ResXDataNode finalNode = GetNodeFromResXReader (returnedNode);
Assert.IsNotNull (finalNode, "#A4");
Assert.IsNull (finalNode.GetValue ((AssemblyName []) null), "#A5");
Assert.AreEqual ("acomment", finalNode.Comment,"#A6");
}
示例10: IconEntry
public IconEntry(ResourceCatalog _owner, ResXDataNode _node, bool isMeta)
{
if (_node == null)
throw new ArgumentNullException ("node");
string nodeTypeName = _node.GetValueTypeName ((AssemblyName []) null);
if (!nodeTypeName.StartsWith ("System.Drawing.Icon, System.Drawing"))
throw new ArgumentException ("node","Invalid resource type");
if (_owner == null)
throw new ArgumentNullException ("owner");
IsMeta = isMeta;
Owner = _owner;
node = _node;
SetRelativePos ();
}
示例11: StringEntry
public StringEntry(ResourceCatalog _owner, ResXDataNode _node, bool isMeta)
{
if (_node == null)
throw new ArgumentNullException ("node");
if (!_node.GetValueTypeName ((AssemblyName []) null).StartsWith ("System.String, mscorlib"))
throw new ArgumentException ("node","Should be string resource");
if (_node.FileRef != null)
throw new ArgumentException ("node", "FileRef should not be set");
if (_owner == null)
throw new ArgumentNullException ("owner");
IsMeta = isMeta;
Owner = _owner;
node = _node;
SetRelativePos ();
}
示例12: OtherEmbeddedEntry
public OtherEmbeddedEntry(ResourceCatalog _owner, string _name, object _value, bool isMeta)
{
if (_name == null)
throw new ArgumentNullException ("name");
if (_name == String.Empty)
throw new ArgumentException ("name", "Name should not be empty");
if (_value == null)
throw new ArgumentNullException ("value");
if (_value is string || _value is Icon || _value is Bitmap || _value is MemoryStream)
throw new ArgumentException ("value", "Invalid type");
if (_owner == null)
throw new ArgumentNullException ("owner");
IsMeta = isMeta;
Owner = _owner;
node = new ResXDataNode (_name,_value);
SetRelativePos ();
}
示例13: GetNodeFromResXReader
protected ResXDataNode GetNodeFromResXReader (ResXDataNode node)
{
StringWriter sw = new StringWriter ();
using (ResXResourceWriter writer = new ResXResourceWriter (sw)) {
writer.AddResource (node);
}
StringReader sr = new StringReader (sw.GetStringBuilder ().ToString ());
using (ResXResourceReader reader = new ResXResourceReader (sr)) {
reader.UseResXDataNodes = true;
IDictionaryEnumerator enumerator = reader.GetEnumerator ();
enumerator.MoveNext ();
return ((DictionaryEntry) enumerator.Current).Value as ResXDataNode;
}
}
示例14: BinaryOrStringEntry
public BinaryOrStringEntry(ResourceCatalog _owner, ResXDataNode _node, bool isMeta)
{
if (_node == null)
throw new ArgumentNullException ("node");
if (_node.FileRef == null)
throw new ArgumentNullException ("node","FileRef should be set");
string nodeTypeName = _node.GetValueTypeName ((AssemblyName []) null);
if (!nodeTypeName.StartsWith ("System.String, mscorlib") &&
!nodeTypeName.StartsWith ("System.Byte[], mscorlib"))
throw new ArgumentException ("node","Only string or byte[] TypeName allowed");
if (_owner == null)
throw new ArgumentNullException ("owner");
IsMeta = isMeta;
Owner = _owner;
node = _node;
SetRelativePos ();
}
示例15: OtherFileEntry
public OtherFileEntry(ResourceCatalog _owner, ResXDataNode _node, bool isMeta)
{
if (_node == null)
throw new ArgumentNullException ("node");
if (_node.FileRef == null)
throw new ArgumentNullException ("node","FileRef should be set");
string nodeTypeName = _node.GetValueTypeName ((AssemblyName []) null);
if (nodeTypeName.StartsWith ("System.String, mscorlib") ||
nodeTypeName.StartsWith ("System.Drawing.Bitmap, System.Drawing") ||
nodeTypeName.StartsWith ("System.Drawing.Icon, System.Drawing") ||
nodeTypeName.StartsWith ("System.IO.MemoryStream, mscorlib"))
throw new ArgumentException ("node","Invalid resource type");
if (_owner == null)
throw new ArgumentNullException ("owner");
IsMeta = isMeta;
Owner = _owner;
node = _node;
SetRelativePos ();
}