예제 #1
0
        private void OnAgentRemove(object obj)
        {
            var agent = Agents.FirstOrDefault(a => a.AgentId.Equals(SelectedAgent.AgentId));

            AgentAPI.RemoveAgent(agent.AgentId);
            Agents.Remove(agent);
        }
예제 #2
0
        private async void GetAgentData()
        {
            var agentData = await AgentAPI.GetAgentData();

            if (agentData != null)
            {
                foreach (var agent in agentData)
                {
                    if (!Agents.Any(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase)))
                    {
                        Agents.Add(new Agent
                        {
                            AgentId      = agent.Metadata.AgentID,
                            Hostname     = agent.Metadata.Hostname,
                            IpAddress    = agent.Metadata.IPAddress,
                            Identity     = agent.Metadata.Identity,
                            ProcessName  = agent.Metadata.ProcessName,
                            ProcessId    = agent.Metadata.ProcessID,
                            Arch         = agent.Metadata.Arch.ToString(),
                            CLR          = agent.Metadata.CLR,
                            Integrity    = agent.Metadata.Integrity.ToString(),
                            AgentModules = agent.LoadModules,
                            LastSeen     = Helpers.CalculateTimeDiff(agent.LastSeen)
                        });
                    }
                    else
                    {
                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .Hostname = agent.Metadata.Hostname;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .IpAddress = agent.Metadata.IPAddress;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .Identity = agent.Metadata.Identity;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .ProcessName = agent.Metadata.ProcessName;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .ProcessId = agent.Metadata.ProcessID;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .Arch = agent.Metadata.Arch.ToString();

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .CLR = agent.Metadata.CLR;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .Integrity = agent.Metadata.Integrity.ToString();

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .AgentModules = agent.LoadModules;

                        Agents.FirstOrDefault(a => a.AgentId.Equals(agent.Metadata.AgentID, StringComparison.OrdinalIgnoreCase))
                        .LastSeen = Helpers.CalculateTimeDiff(agent.LastSeen);
                    }
                }
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            //powtarzamy czynnosci az nam się uda
            while (true)
            {
            	
                             //nie rozumiem ponizszego - po co przekazywac metode nasluchujaca ??
                agentTomek = new AgentAPI(Listen); //tworzymy nowe AgentAPI, podając w parametrze naszą metodę nasłuchującą

                // pobieramy parametry połączenia i agenta z klawiatury
                Console.Write("Podaj IP serwera: ");
                String ip = Console.ReadLine();

                Console.Write("Podaj nazwe druzyny: ");
                String groupname = Console.ReadLine();

                Console.Write("Podaj haslo: ");
                String grouppass = Console.ReadLine();

                Console.Write("Podaj nazwe swiata: ");
                String worldname = Console.ReadLine();
                    
                Console.Write("Podaj imie: ");      
                String imie = Console.ReadLine();

                try
                {
                    //łączymy się z serwerem. Odbieramy parametry świata i wyświetlamy je      
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    //ustawiamy nasza energie na poczatkowa energie kazdego agenta w danym swiecie
                    energy = cennikSwiata.initialEnergy;
                    //przechodzimy do obslugi zdarzen z klawiatury. Zamiast tej funkcji wstaw logikę poruszania się twojego agenta.        
                    KeyReader();
                    //na koncu rozlaczamy naszego agenta
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                //w przypadku mało poważnego błędu, jak podanie złego hasła, rzucany jest wyjątek NonCriticalException; zaczynamy od nowa
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                // w przypadku każdego innego wyjątku niż NonCriticalException powinniśmy zakończyć program; taki wyjątek nie powinien się zdarzyć
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                }
            }
        }
