<commit_before>﻿using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using NLog;
using SharpNet.Business.Repl.Abstract;
using SharpNet.Service.Model;

namespace SharpNet.Business.Repl.Strategy
{
    public class DefaultActivationStrategy
        : IActivationStrategy<ReplContext>
    {
        public void Activate(ReplContext entity)
        {
            try
            {
                var codebase = new FileInfo(new Uri(Assembly.GetExecutingAssembly()
                    .CodeBase).LocalPath).DirectoryName;
                codebase = codebase.EndsWith("\\")
                    ? codebase
                    : string.Format(@"{0}\", codebase);
                Trace.TraceInformation(codebase);
                //get directory contents
                var fs = Directory.GetFiles(codebase);

                foreach (var s in fs.Where(x=>x.ToLower()
                    .EndsWith(".dll")))
                {
                    entity.Session.AddReference(s);
                    Trace.TraceInformation(string.Format("reference added:{0}", s));
                }
                /*
                //apply default activation
                entity.Session.AddReference(
                    string.Format("{0}System.dll",codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Core.dll",codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Data.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Collections.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Collections.Concurrent.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Linq.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Runtime.Serialization.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Xml", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Xml.Linq", codebase));
                entity.Session.AddReference(
                    string.Format("{0}SharpNet.dll", codebase));
                    */
                entity.Session.ImportNamespace("System");
                entity.Session.ImportNamespace("System.Collections.Generic");
                entity.Session.ImportNamespace("System.Linq");
                entity.Session.ImportNamespace("System.Text");
                entity.Session.ImportNamespace("System.Threading.Tasks");<commit_msg>debugging deployment<commit_after>﻿using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using NLog;
using SharpNet.Business.Repl.Abstract;
using SharpNet.Service.Model;

namespace SharpNet.Business.Repl.Strategy
{
    public class DefaultActivationStrategy
        : IActivationStrategy<ReplContext>
    {
        public void Activate(ReplContext entity)
        {
            try
            {
                var codebase = new FileInfo(new Uri(Assembly.GetExecutingAssembly()
                    .CodeBase).LocalPath).DirectoryName;
                codebase = codebase.EndsWith("\\")
                    ? codebase
                    : string.Format(@"{0}\", codebase);
                Trace.TraceInformation(codebase);
                //get directory contents
                var fs = Directory.GetFiles(codebase);

                foreach (var s in fs.Where(x=>x.ToLower()
                    .EndsWith(".dll")))
                {
                    entity.Session.AddReference(s);
                    Trace.TraceInformation(string.Format("reference added:{0}", s));
                }
                entity.Session.AddReference(
                    string.Format("{0}System.Core.dll",codebase));
                /*
                //apply default activation
                entity.Session.AddReference(
                    string.Format("{0}System.dll",codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Core.dll",codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Data.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Collections.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Collections.Concurrent.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Linq.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Runtime.Serialization.dll", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Xml", codebase));
                entity.Session.AddReference(
                    string.Format("{0}System.Xml.Linq", codebase));
                entity.Session.AddReference(
                    string.Format("{0}SharpNet.dll", codebase));
                    */
                entity.Session.ImportNamespace("System");
                entity.Session.ImportNamespace("System.Collections.Generic");
                entity.Session.ImportNamespace("System.Linq");
                entity.Session.ImportNamespace("System.Text");
                entity.Session.ImportNamespace("System.Threading.Tasks");
{'fraction_non_alphanumeric': 0.11380231522707035, 'fraction_numerical': 0.004452359750667854, 'mean_word_length': 1.724890829694323, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3954047', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1315, 'n_words': 188}