C# && elm

Hello !
I’m new to programming,
I am currently studying C #.I’m new to programming,I am currently studying C #.
I want to try to implement logic on C #.
Create “warp-to-0-autopilot” for example.
But I can’t figure out how to connect files written in ELM to a C # project.
Maybe there is a sample code where this implementation is considered?

no one has any idea what libraries to use for logic written in C #?
If anyone knows which Sanderling libraries to use for C # code? Maybe I missed something somewhere, tell me where to look.
There is a library for reading EVE memory read-memory-64-bit.
There are libraries for processing incoming data from read-memory-64-bit ----- MemoryReading.elm, ParseUserInterface.elm, AppFramework.elm, VolatileHostScript.elm, VolatileHostInterface.elm, and so on. I don’t understand how data processing objects written in another language that does not compile into DLL can be connected to my project?
before, I received data through the DirectEve library, everything is clear and simple. It has been optimized for C #.
Here is an example of a drone interaction class:

using System;
using System.Linq;
using DirectEve;

public class Drones
{
    private double _armorPctTotal;
    private int _lastDroneCount;
    private DateTime _lastEngageCommand;
    private DateTime _lastRecallCommand;

    private int _recallCount;
    private DateTime _lastLaunch;
    private DateTime _lastRecall;

    private long _lastTarget;
    private DateTime _launchTimeout;
    private int _launchTries;
    private double _shieldPctTotal;
    private double _structurePctTotal;
    public bool recall = false;

    public DroneState State { get; set; }

    private double GetShieldPctTotal()
    {
        if (Cache.Instance.ActiveDrones.Count() == 0)
            return 0;

        return Cache.Instance.ActiveDrones.Sum(d => d.ShieldPct);
    }

    private double GetArmorPctTotal()
    {
        if (Cache.Instance.ActiveDrones.Count() == 0)
            return 0;

        return Cache.Instance.ActiveDrones.Sum(d => d.ArmorPct);
    }

    private double GetStructurePctTotal()
    {
        if (Cache.Instance.ActiveDrones.Count() == 0)
            return 0;

        return Cache.Instance.ActiveDrones.Sum(d => d.StructurePct);
    }

 
    private EntityCache GetTarget()
    {
        
        var droneTarget = Cache.Instance.EntityById(_lastTarget);

       
        return Cache.Instance.GetBestTarget(droneTarget, Settings.Instance.DroneControlRange, true);
    }

   
    private void EngageTarget()
    {
        var target = GetTarget();

        
        if (target == null)
            return;

        if (target.IsBadIdea)
            return;

       
        if (_lastTarget == target.Id && DateTime.Now.Subtract(_lastEngageCommand).TotalSeconds < 15)
            return;

        
        var mustEngage = false;
        foreach (var drone in Cache.Instance.ActiveDrones)
            mustEngage |= drone.FollowId != target.Id;
        if (!mustEngage)
            return;

       
        if (target.IsActiveTarget)
        {
           
            _lastTarget = target.Id;

            
            Logging.Log("Drones: Engaging drones on [" + target.Name + "][ID: " + target.Id + "]" + Math.Round(target.Distance / 1000, 0) + "k away]");
            Cache.Instance.DirectEve.ExecuteCommand(DirectCmd.CmdDronesEngage);
            _lastEngageCommand = DateTime.Now;
        }
        else 
        {
            target.MakeActiveTarget();
            Logging.Log("Drones: Making [" + target.Name + "][ID: " + target.Id + "]" + Math.Round(target.Distance/1000,0) + "k away] the active target for drone engagement.");
        }
    }

