Exemple #1
0
 public static Messages.Services GetServices ()
 {
     var services = new Messages.Services ();
     foreach (var serviceSignature in Services.Instance.Signatures.Values) {
         var service = new Messages.Service (serviceSignature.Name);
         foreach (var procedureSignature in serviceSignature.Procedures.Values) {
             var procedure = new Procedure (procedureSignature.Name);
             if (procedureSignature.HasReturnType)
                 procedure.ReturnType = TypeUtils.GetTypeName (procedureSignature.ReturnType);
             foreach (var parameterSignature in procedureSignature.Parameters) {
                 var parameter = new Parameter (parameterSignature.Name, TypeUtils.GetTypeName (parameterSignature.Type));
                 if (parameterSignature.HasDefaultValue)
                     parameter.DefaultValue = parameterSignature.DefaultValue;
                 procedure.Parameters.Add (parameter);
             }
             foreach (var attribute in procedureSignature.Attributes)
                 procedure.Attributes.Add (attribute);
             if (procedureSignature.Documentation.Length > 0)
                 procedure.Documentation = procedureSignature.Documentation;
             service.Procedures.Add (procedure);
         }
         foreach (var clsSignature in serviceSignature.Classes.Values) {
             var cls = new Class (clsSignature.Name);
             if (clsSignature.Documentation.Length > 0)
                 cls.Documentation = clsSignature.Documentation;
             service.Classes.Add (cls);
         }
         foreach (var enmSignature in serviceSignature.Enumerations.Values) {
             var enm = new Enumeration (enmSignature.Name);
             if (enmSignature.Documentation.Length > 0)
                 enm.Documentation = enmSignature.Documentation;
             foreach (var enmValueSignature in enmSignature.Values) {
                 var enmValue = new EnumerationValue (enmValueSignature.Name, enmValueSignature.Value);
                 if (enmValueSignature.Documentation.Length > 0)
                     enmValue.Documentation = enmValueSignature.Documentation;
                 enm.Values.Add (enmValue);
             }
             service.Enumerations.Add (enm);
         }
         if (serviceSignature.Documentation.Length > 0)
             service.Documentation = serviceSignature.Documentation;
         services.ServicesList.Add (service);
     }
     return services;
 }
Exemple #2
0
        public static Messages.Services GetServices()
        {
            var services = new Messages.Services();

            foreach (var serviceSignature in Services.Instance.Signatures.Values)
            {
                var service = new Messages.Service(serviceSignature.Name);
                foreach (var procedureSignature in serviceSignature.Procedures.Values)
                {
                    var procedure = new Procedure(procedureSignature.Name);
                    if (procedureSignature.HasReturnType)
                    {
                        procedure.ReturnType = TypeUtils.GetTypeName(procedureSignature.ReturnType);
                    }
                    foreach (var parameterSignature in procedureSignature.Parameters)
                    {
                        var parameter = new Parameter(parameterSignature.Name, TypeUtils.GetTypeName(parameterSignature.Type));
                        if (parameterSignature.HasDefaultValue)
                        {
                            parameter.DefaultValue = parameterSignature.DefaultValue;
                        }
                        procedure.Parameters.Add(parameter);
                    }
                    foreach (var attribute in procedureSignature.Attributes)
                    {
                        procedure.Attributes.Add(attribute);
                    }
                    if (procedureSignature.Documentation.Length > 0)
                    {
                        procedure.Documentation = procedureSignature.Documentation;
                    }
                    service.Procedures.Add(procedure);
                }
                foreach (var clsSignature in serviceSignature.Classes.Values)
                {
                    var cls = new Class(clsSignature.Name);
                    if (clsSignature.Documentation.Length > 0)
                    {
                        cls.Documentation = clsSignature.Documentation;
                    }
                    service.Classes.Add(cls);
                }
                foreach (var enmSignature in serviceSignature.Enumerations.Values)
                {
                    var enm = new Enumeration(enmSignature.Name);
                    if (enmSignature.Documentation.Length > 0)
                    {
                        enm.Documentation = enmSignature.Documentation;
                    }
                    foreach (var enmValueSignature in enmSignature.Values)
                    {
                        var enmValue = new EnumerationValue(enmValueSignature.Name, enmValueSignature.Value);
                        if (enmValueSignature.Documentation.Length > 0)
                        {
                            enmValue.Documentation = enmValueSignature.Documentation;
                        }
                        enm.Values.Add(enmValue);
                    }
                    service.Enumerations.Add(enm);
                }
                if (serviceSignature.Documentation.Length > 0)
                {
                    service.Documentation = serviceSignature.Documentation;
                }
                services.ServicesList.Add(service);
            }
            return(services);
        }