예제 #1
0
        VkType GetOrAddType(string name)
        {
            if (allTypes.ContainsKey(name))
            {
                return(allTypes[name]);
            }

            // Could be one of the poorly-named enums
            var enumName = GetEnumName(name);

            if (allTypes.ContainsKey(enumName))
            {
                return(allTypes[enumName]);
            }

            var newType = new VkType();

            newType.Name = name;

            allTypes.Add(name, newType);
            return(newType);
        }
예제 #2
0
        void Replace(VkSpec spec, VkType existingType, VkType newType)
        {
            var vkStructs = spec.Structs.ToList();

            for (int x = 0; x < vkStructs.Count; x++)
            {
                var vkStruct = vkStructs[x];
                for (int y = 0; y < vkStruct.Members.Length; y++)
                {
                    var vkParam = vkStruct.Members[y];
                    if (vkParam.Type == existingType)
                    {
                        vkParam.Type = newType;
                    }
                }
            }

            var vkCommands = spec.Commands;

            for (int x = 0; x < vkCommands.Length; x++)
            {
                var vkCommand = vkCommands[x];
                for (int y = 0; y < vkCommand.Parameters.Length; y++)
                {
                    var vkParam = vkCommand.Parameters[y];
                    if (vkParam.Type == existingType)
                    {
                        vkParam.Type = newType;
                    }
                }

                if (vkCommand.ReturnType == existingType)
                {
                    vkCommand.ReturnType = newType;
                }
            }
        }