コード例 #1
0
ファイル: Dna.cs プロジェクト: portalmk2/BulletSharpPInvoke
            public override bool Equals(object obj)
            {
                ElementDecl other = obj as ElementDecl;

                if (other == null)
                {
                    return(false);
                }
                return(Type.Equals(other.Type) && NameInfo.Equals(other.NameInfo));
            }
コード例 #2
0
 /// <summary>
 /// Attribute objects are reused during parsing to reduce memory allocations,
 /// hence the Reset method.
 /// </summary>
 public void Reset(string name, XmlNodeType nt, string value)
 {
     Value             = value;
     Name              = name;
     NodeType          = nt;
     Space             = XmlSpace.None;
     XmlLang           = null;
     IsEmpty           = true;
     _attributes.Count = 0;
     DtdType           = null;
 }
コード例 #3
0
ファイル: BatchFilesProcessor.cs プロジェクト: avgx/knigoskop
        private void ProcessElement(FictionBook fictionBook, XmlNode node, List <XmlElement> invalidNodes)
        {
            foreach (XmlNode childNode in node.ChildNodes)
            {
                ProcessElement(fictionBook, childNode, invalidNodes);
            }

            switch (node.NodeType)
            {
            case XmlNodeType.Text:
                string text = node.InnerText;

                text = bullets.Replace(text, new MatchEvaluator(delegate(Match match)
                {
                    fictionBook.ModificationType = ModificationType.Text;
                    return("-");
                }));

                text = invalidChars.Replace(text, new MatchEvaluator(delegate(Match match)
                {
                    fictionBook.ModificationType = ModificationType.Text;
                    return(" ");
                }));

                node.InnerText = text;

                //node.InnerText = invalidChars.Replace(bullets.Replace(node.InnerText, "-"), " ");
                break;

            case XmlNodeType.Element:
                ElementDecl elementDecl = this.fb2Dtd.FindElement(node.LocalName);
                if (elementDecl == null)
                {
                    invalidNodes.Add(node as XmlElement);
                }
                break;
            }
        }
コード例 #4
0
ファイル: WsdlParser.cs プロジェクト: JianwenSun/cc
 // Add a new element declaration to the namespace
 internal void AddElementDecl(ElementDecl elmDecl){
     Util.Log("URTNamespace.AddElementDecl ");
     _elmDecls.Add(elmDecl);
 }
コード例 #5
0
ファイル: Dna.cs プロジェクト: Cyberbanan/BulletSharpUnity3d
 public int GetElementSize(ElementDecl element)
 {
     return element.Name.ArraySizeNew * (element.Name.IsPointer ? _ptrLen : element.Type.Length);
 }
コード例 #6
0
ファイル: Dna.cs プロジェクト: PowerOfCode/BulletSharpPInvoke
 public int GetElementSize(ElementDecl element)
 {
     int typeLength = element.NameInfo.IsPointer ? _ptrLen : element.Type.Length;
     return element.NameInfo.ArrayLength * typeLength;
 }
コード例 #7
0
ファイル: Dna.cs プロジェクト: PowerOfCode/BulletSharpPInvoke
 public StructDecl(TypeDecl type, ElementDecl[] elements)
 {
     Type = type;
     Elements = elements;
 }
