当前位置: 首页>>代码示例>>C#>>正文


C# Resources.ResXDataNode类代码示例

本文整理汇总了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);
			}
		}
开发者ID:BuminMacintosh,项目名称:ResxTranslator,代码行数:30,代码来源:ResxTranslatorDataSet.cs

示例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);
			}
		}
开发者ID:BuminMacintosh,项目名称:ResxTranslator,代码行数:28,代码来源:ResxTranslatorDataSet.cs

示例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");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:ResXDataNodeTypeConverterGetValueTypeNameTests.cs

示例4: ITRSNotUsedWhenCreatedNew

		public void ITRSNotUsedWhenCreatedNew ()
		{
			ResXDataNode node;
			node = new ResXDataNode ("along", 34L);

			object obj = node.GetValue (new ReturnIntITRS ());
			Assert.IsInstanceOfType (typeof (long), obj, "#A1");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:ResXDataNodeTypeConverterGetValueTests.cs

示例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");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:10,代码来源:ResXDataNodeTypeConverterGetValueTypeNameTests.cs

示例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;
 }
开发者ID:austhomp,项目名称:resgenEx,代码行数:13,代码来源:ResourceItem.cs

示例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");				
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:ResXDataNodeTypeConverterGetValueTypeNameTests.cs

示例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);
         }
     }
 }
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:12,代码来源:TestResourceBuilder.cs

示例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");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:ResXDataNodeWriteBehavior.cs

示例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 ();
        }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:16,代码来源:IconEntry.cs

示例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 ();
        }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:16,代码来源:StringEntry.cs

示例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 ();
 }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:17,代码来源:OtherEmbeddedEntry.cs

示例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;
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:17,代码来源:ResourcesTestHelper.cs

示例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 ();
        }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:19,代码来源:BinaryOrStringFileEntry.cs

示例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 ();
        }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:21,代码来源:OtherFileEntry.cs


注:本文中的System.Resources.ResXDataNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。