當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。