Ejemplo n.º 1
0
 public ConnectionState()
 {
     network_client = new DFHack.RemoteClient(df_network_out);
     is_connected   = network_client.connect();
     if (!is_connected)
     {
         return;
     }
     net_block_request = new RemoteFortressReader.BlockRequest();
     MaterialListCall  = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     MaterialListCall.bind(network_client, "GetMaterialList", "RemoteFortressReader");
     TiletypeListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>();
     TiletypeListCall.bind(network_client, "GetTiletypeList", "RemoteFortressReader");
     BlockListCall = new RemoteFunction <RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>();
     BlockListCall.bind(network_client, "GetBlockList", "RemoteFortressReader");
     HashCheckCall = new RemoteFunction <dfproto.EmptyMessage>();
     HashCheckCall.bind(network_client, "CheckHashes", "RemoteFortressReader");
     UnitListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.UnitList>();
     UnitListCall.bind(network_client, "GetUnitList", "RemoteFortressReader");
     ViewInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>();
     ViewInfoCall.bind(network_client, "GetViewInfo", "RemoteFortressReader");
     MapInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MapInfo>();
     MapInfoCall.bind(network_client, "GetMapInfo", "RemoteFortressReader");
     MapResetCall = new RemoteFunction <dfproto.EmptyMessage>();
     MapResetCall.bind(network_client, "ResetMapHashes", "RemoteFortressReader");
 }
Ejemplo n.º 2
0
 // Bind the RPC functions we'll be calling
 void BindMethods()
 {
     materialListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     materialListCall.bind(networkClient, "GetMaterialList", "RemoteFortressReader");
     itemListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     itemListCall.bind(networkClient, "GetItemList", "RemoteFortressReader");
     tiletypeListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>();
     tiletypeListCall.bind(networkClient, "GetTiletypeList", "RemoteFortressReader");
     blockListCall = new RemoteFunction <RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>();
     blockListCall.bind(networkClient, "GetBlockList", "RemoteFortressReader");
     hashCheckCall = new RemoteFunction <dfproto.EmptyMessage>();
     hashCheckCall.bind(networkClient, "CheckHashes", "RemoteFortressReader");
     unitListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.UnitList>();
     unitListCall.bind(networkClient, "GetUnitList", "RemoteFortressReader");
     viewInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>();
     viewInfoCall.bind(networkClient, "GetViewInfo", "RemoteFortressReader");
     mapInfoCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.MapInfo>();
     mapInfoCall.bind(networkClient, "GetMapInfo", "RemoteFortressReader");
     mapResetCall = new RemoteFunction <dfproto.EmptyMessage>();
     mapResetCall.bind(networkClient, "ResetMapHashes", "RemoteFortressReader");
     buildingListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.BuildingList>();
     buildingListCall.bind(networkClient, "GetBuildingDefList", "RemoteFortressReader");
     worldMapCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.WorldMap>();
     worldMapCall.bind(networkClient, "GetWorldMap", "RemoteFortressReader");
     regionMapCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.RegionMaps>();
     regionMapCall.bind(networkClient, "GetRegionMaps", "RemoteFortressReader");
     creatureRawListCall = new RemoteFunction <dfproto.EmptyMessage, RemoteFortressReader.CreatureRawList>();
     creatureRawListCall.bind(networkClient, "GetCreatureRaws", "RemoteFortressReader");
 }
Ejemplo n.º 3
0
    /// <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);
        }
    }
Ejemplo n.º 4
0
    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);
        }
    }
Ejemplo n.º 5
0
 public ConnectionState()
 {
     network_client = new DFHack.RemoteClient(df_network_out);
     is_connected = network_client.connect();
     if (!is_connected) return;
     net_block_request = new RemoteFortressReader.BlockRequest();
     MaterialListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     MaterialListCall.bind(network_client, "GetMaterialList", "RemoteFortressReader");
     TiletypeListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>();
     TiletypeListCall.bind(network_client, "GetTiletypeList", "RemoteFortressReader");
     BlockListCall = new RemoteFunction<RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>();
     BlockListCall.bind(network_client, "GetBlockList", "RemoteFortressReader");
     HashCheckCall = new RemoteFunction<dfproto.EmptyMessage>();
     HashCheckCall.bind(network_client, "CheckHashes", "RemoteFortressReader");
     UnitListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.UnitList>();
     UnitListCall.bind(network_client, "GetUnitList", "RemoteFortressReader");
     ViewInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>();
     ViewInfoCall.bind(network_client, "GetViewInfo", "RemoteFortressReader");
     MapInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MapInfo>();
     MapInfoCall.bind(network_client, "GetMapInfo", "RemoteFortressReader");
     MapResetCall = new RemoteFunction<dfproto.EmptyMessage>();
     MapResetCall.bind(network_client, "ResetMapHashes", "RemoteFortressReader");
 }
Ejemplo n.º 6
0
 // Bind the RPC functions we'll be calling
 void BindMethods()
 {
     materialListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     materialListCall.bind(networkClient, "GetMaterialList", "RemoteFortressReader");
     itemListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MaterialList>();
     itemListCall.bind(networkClient, "GetItemList", "RemoteFortressReader");
     tiletypeListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.TiletypeList>();
     tiletypeListCall.bind(networkClient, "GetTiletypeList", "RemoteFortressReader");
     blockListCall = new RemoteFunction<RemoteFortressReader.BlockRequest, RemoteFortressReader.BlockList>();
     blockListCall.bind(networkClient, "GetBlockList", "RemoteFortressReader");
     hashCheckCall = new RemoteFunction<dfproto.EmptyMessage>();
     hashCheckCall.bind(networkClient, "CheckHashes", "RemoteFortressReader");
     unitListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.UnitList>();
     unitListCall.bind(networkClient, "GetUnitList", "RemoteFortressReader");
     viewInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.ViewInfo>();
     viewInfoCall.bind(networkClient, "GetViewInfo", "RemoteFortressReader");
     mapInfoCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.MapInfo>();
     mapInfoCall.bind(networkClient, "GetMapInfo", "RemoteFortressReader");
     mapResetCall = new RemoteFunction<dfproto.EmptyMessage>();
     mapResetCall.bind(networkClient, "ResetMapHashes", "RemoteFortressReader");
     buildingListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.BuildingList>();
     buildingListCall.bind(networkClient, "GetBuildingDefList", "RemoteFortressReader");
     worldMapCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.WorldMap>();
     worldMapCall.bind(networkClient, "GetWorldMap", "RemoteFortressReader");
     regionMapCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.RegionMaps>();
     regionMapCall.bind(networkClient, "GetRegionMaps", "RemoteFortressReader");
     creatureRawListCall = new RemoteFunction<dfproto.EmptyMessage, RemoteFortressReader.CreatureRawList>();
     creatureRawListCall.bind(networkClient, "GetCreatureRaws", "RemoteFortressReader");
 }