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

C# IPluginVisitor类代码示例

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

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



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

示例1: ReadAscii

        private static void ReadAscii(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor, uint pluginLine)
        {
            int length = 0;

            if (reader.MoveToAttribute("length"))
                length = ParseInt(reader.Value);

            visitor.VisitAscii(name, offset, visible, length, pluginLine);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:9,代码来源:UniversalPluginLoader.cs


示例2: HandleElement

 private static void HandleElement(XmlReader reader, IPluginVisitor visitor)
 {
     switch (reader.Name)
     {
         case "comment":
             ReadComment(reader, visitor);
             break;
         default:
             HandleValueElement(reader, reader.Name, visitor);
             break;
     }
 }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:12,代码来源:AssemblyPluginLoader.cs


示例3: HandleTopLevelElement

 private static void HandleTopLevelElement(XmlReader reader, IPluginVisitor visitor)
 {
     if (reader.Name == "revisions" && visitor.EnterRevisions())
     {
         ReadRevisions(reader.ReadSubtree(), visitor);
         visitor.LeaveRevisions();
     }
     else
     {
         HandleElement(reader, visitor);
     }
 }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:12,代码来源:AssemblyPluginLoader.cs


示例4: LoadPlugin

        /// <summary>
        /// Parses an XML plugin, calling the corresponding method in
        /// IPluginVisitor for each XML tag it encounters.
        /// </summary>
        /// <param name="reader">The XmlReader to read the plugin XML from.</param>
        /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param>
        public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor)
        {
            if (!reader.ReadToNextSibling("plugin"))
                throw new ArgumentException("The XML file is missing a <plugin> tag.");

            var baseSize = 0;
            if (reader.MoveToAttribute("baseSize"))
                baseSize = ParseInt(reader.Value);

            if (!visitor.EnterPlugin(baseSize)) return;
            ReadElements(reader, true, visitor);
            visitor.LeavePlugin();
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:19,代码来源:AssemblyPluginLoader.cs


示例5: LoadPlugin

        /// <summary>
        /// Parses an XML plugin, calling the corresponding method in
        /// IPluginVisitor for each XML tag it encounters.
        /// </summary>
        /// <param name="reader">The XmlReader to read the plugin XML from.</param>
        /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param>
        public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor)
        {
            if (!reader.ReadToNextSibling("plugin"))
                throw new ArgumentException("The XML file is missing a <plugin> tag.");

            if (!reader.MoveToAttribute("baseSize"))
                throw new ArgumentException("The <plugin> tag is missing the baseSize attribute." + PositionInfo(reader));

            int baseSize = ParseInt(reader.Value);
            if (visitor.EnterPlugin(baseSize))
            {
                ReadElements(reader, true, visitor);
                visitor.LeavePlugin();
            }
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:21,代码来源:AssemblyPluginLoader.cs


示例6: LoadPlugin

        /// <summary>
        /// Parses an XML plugin, calling the corresponding method in
        /// IPluginVisitor for each XML tag it encounters.
        /// </summary>
        /// <param name="reader">The XmlReader to read the plugin XML from.</param>
        /// <param name="visitor">The IPluginVisitor to call for each XML tag.</param>
        public static void LoadPlugin(XmlReader reader, IPluginVisitor visitor)
        {
            if (!reader.ReadToNextSibling("plugin"))
                throw new ArgumentException("The XML file is missing a <plugin> tag.");

            if (!reader.MoveToAttribute("headersize") && !reader.MoveToAttribute("baseSize"))
                throw new ArgumentException("The plugin is missing tag size information.");
            int baseSize = ParseInt(reader.Value);

            if (visitor.EnterPlugin(baseSize))
            {
                UniversalPluginLoader loader = new UniversalPluginLoader();
                loader.ReadElements(reader, true, visitor);
                visitor.LeavePlugin();
            }
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:22,代码来源:UniversalPluginLoader.cs


示例7: ReadShader

        private static void ReadShader(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor,
			uint pluginLine)
        {
            if (!reader.MoveToAttribute("type"))
                throw new ArgumentException("Shaders must have a type attribute." + PositionInfo(reader));

            ShaderType type;
            if (reader.Value == "pixel")
                type = ShaderType.Pixel;
            else if (reader.Value == "vertex")
                type = ShaderType.Vertex;
            else
                throw new ArgumentException("Invalid shader type \"" + reader.Value + "\"");

            visitor.VisitShader(name, offset, visible, type, pluginLine);
        }
开发者ID:Nibre,项目名称:Assembly,代码行数:16,代码来源:AssemblyPluginLoader.cs


示例8: ReadElements

 private static void ReadElements(XmlReader reader, bool topLevel, IPluginVisitor visitor)
 {
     while (reader.Read())
     {
         if (reader.NodeType != XmlNodeType.Element) continue;
         if (topLevel)
             HandleTopLevelElement(reader, visitor);
         else
             HandleElement(reader, visitor);
     }
 }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:11,代码来源:AssemblyPluginLoader.cs


示例9: ReadComment

        private static void ReadComment(XmlReader reader, IPluginVisitor visitor)
        {
            var title = "Comment";

            if (reader.MoveToAttribute("title"))
                title = reader.Value;

            reader.MoveToElement();
            var xmlLineInfo = reader as IXmlLineInfo;
            if (xmlLineInfo == null) return;
            var pluginLine = (uint)xmlLineInfo.LineNumber;
            var text = reader.ReadElementContentAsString();
            visitor.VisitComment(title, text, pluginLine);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:14,代码来源:AssemblyPluginLoader.cs


示例10: ReadBits

        private static void ReadBits(XmlReader reader, IPluginVisitor visitor)
        {
            var subtree = reader.ReadSubtree();

            subtree.ReadStartElement();
            while (subtree.ReadToNextSibling("bit"))
                ReadBit(subtree, visitor);

            visitor.LeaveBitfield();
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:10,代码来源:AssemblyPluginLoader.cs


示例11: DumpRevisions

        // Fixes up the version numbers on revisions
        private void DumpRevisions(IPluginVisitor visitor)
        {
            if (visitor.EnterRevisions())
            {
                // Dump ALL the revisions!
                int version = versionBase;
                foreach (var pair in revisions)
                {
                    pair.Value.Version = version;
                    version++;
                    visitor.VisitRevision(pair.Value);
                }
                versionBase = version;

                visitor.LeaveRevisions();
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:18,代码来源:UniversalPluginLoader.cs


示例12: ReadReflexive

        private static void ReadReflexive(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor, uint pluginLine)
        {
            if (!reader.MoveToAttribute("entrySize"))
                throw new ArgumentException("Reflexives must have an entrySize attribute." + PositionInfo(reader));

            var entrySize = ParseUInt(reader.Value);

            if (visitor.EnterReflexive(name, offset, visible, entrySize, pluginLine))
            {
                reader.MoveToElement();
                var subtree = reader.ReadSubtree();

                subtree.ReadStartElement();
                ReadElements(subtree, false, visitor);
                visitor.LeaveReflexive();
            }
            else
            {
                reader.Skip();
            }
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:21,代码来源:AssemblyPluginLoader.cs


示例13: ReadRange

        private static void ReadRange(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor, uint pluginLine)
        {
            var min = 0.0;
            var max = 0.0;
            var largeChange = 0.0;
            var smallChange = 0.0;
            var type = "int32";

            if (reader.MoveToAttribute("min"))
                min = double.Parse(reader.Value);
            if (reader.MoveToAttribute("max"))
                max = double.Parse(reader.Value);
            if (reader.MoveToAttribute("smallStep"))
                smallChange = double.Parse(reader.Value);
            if (reader.MoveToAttribute("largeStep"))
                largeChange = double.Parse(reader.Value);
            if (reader.MoveToAttribute("type"))
                type = reader.Value.ToLower();

            visitor.VisitRange(name, offset, visible, type, min, max, smallChange, largeChange, pluginLine);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:21,代码来源:AssemblyPluginLoader.cs


示例14: ReadReflexive

        private void ReadReflexive(XmlReader reader, string name, uint offset, bool visible, IPluginVisitor visitor,
			uint pluginLine)
        {
            uint entrySize = 0;

            if (reader.MoveToAttribute("entrySize") || reader.MoveToAttribute("size"))
            {
                if (!string.IsNullOrWhiteSpace(reader.Value))
                    entrySize = ParseUInt(reader.Value);
            }

            if (visitor.EnterReflexive(name, offset, visible, entrySize, pluginLine))
            {
                reader.MoveToElement();
                XmlReader subtree = reader.ReadSubtree();

                subtree.ReadStartElement();
                ReadElements(subtree, false, visitor);
                visitor.LeaveReflexive();
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:21,代码来源:UniversalPluginLoader.cs


示例15: ReadElements

 private void ReadElements(XmlReader reader, bool topLevel, IPluginVisitor visitor)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             string elementName = reader.Name.ToLower();
             if (topLevel)
                 HandleTopLevelElement(reader, elementName, visitor);
             else
                 HandleElement(reader, elementName, visitor);
         }
     }
 }
开发者ID:Cloms,项目名称:Assembly,代码行数:14,代码来源:UniversalPluginLoader.cs


示例16: ReadComment

        private void ReadComment(XmlReader reader, IPluginVisitor visitor)
        {
            string title = "Comment";

            if (reader.MoveToAttribute("title"))
                title = reader.Value;

            reader.MoveToElement();
            var pluginLine = (uint) (reader as IXmlLineInfo).LineNumber;
            string text = reader.ReadElementContentAsString();
            visitor.VisitComment(title, text, pluginLine);
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:12,代码来源:UniversalPluginLoader.cs


示例17: HandleValueElement

        /// <summary>
        ///     Handles an element which describes how a value
        ///     should be read from the cache file.
        /// </summary>
        /// <param name="reader">The XmlReader that read the element.</param>
        /// <param name="elementName">The element's name.</param>
        /// <param name="visitor">The IPluginVisitor to call to.</param>
        private void HandleValueElement(XmlReader reader, string elementName, IPluginVisitor visitor)
        {
            string name = "Unknown";
            uint offset = 0;
            var pluginLine = (uint) (reader as IXmlLineInfo).LineNumber;
            bool visible = true;

            if (reader.MoveToAttribute("name"))
                name = reader.Value;
            if (reader.MoveToAttribute("offset"))
                offset = ParseUInt(reader.Value);
            if (reader.MoveToAttribute("visible"))
                visible = ParseBool(reader.Value);

            reader.MoveToElement();
            switch (elementName.ToLower())
            {
                case "uint8":
                case "byte":
                    visitor.VisitUInt8(name, offset, visible, pluginLine);
                    break;
                case "sbyte":
                case "int8":
                    visitor.VisitInt8(name, offset, visible, pluginLine);
                    break;
                case "ushort":
                case "uint16":
                    visitor.VisitUInt16(name, offset, visible, pluginLine);
                    break;
                case "short":
                case "int16":
                    visitor.VisitInt16(name, offset, visible, pluginLine);
                    break;
                case "dword":
                case "uint":
                case "uint32":
                case "long":
                case "true":
                    visitor.VisitUInt32(name, offset, visible, pluginLine);
                    break;
                case "int":
                case "int32":
                    visitor.VisitInt32(name, offset, visible, pluginLine);
                    break;
                case "undefined":
                case "unknown":
                    visitor.VisitUndefined(name, offset, visible, pluginLine);
                    break;
                case "float":
                case "float32":
                case "degree":
                    visitor.VisitFloat32(name, offset, visible, pluginLine);
                    break;
                case "vector3":
                    visitor.VisitVector3(name, offset, visible, pluginLine);
                    break;
                case "stringid":
                    visitor.VisitStringID(name, offset, visible, pluginLine);
                    break;
                case "tag":
                case "tagid":
                case "tagref":
                case "ident":
                    ReadTagRef(reader, name, offset, visible, visitor, pluginLine);
                    break;

                case "string":
                case "ascii":
                    ReadAscii(reader, name, offset, visible, visitor, pluginLine);
                    break;
                case "string32":
                    visitor.VisitAscii(name, offset, visible, 32, pluginLine);
                    break;
                case "string64":
                    visitor.VisitAscii(name, offset, visible, 64, pluginLine);
                    break;
                case "string256":
                    visitor.VisitAscii(name, offset, visible, 256, pluginLine);
                    break;

                case "unicode":
                case "utf16":
                    ReadUtf16(reader, name, offset, visible, visitor, pluginLine);
                    break;
                case "unicode32":
                    visitor.VisitUtf16(name, offset, visible, 32, pluginLine);
                    break;
                case "unicode64":
                    visitor.VisitUtf16(name, offset, visible, 64, pluginLine);
                    break;
                case "unicode256":
                    visitor.VisitUtf16(name, offset, visible, 256, pluginLine);
                    break;
//.........这里部分代码省略.........
开发者ID:Cloms,项目名称:Assembly,代码行数:101,代码来源:UniversalPluginLoader.cs


示例18: HandleTopLevelElement

 private void HandleTopLevelElement(XmlReader reader, string elementName, IPluginVisitor visitor)
 {
     if (elementName == "revisions")
         ReadRevisions(reader.ReadSubtree());
     else if (elementName == "revision")
         ReadRevision(reader);
     else
         HandleElement(reader, elementName, visitor);
 }
开发者ID:Cloms,项目名称:Assembly,代码行数:9,代码来源:UniversalPluginLoader.cs


示例19: HandleElement

        private void HandleElement(XmlReader reader, string elementName, IPluginVisitor visitor)
        {
            if (revisions.Count > 0)
            {
                DumpRevisions(visitor);
                revisions.Clear();
            }

            switch (elementName)
            {
                case "comment":
                    ReadComment(reader, visitor);
                    break;
                default:
                    HandleValueElement(reader, elementName, visitor);
                    break;
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:18,代码来源:UniversalPluginLoader.cs


示例20: ReadOption

        private static void ReadOption(XmlReader reader, IPluginVisitor visitor)
        {
            var name = "Unknown";
            var value = 0;

            if (reader.MoveToAttribute("name"))
                name = reader.Value;
            if (reader.MoveToAttribute("value"))
                value = ParseInt(reader.Value);

            visitor.VisitOption(name, value);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:12,代码来源:AssemblyPluginLoader.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IPoint类代码示例发布时间:2022-05-24
下一篇:
C# IPluginManager类代码示例发布时间: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