Exemple #1
0
        public void Run()
        {
            Console.WriteLine("Loading csharp classes");
            List <ITestProcessor> processorcsharp = new List <ITestProcessor>();

            processorcsharp.AddRange(Enumerable.Range(100, 400).Select(i => new MatchProcessor(i.ToString())));

            Console.WriteLine("Loading Ipy classes");
            List <ITestProcessor> processorIpy = new List <ITestProcessor>();

            Ipy.ExecuteFile(new[] { "formsRules.py" }, new Dictionary <string, object> {
                { "processor", processorIpy }
            });

            Console.WriteLine("Loading csharp classes from Ipy");
            List <ITestProcessor> processorIpyCSharp = new List <ITestProcessor>();

            Ipy.ExecuteFile(new[] { "formsRulescsharp.py" }, new Dictionary <string, object> {
                { "processor", processorIpyCSharp }
            });

            Console.WriteLine("Generating strings");
            var randomStrings = Enumerable.Range(0, 500).Select(r => DateTime.Now.AddSeconds(r).ToString());

            Console.WriteLine("Counts: {0}, {1}, {2}", processorcsharp.Count, processorIpy.Count, processorIpyCSharp.Count);

            Compute(processorcsharp, randomStrings, "Counting via csharp classes");
            Compute(processorIpyCSharp, randomStrings, "Counting via csharp classes loaded by ipy");
            Compute(processorIpy, randomStrings, "Counting via ipy classes");
        }
        public void Run()
        {
            Console.WriteLine("Loading csharp classes");
            List <ISimple> processorcsharp = new List <ISimple>();

            processorcsharp.AddRange(Enumerable.Range(0, 2000).Select(i => new Simple()));

            Console.WriteLine("Loading Ipy classes");
            List <ISimple> processorIpy = new List <ISimple>();

            Ipy.ExecuteFile(new[] { "simpleRulesIpy.py" }, new Dictionary <string, object> {
                { "processor", processorIpy }
            });

            Console.WriteLine("Loading csharp classes from Ipy");
            List <ISimple> processorIpyCSharp = new List <ISimple>();

            Ipy.ExecuteFile(new[] { "simpleRulescsharp.py" }, new Dictionary <string, object> {
                { "processor", processorIpyCSharp }
            });

            Console.WriteLine("Counts: {0}, {1}, {2}", processorcsharp.Count, processorIpy.Count, processorIpyCSharp.Count);

            Compute(processorcsharp, "Counting via csharp classes");
            Compute(processorIpyCSharp, "Counting via csharp classes loaded by ipy");
            Compute(processorIpy, "Counting via ipy classes");
        }
        public void Load()
        {
            ScriptScope sc = Ipy.CreateScope(new Dictionary <string, object> {
                { "widths", _widths },
                { "font", FontInfo },
                { "processorsForm", _processorsForm }
            });

            Ipy.ExecuteFile(new string[] { "uiconfig.py" }, scope: sc);
            string treshold = sc.GetVariable <string>("treshold");

            Treshold   = (Level)Level.Parse(typeof(Level), treshold);
            FormWidth  = sc.GetVariable <int>("width");
            FormHeight = sc.GetVariable <int>("height");
        }