예제 #4
0
        private void OnAgentCommand(object obj)
        {
            var agent   = MainViewModel.Agents.FirstOrDefault(a => a.AgentId.Equals(AgentId, StringComparison.OrdinalIgnoreCase));
            var command = AgentCommand;

            if (command.Equals("help", StringComparison.OrdinalIgnoreCase))
            {
                AgentOutput += "\nAgent Commands\n";
                AgentOutput += "==============\n\n";
                AgentOutput += AgentCommands.GetModuletHelpText(agent.AgentModules);
                AgentOutput += "\n\n";
                ClearCommandInput();
                return;
            }
            else if (command.Equals("clear", StringComparison.OrdinalIgnoreCase))
            {
                AgentAPI.ClearCommandQueue(AgentId);
                AgentOutput += $"\n[*] Commands cleared\n";
                ClearCommandInput();
                return;
            }

            var split = command.Split(" ");

            if (split.Length < 2)
            {
                AgentOutput += $"\n[-] Invalid syntax. Usage: [module] [command] [args]\n";
                ClearCommandInput();
                return;
            }

            var mod = split[0];
            var cmd = split[1];

            if (!agent.AgentModules.Any(m => m.Name.Equals(mod, StringComparison.OrdinalIgnoreCase)))
            {
                AgentOutput += $"\n[-] {mod} module not found\n";
                ClearCommandInput();
                return;
            }

            var moduleCommands = agent.AgentModules.Where(m => m.Name.Equals(mod, StringComparison.OrdinalIgnoreCase))
                                 .Select(c => c.Commands).FirstOrDefault();

            if (!moduleCommands.Any(c => c.Name.Equals(cmd, StringComparison.OrdinalIgnoreCase)))
            {
                AgentOutput += $"\n[-] {cmd} not found in module {mod}\n";
                ClearCommandInput();
                return;
            }

            var args = string.Join(" ", split[2..]);
예제 #5
0
파일: Program.cs 프로젝트: adamwie/KCK
        static void Main(string[] args)
        {
            try
            {
                // Tworzymy instancję naszego agenta
                agent = new AgentAPI(Listen);

                // Dane do świata
                String ip = "atlantyda.vm.wmi.amu.edu.pl";
                String groupname = "VGrupa1";
                String grouppass = "******";
                String worldname = "VGrupa1";
                Random r = new Random();
                String imie = agentName = "Sasha" + r.Next(1, 999);

                // Próbujemy się połączyć z serwerem
                worldParameters = agent.Connect(ip, 6008, groupname, grouppass, worldname, imie);

                // Inicjalizacja energii
                energy = worldParameters.initialEnergy;

                // Uruchamiamy agenta bez zbędnych komunikatów
                debugMode = true;

                Console.WriteLine("Wcisnij dowolny klawisz, aby uruchomic agenta.");
                Console.ReadKey();

                while (true)
                {
                    try
                    {
                        DoBestMovement();
                    }
                    catch (NonCriticalException ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadKey();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadKey();
                        break;
                    }
                    //System.Threading.Thread.Sleep(2000);
                }

                // Kończymy
                agent.Disconnect();
            }
            catch
            {
                Console.WriteLine("Wystapily jakies bledy przy podlaczaniu do swiata! :(");
            }

            Console.ReadKey();
        }
예제 #6
0
        static AgentCollection GetMachData()
        {
            AgentCollection col = AgentAPI.GetAllAgents();

            return(col);
        }
예제 #7
0
        static void Main(string[] args)
        {
            //powtarzamy czynnosci az nam się uda
            while (true)
            {

                             //nie rozumiem ponizszego - po co przekazywac metode nasluchujaca ??
                agentTomek = new AgentAPI(Listen); //tworzymy nowe AgentAPI, podając w parametrze naszą metodę nasłuchującą

                // pobieramy parametry połączenia i agenta z klawiatury
                Console.Write("Podaj IP serwera: ");
                String ip = Console.ReadLine();

                Console.Write("Podaj nazwe druzyny: ");
                String groupname = Console.ReadLine();

                Console.Write("Podaj haslo: ");
                String grouppass = Console.ReadLine();

                Console.Write("Podaj nazwe swiata: ");
                String worldname = Console.ReadLine();

                Console.Write("Podaj imie: ");
                String imie = Console.ReadLine();

                try
                {
                    //łączymy się z serwerem. Odbieramy parametry świata i wyświetlamy je
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    //ustawiamy nasza energie na poczatkowa energie kazdego agenta w danym swiecie
                    energy = cennikSwiata.initialEnergy;
                    //przechodzimy do obslugi zdarzen z klawiatury. Zamiast tej funkcji wstaw logikę poruszania się twojego agenta.
                    KeyReader();
                    //na koncu rozlaczamy naszego agenta
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                //w przypadku mało poważnego błędu, jak podanie złego hasła, rzucany jest wyjątek NonCriticalException; zaczynamy od nowa
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                // w przypadku każdego innego wyjątku niż NonCriticalException powinniśmy zakończyć program; taki wyjątek nie powinien się zdarzyć
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                }
            }
        }
예제 #8
0
        static void Main(string[] args)
        {


            Console.WriteLine("0 - atlantyda.vm, 1 - localhost");
            String ktory = Console.ReadLine();
            int liczba = Int32.Parse(ktory);

            punkty.Add(new MapPoint(0, 0, true, 0, false, 0, 2));
            while (true)
            {
                agentTomek = new AgentAPI(Listen);

                String ip = Settings.serverIP;
                String groupname = Settings.groupname;
                String grouppass = Settings.grouppass;

                if (liczba == 0) ip = "atlantyda.vm.wmi.amu.edu.pl";
                else ip = "localhost";
                groupname = "ZeloweMisie";
                if (liczba == 0) grouppass = "******";
                else grouppass = "******";

                Console.Write("Podaj nazwe swiata: ");
                String worldname = Console.ReadLine();

                Console.Write("Podaj imie: ");
                imie = Console.ReadLine();

                string fileName = "Default.aiml";
                string sourcePath = @".\aiml\schemat\";
                string targetPath = @".\aiml\";
                if (File.Exists("aiml\\" + imie + ".aiml"))
                    File.Delete("aiml\\" + imie + ".aiml");
                string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
                string destFile = System.IO.Path.Combine(targetPath, imie + ".aiml");
                File.Copy(sourceFile, destFile);
                DoAIML aiml = new DoAIML(imie + ".aiml");
                aiml.zapis("imie", imie);
                myBot = new cBot(false);
                try
                {
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    energy = cennikSwiata.initialEnergy;

                    KeyReader();
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                    break;
                }
            }
        }
예제 #9
0
        static void Main(string[] args)
        {
            //powtarzamy czynnosci az nam się uda
            while (true)
            {
                agentVLuke_Jones = new AgentAPI(Listen); //tworzymy nowe AgentAPI,
                //podając w parametrze naszą metodę nasłuchującą

                // pobieramy parametry połączenia i agenta z klawiatury
                Console.Write("Wczytano IP serwera.\n");
                String ip = "atlantyda.vm.wmi.amu.edu.pl";

                Console.Write("Wczytano nazwe druzyny.\n");
                groupname = "VLuke_Jones";

                Console.Write("Wprowadzono haslo.\n");
                String grouppass = "******";

                Console.Write("Podaj nazwe swiata: ");
                String worldname = Console.ReadLine();

                Console.Write("Podaj imie: ");
                imie = Console.ReadLine();

                try
                {
                    //łączymy się z serwerem. Odbieramy parametry świata i wyświetlamy je
                    cennikSwiata = agentVLuke_Jones.Connect(ip, 6008, groupname, grouppass,
                        worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    smallestCost = cennikSwiata.moveCost;
                    if (smallestCost > cennikSwiata.rotateCost)
                        smallestCost = cennikSwiata.rotateCost;
                    if (smallestCost > cennikSwiata.speakCost)
                        smallestCost = cennikSwiata.speakCost;
                    kosztDoZrodla = -1;

                    Console.Write("Wybierz tryb:\n(0)Random\n(1)SmartBot\n(2)Klawiatura\n");
                    String tryb = Console.ReadLine();

                    pozycjaRozmowcy = new int[2];
                    pozycjaRozmowcy[0] = -1000;
                    pozycjaRozmowcy[1] = -1000;
                    kierunekRozmowcy = 0;
                    czyRozmawiam = false;
                    gracz = false;

                    myBot = new AIMLbot.Bot();
                    myBot.loadSettings();
                    myBot.loadAIMLFromFiles();

                    //ustawiamy nasza energie na poczatkowa energie kazdego agenta w danym swiecie
                    myEnergy = cennikSwiata.initialEnergy;
                    if (tryb == "0")
                        Zachowanie("Random");
                    if (tryb == "1")
                        Zachowanie("SmartBot");
                    if (tryb == "2")
                    {
                        gracz = true;
                        KeyReader();
                    }
                    //na koncu rozlaczamy naszego agenta
                    try
                    {
                        agentVLuke_Jones.Disconnect();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Disconnected with problems! " + e.Message);
                    }
                    Console.ReadKey();
                    break;
                }
                //w przypadku mało poważnego błędu, jak podanie złego hasła,
                //rzucany jest wyjątek NonCriticalException; zaczynamy od nowa
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                // w przypadku każdego innego wyjątku niż NonCriticalException
                //powinniśmy zakończyć program; taki wyjątek nie powinien się zdarzyć
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                }
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            while (true)
            {
                    agentTomek = new AgentAPI(Listen);

                String ip = Settings.serverIP;
                String groupname = Settings.groupname;
                String grouppass = Settings.grouppass;

                if (ip == null)
                {
                    Console.Write("Podaj IP serwera: ");
                    ip = Console.ReadLine();
                }
                if (groupname == null)
                {
                    Console.Write("Podaj nazwe druzyny: ");
                    groupname = "VGrupaX";// Console.ReadLine();
                }
                if (grouppass == null)
                {
                    Console.Write("Podaj haslo: ");
                    grouppass = "******"; //Console.ReadLine();
                }

                Console.Write("Podaj nazwe swiata: ");
                String worldname = "VGrupaX"; //Console.ReadLine();

                Console.Write("Podaj imie: ");
                String imie = Console.ReadLine();

                try
                {
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    energy = cennikSwiata.initialEnergy;
                    lookMatrixW = cennikSwiata.sightScope;
                    lookMatrixW = lookMatrixW * lookMatrixW + 1;
                    lookMatrix = new String[lookMatrixW][];
                    for (int i = 0; i < lookMatrixW; i++)
                        lookMatrix[i] = new String[lookMatrixW];
                    Alive();
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                    break;
                }
            }
        }
예제 #11
0
 private void OnAgentExit(object obj)
 {
     AgentAPI.SubmitAgentCommand(SelectedAgent.AgentId, "core", "exit");
 }
예제 #12
0
        static void Main(string[] args)
        {
            while (true)
            {
                agentTomek = new AgentAPI(Listen);

                String ip        = Settings.serverIP;
                String groupname = Settings.groupname;
                String grouppass = Settings.grouppass;

                if (ip == null)
                {
                    Console.Write("Podaj IP serwera: ");
                    ip = Console.ReadLine();
                }
                if (groupname == null)
                {
                    Console.Write("Podaj nazwe druzyny: ");
                    groupname = "VGrupaX";// Console.ReadLine();
                }
                if (grouppass == null)
                {
                    Console.Write("Podaj haslo: ");
                    grouppass = "******"; //Console.ReadLine();
                }

                Console.Write("Podaj nazwe swiata: ");
                String worldname = "VGrupaX"; //Console.ReadLine();

                Console.Write("Podaj imie: ");
                String imie = Console.ReadLine();



                try
                {
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    energy      = cennikSwiata.initialEnergy;
                    lookMatrixW = cennikSwiata.sightScope;
                    lookMatrixW = lookMatrixW * lookMatrixW + 1;
                    lookMatrix  = new String[lookMatrixW][];
                    for (int i = 0; i < lookMatrixW; i++)
                    {
                        lookMatrix[i] = new String[lookMatrixW];
                    }
                    Alive();
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                    break;
                }
            }
        }
예제 #13
0
        static void Main(string[] args)
        {
            Console.WriteLine("0 - atlantyda.vm, 1 - localhost");
            String ktory  = Console.ReadLine();
            int    liczba = Int32.Parse(ktory);

            punkty.Add(new MapPoint(0, 0, true, 0, false, 0, 2));
            while (true)
            {
                agentTomek = new AgentAPI(Listen);

                String ip        = Settings.serverIP;
                String groupname = Settings.groupname;
                String grouppass = Settings.grouppass;

                if (liczba == 0)
                {
                    ip = "atlantyda.vm.wmi.amu.edu.pl";
                }
                else
                {
                    ip = "localhost";
                }
                groupname = "ZeloweMisie";
                if (liczba == 0)
                {
                    grouppass = "******";
                }
                else
                {
                    grouppass = "******";
                }

                Console.Write("Podaj nazwe swiata: ");
                String worldname = Console.ReadLine();

                Console.Write("Podaj imie: ");
                imie = Console.ReadLine();

                string fileName   = "Default.aiml";
                string sourcePath = @".\aiml\schemat\";
                string targetPath = @".\aiml\";
                if (File.Exists("aiml\\" + imie + ".aiml"))
                {
                    File.Delete("aiml\\" + imie + ".aiml");
                }
                string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
                string destFile   = System.IO.Path.Combine(targetPath, imie + ".aiml");
                File.Copy(sourceFile, destFile);
                DoAIML aiml = new DoAIML(imie + ".aiml");
                aiml.zapis("imie", imie);
                myBot = new cBot(false);
                try
                {
                    cennikSwiata = agentTomek.Connect(ip, 6008, groupname, grouppass, worldname, imie);
                    Console.WriteLine(cennikSwiata.initialEnergy + " - Maksymalna energia");
                    Console.WriteLine(cennikSwiata.maxRecharge + " - Maksymalne doładowanie");
                    Console.WriteLine(cennikSwiata.sightScope + " - Zasięg widzenia");
                    Console.WriteLine(cennikSwiata.hearScope + " - Zasięg słyszenia");
                    Console.WriteLine(cennikSwiata.moveCost + " - Koszt chodzenia");
                    Console.WriteLine(cennikSwiata.rotateCost + " - Koszt obrotu");
                    Console.WriteLine(cennikSwiata.speakCost + " - Koszt mówienia");

                    energy = cennikSwiata.initialEnergy;

                    KeyReader();
                    agentTomek.Disconnect();
                    Console.ReadKey();
                    break;
                }
                catch (NonCriticalException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    Console.ReadKey();
                    break;
                }
            }
        }