Inheritance: HasVersionRange
示例#1
0
 private static void MakeParameterOptional(UnityApiType type, string functionName, string parameterName, string justification)
 {
     foreach (var function in type.FindEventFunctions(functionName))
     {
         function.MakeParameterOptional(parameterName, justification);
     }
 }
示例#2
0
 private static void SetIsCoroutine(UnityApiType type, string functionName)
 {
     foreach (var function in type.FindEventFunctions(functionName))
     {
         function.SetIsCoroutine();
     }
 }
示例#3
0
        public static UnityApiType ImportFrom(XElement element, HasVersionRange apiVersions)
        {
            var ns   = element.Attribute("ns").Value;
            var name = element.Attribute("name").Value;
            var kind = element.Attribute("kind").Value;
            var path = element.Attribute("path").Value;
            var type = new UnityApiType(ns, name, kind, path, new Version(0, 0));

            type.ImportVersionRange(element, apiVersions);
            foreach (var message in element.Descendants("message"))
            {
                type.myEventFunctions.Add(UnityApiEventFunction.ImportFrom(message, type));
            }
            return(type);
        }
示例#4
0
        public static UnityApi ImportFrom(FileSystemPath apiXml)
        {
            var doc     = XDocument.Load(apiXml.FullPath);
            var apiNode = doc.FirstNode as XElement;

            if (apiNode?.Name != "api")
            {
                throw new InvalidDataException("Cannot find root api node");
            }
            var api = new UnityApi();

            api.ImportVersionRange(apiNode, null);
            foreach (var typeElement in apiNode.Descendants("type"))
            {
                api.myTypes.Add(UnityApiType.ImportFrom(typeElement, api));
            }
            return(api);
        }
示例#5
0
        public UnityApiType AddType(string ns, string name, string kind, string docPath, Version apiVersion)
        {
            UpdateSupportedVersion(apiVersion);

            foreach (var type in myTypes)
            {
                if (type.Namespace == ns && type.Name == name)
                {
                    // We don't actually use kind, but let's be aware of any issues
                    if (type.Kind != kind)
                    {
                        Console.WriteLine($"WARNING: Kind has changed from `{type.Kind}` to `{kind}` for `{name}`");
                    }

                    return type;
                }
            }

            var unityApiType = new UnityApiType(ns, name, kind, docPath, apiVersion);
            myTypes.Add(unityApiType);
            return unityApiType;
        }
示例#6
0
        public UnityApiType AddType(string ns, string name, string kind, string docPath, Version apiVersion)
        {
            UpdateSupportedVersion(apiVersion);

            foreach (var type in myTypes)
            {
                if (type.Namespace == ns && type.Name == name)
                {
                    // We don't actually use kind, but let's be aware of any issues
                    if (type.Kind != kind)
                    {
                        Console.WriteLine($"WARNING: Kind has changed from `{type.Kind}` to `{kind}` for `{name}`");
                    }

                    return(type);
                }
            }

            var unityApiType = new UnityApiType(ns, name, kind, docPath, apiVersion);

            myTypes.Add(unityApiType);
            return(unityApiType);
        }