public ProcedureSignature(string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes) { Name = procedureName; FullyQualifiedName = serviceName + "." + Name; Documentation = DocumentationUtils.ResolveCrefs(documentation); Handler = handler; GameScene = gameScene; Attributes = attributes.ToList(); Parameters = handler.Parameters.Select(x => new ParameterSignature(FullyQualifiedName, x)).ToList(); // Add parameter type attributes for (int position = 0; position < Parameters.Count; position++) { Attributes.AddRange(TypeUtils.ParameterTypeAttributes(position, Parameters [position].Type)); } var returnType = handler.ReturnType; HasReturnType = (returnType != typeof(void)); if (HasReturnType) { ReturnType = returnType; // Check it's a valid return type if (!TypeUtils.IsAValidType(returnType)) { throw new ServiceException(returnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName); } // Add return type attributes Attributes.AddRange(TypeUtils.ReturnTypeAttributes(returnType)); } }
public ProcedureSignature (string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes) { Name = procedureName; FullyQualifiedName = serviceName + "." + Name; Documentation = DocumentationUtils.ResolveCrefs (documentation); Handler = handler; GameScene = gameScene; Attributes = attributes.ToList (); Parameters = handler.Parameters.Select (x => new ParameterSignature (FullyQualifiedName, x)).ToList (); // Add parameter type attributes for (int position = 0; position < Parameters.Count; position++) Attributes.AddRange (TypeUtils.ParameterTypeAttributes (position, Parameters [position].Type)); var returnType = handler.ReturnType; HasReturnType = (returnType != typeof(void)); if (HasReturnType) { ReturnType = returnType; // Check it's a valid return type if (!TypeUtils.IsAValidType (returnType)) throw new ServiceException (returnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName); // Add return type attributes Attributes.AddRange (TypeUtils.ReturnTypeAttributes (returnType)); } }
public ProcedureSignature(string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes) { Name = procedureName; FullyQualifiedName = serviceName + "." + Name; Documentation = DocumentationUtils.ResolveCrefs(documentation); Handler = handler; GameScene = gameScene; Attributes = attributes.ToList(); Parameters = handler.Parameters.Select(x => new ParameterSignature(FullyQualifiedName, x)).ToList(); // Add parameter type attributes for (int position = 0; position < Parameters.Count; position++) { Attributes.AddRange(TypeUtils.ParameterTypeAttributes(position, Parameters [position].Type)); } // Create builders for the parameter types that are message types //ParameterBuilders = Parameters // .Select (x => { // try { // return ProtocolBuffers.IsAMessageType (x.Type) ? ProtocolBuffers.BuilderForMessageType (x.Type) : null; // } catch (ArgumentException) { // throw new ServiceException ("Failed to instantiate a message builder for parameter type " + x.Type.Name); // } //}).ToArray (); HasReturnType = (handler.ReturnType != typeof(void)); if (HasReturnType) { ReturnType = handler.ReturnType; // Check it's a valid return type if (!TypeUtils.IsAValidType(ReturnType)) { throw new ServiceException( ReturnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName); } // Add return type attributes Attributes.AddRange(TypeUtils.ReturnTypeAttributes(ReturnType)); // Create a builder if it's a message type //if (ProtocolBuffers.IsAMessageType (ReturnType)) { // try { // ReturnBuilder = ProtocolBuffers.BuilderForMessageType (ReturnType); // } catch (ArgumentException) { // throw new ServiceException ("Failed to instantiate a message builder for return type " + ReturnType.Name); // } //} } }
public ProcedureSignature(string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene, params string[] attributes) { Name = procedureName; FullyQualifiedName = serviceName + "." + Name; Documentation = DocumentationUtils.ResolveCrefs (documentation); Handler = handler; GameScene = gameScene; Attributes = attributes.ToList (); Parameters = handler.Parameters.Select (x => new ParameterSignature (FullyQualifiedName, x)).ToList (); // Add parameter type attributes for (int position = 0; position < Parameters.Count; position++) Attributes.AddRange (TypeUtils.ParameterTypeAttributes (position, Parameters [position].Type)); // Create builders for the parameter types that are message types ParameterBuilders = Parameters .Select (x => { try { return ProtocolBuffers.IsAMessageType (x.Type) ? ProtocolBuffers.BuilderForMessageType (x.Type) : null; } catch (ArgumentException) { throw new ServiceException ("Failed to instantiate a message builder for parameter type " + x.Type.Name); } }).ToArray (); HasReturnType = (handler.ReturnType != typeof(void)); if (HasReturnType) { ReturnType = handler.ReturnType; // Check it's a valid return type if (!TypeUtils.IsAValidType (ReturnType)) { throw new ServiceException ( ReturnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName); } // Add return type attributes Attributes.AddRange (TypeUtils.ReturnTypeAttributes (ReturnType)); // Create a builder if it's a message type if (ProtocolBuffers.IsAMessageType (ReturnType)) { try { ReturnBuilder = ProtocolBuffers.BuilderForMessageType (ReturnType); } catch (ArgumentException) { throw new ServiceException ("Failed to instantiate a message builder for return type " + ReturnType.Name); } } } }
internal ProcedureSignature(string serviceName, string procedureName, string documentation, IProcedureHandler handler, GameScene gameScene) { Name = procedureName; FullyQualifiedName = serviceName + "." + Name; Documentation = DocumentationUtils.ResolveCrefs(documentation); Handler = handler; GameScene = gameScene; Parameters = handler.Parameters.Select(x => new ParameterSignature(FullyQualifiedName, x)).ToList(); var returnType = handler.ReturnType; HasReturnType = (returnType != typeof(void)); if (HasReturnType) { ReturnType = returnType; // Check it's a valid return type if (!TypeUtils.IsAValidType(returnType)) { throw new ServiceException(returnType + " is not a valid Procedure return type, " + "in " + FullyQualifiedName); } ReturnIsNullable = handler.ReturnIsNullable; } var parts = procedureName.Split('_'); if (parts.Length == 2) { if (parts [0] == ("get")) { IsPropertyGetter = true; PropertyName = parts [1]; } else if (parts [0] == "set") { IsPropertySetter = true; PropertyName = parts [1]; } else { IsClassMember = true; ClassName = parts [0]; } } else if (parts.Length == 3) { if (parts [1] == "get") { IsClassMember = true; IsPropertyGetter = true; PropertyName = parts [2]; } else if (parts [1] == "set") { IsClassMember = true; ClassName = parts [0]; IsPropertySetter = true; PropertyName = parts [2]; } else if (parts [1] == "static") { IsClassMember = true; ClassName = parts [0]; IsStatic = true; } } }