• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Xml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Xml的典型用法代码示例。如果您正苦于以下问题:C# Xml类的具体用法?C# Xml怎么用?C# Xml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Xml类属于命名空间,在下文中一共展示了Xml类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateFromXml

        static internal PipeLaunchOptions CreateFromXml(Xml.LaunchOptions.PipeLaunchOptions source)
        {
            var options = new PipeLaunchOptions(RequireAttribute(source.PipePath, "PipePath"), source.PipeArguments);
            options.InitializeCommonOptions(source);

            return options;
        }
开发者ID:lsgxeva,项目名称:MIEngine,代码行数:7,代码来源:LaunchOptions.cs


示例2: Util

 public Util(Core RennderCore)
 {
     R = RennderCore;
     Str = new Str(R);
     Xml = new Xml();
     Serializer = new Serializer(R);
 }
开发者ID:nhtera,项目名称:Home,代码行数:7,代码来源:Util.cs


示例3: Build

        public static byte[] Build(Xml.FileGroupXml group, string spriteFile)
        {
            var bmps = group.Files.Select(x => new System.Drawing.Bitmap(x.Path));

            var maxWidth = bmps.Max(x => x.Width);
            var totalHeight = bmps.Sum(x => x.Height);

            int top = 0;
            using (var sprite = new System.Drawing.Bitmap(maxWidth, totalHeight))
            using (var mem = new System.IO.MemoryStream())
            using (var g = System.Drawing.Graphics.FromImage(sprite))
            {
                foreach (var bmp in bmps)
                {
                    using (bmp)
                    {
                        g.DrawImage(bmp, new System.Drawing.Rectangle(0, top, bmp.Width, bmp.Height), new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.GraphicsUnit.Pixel);
                        top += bmp.Height;
                    }
                }

                sprite.Save(mem, GetFormat(spriteFile) ?? System.Drawing.Imaging.ImageFormat.Png);
                return mem.ToArray();
            }
        }
开发者ID:cbilson,项目名称:chirpy,代码行数:25,代码来源:ImageSprite.cs


示例4: createMessage

            public static Xml createMessage(string type)
            {
                Xml ret = new Xml("msg");
                ret.root.attribute("type").set(type);

                return ret;
            }
开发者ID:sopindm,项目名称:bjeb,代码行数:7,代码来源:Xml.cs


示例5: FollowingSiblings

 public IEnumerable<Xml.IQueryableNode> FollowingSiblings(Xml.IQueryableNode node)
 {
   var result = node.FollowingSibling();
   while (result != null)
   {
     yield return result;
     result = result.FollowingSibling();
   }
 }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:9,代码来源:HtmlQueryEngine.cs


示例6: NuGetDependency

        public NuGetDependency(Xml.NuGet.NuSpec.Dependency dependency)
            : this()
        {
            Dependency = dependency;

            _uiName.Text = Dependency.Id;
            _uiVersion.Text = Dependency.Version;
            _uiOriginalFramework.Text = Dependency.OriginalTargetFramework;
        }
开发者ID:HefloRicardo,项目名称:NuGetDeploy,代码行数:9,代码来源:NuGetDependency.cs


示例7: CreateCollectionFromXml

        public static ReadOnlyCollection<LaunchCommand> CreateCollectionFromXml(Xml.LaunchOptions.Command[] source)
        {
            LaunchCommand[] commandArray = source?.Select(x => new LaunchCommand(x.Value, x.Description, x.IgnoreFailures)).ToArray();
            if (commandArray == null)
            {
                commandArray = new LaunchCommand[0];
            }

            return new ReadOnlyCollection<LaunchCommand>(commandArray);
        }
开发者ID:rajkumar42,项目名称:MIEngine,代码行数:10,代码来源:LaunchCommand.cs


示例8: Xml_CData_AddsCDataNode

 public void Xml_CData_AddsCDataNode()
 {
     var xml = new Xml();
     xml.Tag("tag", Xml.Fragment(() =>
     {
         xml.CData("content");
         xml.Tag("hello", "world");
     }));
     Assert.Equal("<tag><![CDATA[content]]><hello>world</hello></tag>", xml);
 }
开发者ID:yadazula,项目名称:DynamicBuilder,代码行数:10,代码来源:XmlTest.cs


示例9: WriteSvg

 internal void WriteSvg(Xml.SvgWriter w)
 {
     w.WriteStartElement("pressure");
     w.WriteAttributeString("midiChannel", _midiChannel.ToString());
     if(_inputControls != null)
     {
         _inputControls.WriteSvg(w);
     }
     w.WriteEndElement(); // trkOff
 }
开发者ID:suvjunmd,项目名称:Moritz,代码行数:10,代码来源:Pressure.cs