コード例 #8
0
ファイル: Dna.cs プロジェクト: PowerOfCode/BulletSharpPInvoke
        private void Init(BulletReader reader, bool swap)
        {
            if (swap)
            {
                throw new NotImplementedException();
            }

            Stream stream = reader.BaseStream;
            reader.ReadTag("SDNA");

            // Element names
            reader.ReadTag("NAME");
            string[] names = reader.ReadStringList();
            var nameInfos = names
                .Select(n => new NameInfo(n))
                .ToArray();
            _hasIntType = names.Contains("int");

            // Types
            reader.ReadTag("TYPE");
            string[] typeNames = reader.ReadStringList();
            stream.Position = (stream.Position + 3) & ~3;

            reader.ReadTag("TLEN");
            TypeDecl[] types = typeNames.Select(name =>
            {
                short length = reader.ReadInt16();
                if (_ptrLen == 0 && name == "ListBase")
                {
                    _ptrLen = length / 2;
                }
                return new TypeDecl(name, length);
            }).ToArray();
            stream.Position = (stream.Position + 3) & ~3;

            // Structs
            reader.ReadTag("STRC");
            int numStructs = reader.ReadInt32();
            _structs = new StructDecl[numStructs];
            _structByTypeName = new Dictionary<string, StructDecl>(numStructs);
            for (int i = 0; i < numStructs; i++)
            {
                short typeIndex = reader.ReadInt16();
                TypeDecl structType = types[typeIndex];

                int numElements = reader.ReadInt16();
                var elements = new ElementDecl[numElements];
                for (int j = 0; j < numElements; j++)
                {
                    typeIndex = reader.ReadInt16();
                    short nameIndex = reader.ReadInt16();
                    elements[j] = new ElementDecl(types[typeIndex], nameInfos[nameIndex]);
                }

                var structDecl = new StructDecl(structType, elements);
                structType.Struct = structDecl;
                _structs[i] = structDecl;
                _structByTypeName.Add(structType.Name, structDecl);
            }
        }
コード例 #9
0
ファイル: Dna.cs プロジェクト: portalmk2/BulletSharpPInvoke
        private void Init(BulletReader reader, bool swap)
        {
            if (swap)
            {
                throw new NotImplementedException();
            }

            Stream stream = reader.BaseStream;

            reader.ReadTag("SDNA");

            // Element names
            reader.ReadTag("NAME");
            string[] names     = reader.ReadStringList();
            var      nameInfos = names
                                 .Select(n => new NameInfo(n))
                                 .ToArray();

            _hasIntType = names.Contains("int");

            // Types
            reader.ReadTag("TYPE");
            string[] typeNames = reader.ReadStringList();
            stream.Position = (stream.Position + 3) & ~3;

            reader.ReadTag("TLEN");
            TypeDecl[] types = typeNames.Select(name =>
            {
                short length = reader.ReadInt16();
                if (_ptrLen == 0 && name == "ListBase")
                {
                    _ptrLen = length / 2;
                }
                return(new TypeDecl(name, length));
            }).ToArray();
            stream.Position = (stream.Position + 3) & ~3;

            // Structs
            reader.ReadTag("STRC");
            int numStructs = reader.ReadInt32();

            _structs          = new StructDecl[numStructs];
            _structByTypeName = new Dictionary <string, StructDecl>(numStructs);
            for (int i = 0; i < numStructs; i++)
            {
                short    typeIndex  = reader.ReadInt16();
                TypeDecl structType = types[typeIndex];

                int numElements = reader.ReadInt16();
                var elements    = new ElementDecl[numElements];
                for (int j = 0; j < numElements; j++)
                {
                    typeIndex = reader.ReadInt16();
                    short nameIndex = reader.ReadInt16();
                    elements[j] = new ElementDecl(types[typeIndex], nameInfos[nameIndex]);
                }

                var structDecl = new StructDecl(structType, elements);
                structType.Struct = structDecl;
                _structs[i]       = structDecl;
                _structByTypeName.Add(structType.Name, structDecl);
            }
        }
コード例 #10
0
ファイル: Dna.cs プロジェクト: portalmk2/BulletSharpPInvoke
        public int GetElementSize(ElementDecl element)
        {
            int typeLength = element.NameInfo.IsPointer ? _ptrLen : element.Type.Length;

            return(element.NameInfo.ArrayLength * typeLength);
        }
コード例 #11
0
 public int GetElementSize(ElementDecl element)
 {
     return(element.Name.ArraySizeNew * (element.Name.IsPointer ? _ptrLen : element.Type.Length));
 }