    public void ProcessState()
    {
        if (!Settings.Instance.UseDrones)
            return;

        switch (State)
        {
            case DroneState.WaitingForTargets:
                
                if (Cache.Instance.ActiveDrones.Count() > 0)
                {
                    
                    State = DroneState.Fighting;
                    break;
                }

              
                var launch = true;
                
                if (!Cache.Instance.PriorityTargets.Any(pt => pt.IsWarpScramblingMe))
                {
                    
                    launch &= !Cache.Instance.IsMissionPocketDone;

                   
                    launch &= Cache.Instance.DirectEve.ActiveShip.ShieldPercentage >= Settings.Instance.DroneMinimumShieldPct;
                    launch &= Cache.Instance.DirectEve.ActiveShip.ArmorPercentage >= Settings.Instance.DroneMinimumArmorPct;
                    launch &= Cache.Instance.DirectEve.ActiveShip.CapacitorPercentage >= Settings.Instance.DroneMinimumCapacitorPct;

                    
                    launch &= Cache.Instance.TargetedBy.Count(e => !e.IsSentry && e.CategoryId == (int)CategoryID.Entity && e.IsNpc && !e.IsContainer && e.GroupId != (int)Group.LargeCollidableStructure && e.Distance < Settings.Instance.DroneControlRange) > 0;

                    
                    if (_lastLaunch < _lastRecall && _lastRecall.Subtract(_lastLaunch).TotalSeconds < 30)
                    {
                        if (_lastRecall.AddSeconds(5 * _recallCount + 5) < DateTime.Now)
                        {
                           
                            _recallCount++;

                            
                            if (_recallCount > 5)
                                _recallCount = 5;
                        }
                        else
                        {
                            
                            launch = false;
                        }
                    }
                    else 
                        _recallCount = 0;
                }

                if (launch)
                {
                    
                    _launchTries = 0;
                    _lastLaunch = DateTime.Now;
                    State = DroneState.Launch;
                }
                break;

            case DroneState.Launch:
               
                recall = false;
                _launchTimeout = DateTime.Now;
                Cache.Instance.DirectEve.ActiveShip.LaunchAllDrones();
                State = DroneState.Launching;
                break;

            case DroneState.Launching:
                
                if (Cache.Instance.ActiveDrones.Count() == 0)
                {
                    if (DateTime.Now.Subtract(_launchTimeout).TotalSeconds > 10)
                    {
                        
                        if (_launchTries < 10)
                        {
                            _launchTries++;
                            State = DroneState.Launch;
                            break;
                        }
                        else
                            State = DroneState.OutOfDrones;
                    }
                    break;
                }

              
                if (_lastDroneCount == Cache.Instance.ActiveDrones.Count())
                    State = DroneState.Fighting;
                break;

            case DroneState.OutOfDrones:
                
                break;
            case DroneState.Fighting:
                
                
                
                if (Cache.Instance.TargetedBy.Count(e => !e.IsSentry && e.IsNpc && e.Distance < Settings.Instance.DroneControlRange) == 0)
                {
                    Logging.Log("Drones: Recalling drones because no NPC is targeting us within dronerange");
                    recall = true;
                }

                if (Cache.Instance.IsMissionPocketDone)
                {
                    Logging.Log("Drones: Recalling drones because we are done with this pocket.");
                    recall = true;
                }
                else if (_shieldPctTotal > GetShieldPctTotal())
                {
                    Logging.Log("Drones: Recalling drones because we have lost shields! [Old: " + _shieldPctTotal.ToString("N2") + "][New: " + GetShieldPctTotal().ToString("N2") + "]");
                    recall = true;
                }
                else if (_armorPctTotal > GetArmorPctTotal())
                {
                    Logging.Log("Drones: Recalling drones because we have lost armor! [Old:" + _armorPctTotal.ToString("N2") + "][New: " + GetArmorPctTotal().ToString("N2") + "]");
                    recall = true;
                }
                else if (_structurePctTotal > GetStructurePctTotal())
                {
                    Logging.Log("Drones: Recalling drones because we have lost structure! [Old:" + _structurePctTotal.ToString("N2") + "][New: " + GetStructurePctTotal().ToString("N2") + "]");
                    recall = true;
                }
                else if (Cache.Instance.ActiveDrones.Count() < _lastDroneCount)
                {
                    
                    Logging.Log("Drones: Recalling drones because we have lost a drone! [Old:" + _lastDroneCount + "][New: " + Cache.Instance.ActiveDrones.Count() + "]");
                    recall = true;
                }
                else
                {
                    
                    var lowShieldWarning = Settings.Instance.LongRangeDroneRecallShieldPct;
                    var lowArmorWarning = Settings.Instance.LongRangeDroneRecallArmorPct;
                    var lowCapWarning = Settings.Instance.LongRangeDroneRecallCapacitorPct;

                    if (Cache.Instance.ActiveDrones.Average(d => d.Distance) < (Settings.Instance.DroneControlRange/2d))
                    {
                        lowShieldWarning = Settings.Instance.DroneRecallShieldPct;
                        lowArmorWarning = Settings.Instance.DroneRecallArmorPct;
                        lowCapWarning = Settings.Instance.DroneRecallCapacitorPct;
                    }

                    if (Cache.Instance.DirectEve.ActiveShip.ShieldPercentage < lowShieldWarning)
                    {
                        Logging.Log("Drones: Recalling drones due to shield [" + Cache.Instance.DirectEve.ActiveShip.ShieldPercentage + "%] below [" + lowShieldWarning + "%] minimum");
                        recall = true;
                    }
                    else if (Cache.Instance.DirectEve.ActiveShip.ArmorPercentage < lowArmorWarning)
                    {
                        Logging.Log("Drones: Recalling drones due to armor [" + Cache.Instance.DirectEve.ActiveShip.ArmorPercentage + "%] below [" + lowArmorWarning + "%] minimum");
                        recall = true;
                    }
                    else if (Cache.Instance.DirectEve.ActiveShip.CapacitorPercentage < lowCapWarning)
                    {
                        Logging.Log("Drones: Recalling drones due to capacitor [" + Cache.Instance.DirectEve.ActiveShip.CapacitorPercentage + "%] below [" + lowCapWarning + "%] minimum");
                        recall = true;
                    }
                }

                if (Cache.Instance.ActiveDrones.Count() == 0)
                {
                    Logging.Log("Drones: Apparently we have lost all our drones");
                    recall = true;
                }
                else
                {
                    var isPanicking = false;
                    isPanicking |= Cache.Instance.DirectEve.ActiveShip.ShieldPercentage < Settings.Instance.MinimumShieldPct;
                    isPanicking |= Cache.Instance.DirectEve.ActiveShip.ArmorPercentage < Settings.Instance.MinimumArmorPct;
                    isPanicking |= Cache.Instance.DirectEve.ActiveShip.CapacitorPercentage < Settings.Instance.MinimumCapacitorPct;
                    if (Cache.Instance.PriorityTargets.Any(pt => pt.IsWarpScramblingMe) && recall)
                    {
                        Logging.Log("Drones: Overriding drone recall, we are scrambled!");
                        recall = false;
                    }
                }

                
                if (recall)
                    State = DroneState.Recalling;
                else
                {
                    EngageTarget();

                   
                    if (Cache.Instance.ActiveDrones.Count() < _lastDroneCount)
                        State = DroneState.Launch;
                }
                break;

            case DroneState.Recalling:
                
                if (Cache.Instance.ActiveDrones.Count() == 0)
                {
                    _lastRecall = DateTime.Now;
                    recall = false;
                    State = DroneState.WaitingForTargets;
                    break;
                }

               
                if (DateTime.Now.Subtract(_lastRecallCommand).TotalSeconds > 5)
                {
                    Cache.Instance.DirectEve.ExecuteCommand(DirectCmd.CmdDronesReturnToBay);
                    _lastRecallCommand = DateTime.Now;
                }
                break;
        }

        
        _shieldPctTotal = GetShieldPctTotal();
        _armorPctTotal = GetArmorPctTotal();
        _structurePctTotal = GetStructurePctTotal();
        _lastDroneCount = Cache.Instance.ActiveDrones.Count();
    }
}

}

  • Пункт первый

I want to rewrite the logic for interacting with Sanderling.
Because DirectEve works through injections at the DirectX level.
Tell me where to dig.

And forgive me for my French)))

The place to look is the releases section on Github here: Release Release v2020-04-12 · Arcitectus/Sanderling · GitHub

The .net assembly in read-memory-64-bit.dll should be good to use from C#.

To avoid confusion: Using the .NET assembly is not necessary for bot development. This is only for cases where your goal is to use C#. Usually, the bot logic is coded using the Elm programming language or automatically derived from training data.