AddMagic() private méthode

private AddMagic ( int offset, string type, string magic ) : void
offset int
type string
magic string
Résultat void
Exemple #1
0
        /// <summary>Read Element named magic. </summary>
        private void ReadMagic(XmlElement element, MimeType mimeType)
        {
            // element.getValue();
            String offset  = null;
            String content = null;
            String type    = null;
            var    attrs   = element.Attributes;

            for (int i = 0; i < attrs.Count; i++)
            {
                XmlAttribute attr = (XmlAttribute)attrs.Item(i);
                if (attr.Name.Equals("offset"))
                {
                    offset = attr.Value;
                }
                else if (attr.Name.Equals("type"))
                {
                    type = attr.Value;
                    if (String.Compare(type, "byte", true) == 0)
                    {
                        type = "System.Byte";
                    }
                }
                else if (attr.Name.Equals("value"))
                {
                    content = attr.Value;
                }
            }
            if ((offset != null) && (content != null))
            {
                mimeType.AddMagic(Int32.Parse(offset), type, content);
            }
        }
		/// <summary>Read Element named magic. </summary>
		private void ReadMagic(XmlElement element, MimeType mimeType)
		{
			// element.getValue();
			String offset = null;
			String content = null;
			String type = null;
			var attrs = element.Attributes;
			for (int i = 0; i < attrs.Count; i++)
			{
				XmlAttribute attr = (XmlAttribute) attrs.Item(i);
				if (attr.Name.Equals("offset"))
				{
					offset = attr.Value;
				}
				else if (attr.Name.Equals("type"))
				{
					type = attr.Value;
					if (String.Compare(type, "byte", true) == 0)
					{
						type = "System.Byte";
					}
				}
				else if (attr.Name.Equals("value"))
				{
					content = attr.Value;
				}
			}
			if ((offset != null) && (content != null))
			{
				mimeType.AddMagic(Int32.Parse(offset), type, content);
			}
		}