示例10: Xml

	public Xml()
	{
		if (instance != null)
		{
			return;
		}
		else
		{
			instance = this;
		}
	}
开发者ID:TrapperHell,项目名称:TwitchKittenAssault,代码行数:11,代码来源:Xml.cs


示例11: Initialize

        public void Initialize(Xml.XAccessor x)
        {
            string strHostType = x.GetStringValue(CLASS);
            if (string.IsNullOrEmpty(strHostType))
                ExceptionHelper.ThrowPolicyInitNullError(this.GetType(), CLASS);
            Type hostType = Reflector.LoadType(strHostType);
            string memberName = x.GetStringValue(MEMBER);
            if (string.IsNullOrEmpty(memberName))
                ExceptionHelper.ThrowPolicyInitNullError(this.GetType(), MEMBER);

            IReflector r = Reflector.Bind(hostType, ReflectorPolicy.TypePublic);
            _instance = r.GetPropertyOrFieldValue(memberName, false);
        }
开发者ID:rexzh,项目名称:RexToy,代码行数:13,代码来源:InstancePolicy.cs


示例12: WriteSvg

 /// <summary>
 /// This function only writes TrkRefs that refer to Trks stored in external VoiceDefs. 
 /// Note that successive Trks in the same VoiceDef may, in principle, contain common IUniqueDefs...
 /// SVG files contain voice definitions that contain MidiChordDefs and restDefs, but no Trks.
 /// </summary>
 /// <param name="w"></param>
 internal void WriteSvg(Xml.SvgWriter w)
 {
     w.WriteStartElement("seq");
     if(TrkOptions != null)
     {
         TrkOptions.WriteSvg(w, false);
     }
     Debug.Assert(TrkRefs != null && TrkRefs.Count > 0);
     foreach(TrkRef trkRef in TrkRefs)
     {
         trkRef.WriteSvg(w);
     }
     w.WriteEndElement(); // seq
 }
开发者ID:notator,项目名称:Moritz,代码行数:20,代码来源:SeqRef.cs


示例13: WriteSvg

 internal void WriteSvg(Xml.SvgWriter w)
 {
     w.WriteStartElement("pressures");
     if(_inputControls != null)
     {
         _inputControls.WriteSvg(w);
     }
     Debug.Assert(_pressures != null && _pressures.Count > 0);
     foreach(Pressure pressure in _pressures)
     {
         pressure.WriteSvg(w);
     }
     w.WriteEndElement(); // pressures
 }
开发者ID:suvjunmd,项目名称:Moritz,代码行数:14,代码来源:Pressures.cs


示例14: WriteSvg

 internal void WriteSvg(Xml.SvgWriter w)
 {
     w.WriteStartElement("trkOffs");
     if(_inputControls != null)
     {
         _inputControls.WriteSvg(w);
     }
     Debug.Assert(_trkOffs != null && _trkOffs.Count > 0);
     foreach(TrkOff trkOff in _trkOffs)
     {
         trkOff.WriteSvg(w);
     }
     w.WriteEndElement(); // trkOffs
 }
开发者ID:suvjunmd,项目名称:Moritz,代码行数:14,代码来源:TrkOffs.cs


示例15: DiffReturnValues

        /// <inheritdoc />
        public IEnumerable<IAnalysisLogDiff> DiffReturnValues(Xml.Value oldValue, Xml.Value newValue)
        {
            // If both values are not null...
            IEnumerable<IAnalysisLogDiff> list;
            if (oldValue != null && newValue != null)
            {
                if (!newValue.IsComparableTo(oldValue))
                {
                    var msg = string.Format(
                        "Items are incompatible for comparison! oldObject.Item.Type => {0}, newObject.Item.Type => {1}",
                        oldValue.UnderlyingType,
                        newValue.UnderlyingType);
                    throw new ArgumentException(msg);
                }

                if (newValue.IsPrimtive && oldValue.IsPrimtive && !newValue.AsPrimitive.Equals(oldValue.AsPrimitive))
                {
                    list = new IAnalysisLogDiff[]
                    {
                        new ReturnValueAnalysisLogDiff(oldValue.AsPrimitive.Value, newValue.AsPrimitive.Value, newValue.AsPrimitive.FullName)
                    };
                }
                else if (newValue.IsObject && oldValue.IsObject)
                {
                    list = this.DiffObjects(oldValue.AsObject, newValue.AsObject);
                }
                else
                {
                    // No diff.
                    list = Enumerable.Empty<IAnalysisLogDiff>();
                }
            }
            else if (oldValue == null && newValue == null)
            {
                // No diff.
                list = Enumerable.Empty<IAnalysisLogDiff>();
            }
            else
            {
                // Either the old or new value is null. Not sure what happened here--should be impossible.
                var msg = string.Format(
                    "The {0} return value was null! This indicates an analysis log file corruption. Terminating analysis!",
                    oldValue == null ? "old" : "current");
                throw new ArgumentException(msg);
            }

            return list;
        }
