<commit_before>﻿using Daytona;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestHelpers;
using ZeroMQ;

namespace SiloConsole
{
    using System.IO;
    using System.Reflection;

    class Program
    {
        public static void Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(ConsoleCancelHandler);
            var binarySerializer = new BinarySerializer();
            var useActor = true;

            using (var context = ZmqContext.Create())
            {
                //using (var silo = new Silo(context, new BinarySerializer()))
                //{

                //}               
                 using (var pipe = new Pipe())
                {
                    pipe.Start(context);
                    using (var actorFactory = new Actor(context, new BinarySerializer(), string.Empty))
                    {
                        actorFactory.RegisterActor(
                            "Silo",
                            "",
                            "SilooutRoute",
                            new BinarySerializer(),
                            (address, methodInfo, parameters, actor) =>
                                {
                                    object returnedObject = null;
                                    List<RunningActors> runningActors = null;

                                    if (actor.PropertyBag.TryGetValue("RunningActors", out returnedObject))
                                    {
                                        runningActors = (List<RunningActors>)returnedObject;
                                        var returnedActor = runningActors.FirstOrDefault(ra => ra.Address == address);
                                        if (returnedActor == null)
                                        {
                                            var customer = new Actor<Customer>(actor.context, new BinarySerializer());
                                            customer.StartWithIdAndMethod(address, methodInfo, parameters);
                                            ////start actor
                                            /// 

                                            runningActors.Add(new RunningActors(address));
                                        }
                                    }
                                    else
                                    {
                                        var customer = new Actor<Customer>(actor.context, new BinarySerializer());
                                        customer.StartWithIdAndMethod(address, methodInfo, parameters);
                                        ////start actor
                                        /// 

                                        runningActors.Add(new RunningActors(address));
                                    }

                                    var firstParameter = string.Empty;
                                    try
                                    {
                                        firstParameter = parameters[0].ToString();
                                    }
                                    catch (Exception)
                                    {
                                    }

                                    Console.WriteLine("Address: {0}, {1}", address, firstParameter);
                                });
                        actorFactory.StartAllActors();

                        Console.WriteLine("Run tests");
                        Console.ReadLine();<commit_msg>Working with silo moved to Daytona project<commit_after>﻿using Daytona;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestHelpers;
using ZeroMQ;

namespace SiloConsole
{
    using System.IO;
    using System.Reflection;

    class Program
    {
        public static void Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(ConsoleCancelHandler);
            var binarySerializer = new BinarySerializer();
            var useActor = true;

            using (var context = ZmqContext.Create())
            {
                //using (var silo = new Silo(context, new BinarySerializer()))
                //{

                //}               
                using (var pipe = new Pipe())
                {
                    pipe.Start(context);
                    using (var actorFactory = new Actor(context, new BinarySerializer(), string.Empty))
                    {
                        actorFactory.RegisterActor(
                            "Silo",
                            "",
                            "SilooutRoute",
                            new BinarySerializer(),
                            (address, methodInfo, parameters, actor) =>
                                {
                                    object returnedObject = null;
                                    List<RunningActors> runningActors = null;

                                    if (actor.PropertyBag.TryGetValue("RunningActors", out returnedObject))
                                    {
                                        runningActors = (List<RunningActors>)returnedObject;
                                        var returnedActor = runningActors.FirstOrDefault(ra => ra.Address == address);

                                        Console.WriteLine("Hey we found an actor");
                                        if (returnedActor == null)
                                        {
                                            var customer = new Actor<Customer>(actor.context, new BinarySerializer());
                                            //customer.StartWithIdAndMethod(address, methodInfo, parameters);
                                            Console.WriteLine("I wish I could start a method");
                                            ////start actor
                                            /// 

                                            runningActors.Add(new RunningActors(address));
                                        }

                                        Console.WriteLine("We found a running actor so er did nothing");
                                    }
                                    else
                                    {
                                        var customer = new Actor<Customer>(actor.context, new BinarySerializer());
                                       // customer.StartWithIdAndMethod(address, methodInfo, parameters);
                                        Console.WriteLine("no collection of running actors, So I am creating one and starting a new runner");
                                        ////start actor
                                        /// 
                                        runningActors = new List<RunningActors>();
                                        runningActors.Add(new RunningActors(address));
                                        actor.PropertyBag.Add("RunningActors", runningActors);
                                    }

                                    var firstParameter = string.Empty;
                                    try
                                    {
                                        firstParameter = parameters[0].ToString();
                                    }
                                    catch (Exception)
                                    {
                                    }

                                    Console.WriteLine("Address: {0}, {1}", address, firstParameter);
                                });
                        actorFactory.StartAllActors();

                        Console.WriteLine("Run tests");
                        Console.ReadLine();
{'fraction_non_alphanumeric': 0.06952887537993921, 'fraction_numerical': 0.0007598784194528875, 'mean_word_length': 0.8158197286732582, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 88, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3351061', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1307, 'n_words': 320}