/// <summary> /// Tries to bind an RPC function, leaving returning null if it fails. /// </summary> /// <typeparam name="Input">Protobuf class used as an input</typeparam> /// <param name="client">Connection to Dwarf Fortress</param> /// <param name="name">Name of the RPC function to bind to</param> /// <param name="proto">Name of the protobuf file to use</param> /// <returns>Bound remote function on success, otherwise null.</returns> RemoteFunction <Input> CreateAndBind <Input>(RemoteClient client, string name, string proto = "") where Input : class, ProtoBuf.IExtensible, new() { RemoteFunction <Input> output = new RemoteFunction <Input>(); if (output.Bind(client, name, proto)) { return(output); } else { return(null); } }
TimedRemoteFunction <Input, Output> CreateAndBindTimed <Input, Output>(float interval, RemoteClient client, string name, string proto = "") where Input : class, ProtoBuf.IExtensible, new() where Output : class, ProtoBuf.IExtensible, new() { RemoteFunction <Input, Output> output = new RemoteFunction <Input, Output>(); if (output.Bind(client, name, proto)) { return(new TimedRemoteFunction <Input, Output>(interval, output)); } else { return(null); } }