开发者ID:jduv,项目名称:WinBert,代码行数:49,代码来源:AnalysisLogObjectDiffer.cs


示例16: ElementBase

        protected ElementBase(Xml.ElementGroup node)
        {
            if (node.name.StartsWith("&#x"))
            {
                string[] val = node.name.Split(new[] {';'}, 2, StringSplitOptions.None);
                var c = (char) int.Parse(val[0].Substring(3), NumberStyles.HexNumber, null);
                this.name = c + val[1];
            }
            else
            {
                this.name = node.name;
            }

            this.repeat = node.repeat;
            this.optional = node.optional;
            this.desc = node.desc;
        }
开发者ID:figment,项目名称:tesvsnip,代码行数:17,代码来源:ElementBase.cs


示例17: Parents

    public IEnumerable<Xml.IQueryableNode> Parents(Xml.IQueryableNode node)
    {
      var curr = node;
      var result = node.Parent();
      while (result != null)
      {
        if (string.Compare(curr.Name.LocalName, "tr", StringComparison.OrdinalIgnoreCase) == 0 &&
          string.Compare(result.Name.LocalName, "table", StringComparison.OrdinalIgnoreCase) == 0)
        {
          yield return new TbodyNode(curr);
        }

        yield return result;
        curr = result;
        result = result.Parent();
      }

      var html = new HtmlNode();
      switch (curr.Name.LocalName.ToLowerInvariant())
      {
        case "html":
          // do nothing
          break;
        case "body":
        case "head":
          yield return html;
          break;
        case "title":
        case "base":
        case "link":
        case "style":
        case "meta":
        case "script":
        case "noscript":
        case "command":
          yield return new HeadNode(curr, null, html);
          yield return html;
          break;
        default:
          yield return new BodyNode(curr, null, html);
          yield return html;
          break;
      }
    }
开发者ID:rneuber1,项目名称:InnovatorAdmin,代码行数:44,代码来源:HtmlQueryEngine.cs


示例18: NuGetDependencyGroup

        public NuGetDependencyGroup(Xml.NuGet.NuSpec.Group dependencyGroup)
            : this()
        {
            Group = dependencyGroup;

            _uiTargetFramework.Text = Group.TargetFramework;

            foreach (Xml.NuGet.NuSpec.Dependency dependency in dependencyGroup.Dependencies)
            {
                _uiDependencies.Items.Add(new NuGetDependency(dependency)
                {
                    OnRemoveFromDependencyGroup = OnDependencyRemovedFromGroup
                });
            }

            _uiItemsCount.Text = _uiDependencies.Items.Count.ToString();

            Refresh();
        }
开发者ID:HefloRicardo,项目名称:NuGetDeploy,代码行数:19,代码来源:NuGetDependencyGroup.cs


示例19: HandleElement

 protected override bool HandleElement(Xml.XmlReader reader)
 {
     if (base.HandleElement(reader))
     {
         return true;
     } 
     else if (CanHandleElement(reader, XmlConstants.ValueAnnotation))
     {
         // EF does not support this EDM 3.0 element, so ignore it.
         SkipElement(reader);
         return true;
     }
     else if (CanHandleElement(reader, XmlConstants.TypeAnnotation))
     {
         // EF does not support this EDM 3.0 element, so ignore it.
         SkipElement(reader);
         return true;
     }
     return false;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:SchemaComplexType.cs


示例20: SubrecordStructure

        public SubrecordStructure(Xml.Subrecord node)
            : base(node)
        {
            this.notininfo = node.notininfo;
            this.size = node.size;
            this.Condition = (!string.IsNullOrEmpty(node.condition))
                                 ? (CondType) Enum.Parse(typeof (CondType), node.condition, true)
                                 : CondType.None;
            this.CondID = node.condid;
            this.CondOperand = node.condvalue;
            this.UseHexEditor = node.usehexeditor;

            // if (optional && repeat)
            // {
            // throw new RecordXmlException("repeat and optional must both have the same value if they are non zero");
            // }

            this.elementTree = GetElementTree(node.Items).ToArray();
            this.elements = GetElementArray(elementTree).ToArray();
            this.ContainsConditionals = this.elements.Count(x => x.CondID != 0) > 0;
        }
开发者ID:figment,项目名称:tesvsnip,代码行数:21,代码来源:SubrecordStructure.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XmlCompletionItemCollection类代码示例发布时间:2022-05-24
下一篇:
C# XlsFile类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap