예제 #1
0
        private void LoadDependencies()
        {
            if (dependenciesLoaded == false)
            {
                AssemblyLocator.Initialize();

                foreach (PlugInReference r in Manifest.Dependencies)
                {
                    if (r.RequirePreload)
                    {
                        bool found = false;

                        foreach (PlugIn plugIn in PlugInTree.plugInsList)
                        {
                            if (plugIn.Manifest.Identities.ContainsKey(r.Name))
                            {
                                found = true;
                                plugIn.LoadRuntimeAssemblies();
                            }
                        }

                        if (!found)
                        {
                            throw new Exception("Can't load run-time dependency form " + r.ToString());
                        }
                    }
                }

                dependenciesLoaded = true;
            }
        }
예제 #2
0
        public SessionFactoryInfra()
        {
            var assemblyWithMaps = AssemblyLocator.GetByName("StoreApp.Domain.Map.dll");

            //string connString = @"Server=127.0.0.1;Port=3306;Database=db_store;Uid=user_test;Pwd=password_test;SslMode=none";

            //Fliently configuration using Postgre Connector and "StoreApp.Domain.Repository.dll" mapped assembly
            //Quary and Cache setted to false due to problems making quaries constantly
            var fConfiguration = Fluently.Configure()
                                 .Database(PostgreSQLConfiguration.PostgreSQL82.ConnectionString(c => c
                                                                                                 .Host("localhost")
                                                                                                 .Port(5432)
                                                                                                 .Database("store")
                                                                                                 .Username("postgres")
                                                                                                 .Password("admin")))
                                 .Mappings(m => m.FluentMappings.AddFromAssembly(assemblyWithMaps))
                                 .ExposeConfiguration(c => c.SetProperty(NHibernate.Cfg.Environment.PropertyUseReflectionOptimizer, Boolean.TrueString)
                                                      .SetProperty(NHibernate.Cfg.Environment.UseSecondLevelCache, Boolean.FalseString)
                                                      .SetProperty(NHibernate.Cfg.Environment.UseQueryCache, Boolean.FalseString))
                                 .BuildConfiguration();

            //To create schema (database must exist)
            //var exporter = new SchemaExport(fConfiguration);
            //exporter.Execute(true, true, false);

            _sessionFactory = fConfiguration.BuildSessionFactory();
            _session        = _sessionFactory.OpenSession();
        }
예제 #3
0
파일: ItIs.cs 프로젝트: pekkah/ItIsAlive
        public Bootstrapper Alive()
        {
            var assemblies = _configureDependencies.SourceAssemblies;
            var types = _configureDependencies.SourceTypes;

            var assemblyLocator = new AssemblyLocator(assemblies);
            var discoverFromAssemblies = new DefaultDependencyDiscoveryTask(assemblyLocator);

            var typeLocator = new ListLocator(types);
            var discoverFromTypes = new DefaultDependencyDiscoveryTask(typeLocator);

            // add custom conventions to discovery tasks
            foreach (var convention in _conventions)
            {
                discoverFromAssemblies.AddConvention(convention);
                discoverFromTypes.AddConvention(convention);
            }

            _bootstrapper.Tasks.Add(discoverFromAssemblies);
            _bootstrapper.Tasks.Add(discoverFromTypes);

            // execute initialization tasks
            var container = _bootstrapper.Initialize();

            // expose container
            if (_exposeContainer != null)
            {
                _exposeContainer(container);
            }

            // start
            _bootstrapper.Start();

            return _bootstrapper;
        }
예제 #4
0
        private static void AddRepositoriesAndServices(IServiceCollection services)
        {
            var assemblies         = new[] { AssemblyLocator.GetByName("StoreApp.Domain.Repository.dll") };
            var typeRepositoryBase = typeof(IRepositoryBase <>);
            var typeServiceBase    = typeof(IServiceBase);

            foreach (var assembly in assemblies)
            {
                var typesFromAssembly      = assembly.GetTypes();
                var interfacesFromAssembly = typesFromAssembly.Where(x => x.IsInterface);
                var classesFromAssembly    = typesFromAssembly.Where(x => x.IsClass);

                foreach (Type itemInterface in interfacesFromAssembly)
                {
                    if (!typeServiceBase.IsAssignableFrom(itemInterface) &&
                        !itemInterface.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeRepositoryBase))
                    {
                        continue;
                    }

                    Type classThatImplements = classesFromAssembly.FirstOrDefault(x => itemInterface.IsAssignableFrom(x));

                    if (classThatImplements == null)
                    {
                        continue;
                    }

                    services.AddScoped(itemInterface, classThatImplements);
                }
            }
        }
예제 #5
0
        private void CopyDaily(string symbol)
        {
            string   sourcefolder = @"H:\GoogleFinanceData\equity\usa\daily\";
            string   destfolder   = @"I:\Dropbox\JJ\data\equity\usa\daily\";
            FileInfo destfile     = new FileInfo(destfolder + symbol + ".zip");
            FileInfo f            = new FileInfo(sourcefolder + symbol + ".zip");

            if (f.Exists)
            {
                try
                {
                    File.Copy(f.FullName, destfile.FullName, true);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                Console.WriteLine("Copied 1 daily file {0}", destfile.Name);
            }
            else
            {
                Console.WriteLine("File Not Copied {0}", f.Name);
                using (var sw = new StreamWriter(AssemblyLocator.ExecutingDirectory() + "CopyDailyFailed.txt", true))
                {
                    sw.WriteLine("Daily File Not Copied {0}", f.Name);
                    sw.Flush();
                    sw.Close();
                }
            }
        }
예제 #6
0
파일: Program.cs 프로젝트: girish66/REM
        private static IEnumerable <string> GetModuleNames()
        {
            var types = new List <Type> ();

            AssemblyLocator assemblyLocator = new AssemblyLocator();

            var domainAssemblies = assemblyLocator.LocateDomainAssemblies();

            foreach (var assembly in domainAssemblies)
            {
                types.AddRange(assembly.GetTypes());
            }

            IList <string> nameList = new List <string> ();

            foreach (var type in types)
            {
                var namespaces = type.Namespace.Split('.');
                var nspace     = namespaces[namespaces.Length - 1];
                if (nspace.EndsWith("Module") && !nameList.Contains(nspace))
                {
                    nameList.Add(nspace);
                }
            }

            return(nameList.ToArray());
        }
        public override void OnEndOfAlgorithm()
        {
            #region Logging stuff - Saving the logs

            int    i = 0;
            string filename;
            string filePath;

            foreach (string symbol in Symbols)
            {
                filename = string.Format("LittleWing_{0}.csv", symbol);
                filePath = AssemblyLocator.ExecutingDirectory() + filename;

                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
                File.AppendAllText(filePath, stockLogging[i].ToString());
                Debug(string.Format("\nSymbol Name: {0}, Ending Value: {1} ", symbol, Portfolio[symbol].Profit));
                i++;
            }

            filename = string.Format("LittleWing_transactions.csv");
            filePath = AssemblyLocator.ExecutingDirectory() + filename;

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            File.AppendAllText(filePath, transactionLogging.ToString());

            Debug(string.Format("\nAlgorithm Name: {0}\n Ending Portfolio Value: {1} ", this.GetType().Name, Portfolio.TotalPortfolioValue));

            #endregion Logging stuff - Saving the logs
        }
예제 #8
0
        public void TestNET2Caller_AppDomain2_CustomDomain4()
        {
            Assembly net2Caller = Assembly.LoadFrom(TestAssemblyRelativePath);

            AppDomainSetup setup = new AppDomainSetup()
            {
                ApplicationBase     = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                ApplicationName     = "TestNET2Caller",
                SandboxInterop      = true,
                ShadowCopyFiles     = Boolean.TrueString,
                TargetFrameworkName = ".NETFramework,Version=v2.0" // appdomain is more or less ignoring < 4.5 :(
            };

            setup.SetConfigurationBytes(System.Text.Encoding.UTF8.GetBytes(NET2Config));

            System.Security.Policy.Evidence evidence = new System.Security.Policy.Evidence(AppDomain.CurrentDomain.Evidence);
            evidence.AddAssemblyEvidence(new System.Security.Policy.ApplicationDirectory(@"..\..\..\]BET[.Playground.Interop.COM.NET2Caller\bin\Debug\"));

            // create domain
            AppDomain net2CallerDomain = AppDomain.CreateDomain(
                "TestNET2Caller",
                evidence,
                setup
                );

            AssemblyLocator.Init(net2CallerDomain);

            try
            {
                var prg = net2CallerDomain.CreateInstanceAndUnwrap(net2Caller.FullName, net2Caller.GetType().FullName);

                var callCom = prg.GetType().GetMethod("CallCom");
                var result  = callCom.Invoke(prg, null) as string;

                Assert.AreEqual <string>(ErrorMsg, result); // fail
                Assert.Inconclusive(InconclusiveMsg);
            }
            catch (Exception ex)
            {
                if (ex.HResult == -2146233054)
                {
                    Assert.Fail($"Expected Fail 1: {ex.Message}");
                }
                if (ex.HResult == -2147024894)
                {
                    Assert.Fail($"Expected Fail 2: {ex.Message}");
                }
                if (ex.HResult == -2147024773)
                {
                    Assert.Fail($"Expected Fail 3: {ex.Message}");
                }

                Assert.Fail($"Unknown Fail: {ex.Message}");
            }
            finally
            {
                AppDomain.Unload(net2CallerDomain);
            }
        }
예제 #9
0
 private void InitAssemblies()
 {
     if (_assemblies == null || _assemblies.Length == 0)
     {
         var locator = new AssemblyLocator();
         _assemblies = locator.DependencyAssemblies().ToArray();
     }
 }
예제 #10
0
        public void GetsTheFolderForRunningAssemblyDebug()
        {
            // You need to replace this string with your local project path.
            string exeDir             = "c:\\users\\nick\\appdata\\local\\temp\\".ToLower();
            string executingDirectory = AssemblyLocator.ExecutingDirectory().ToLower();

            Assert.IsTrue(executingDirectory.Contains(exeDir));
        }
 public ManageableConfigurationSourceViewModel(
     ElementCollectionViewModel containingCollection,
     ConfigurationElement thisElement,
     AssemblyLocator assemblyLocator)
     : base(containingCollection, thisElement)
 {
     this.assemblyLocator = assemblyLocator;
 }
예제 #12
0
        public Type CreateAndAddPageTypeClassToAppDomain(Action <TypeSpecification> typeSpecificationExpression)
        {
            Type type = PageTypeClassFactory.CreatePageTypeClass(typeSpecificationExpression);

            AssemblyLocator.Add(type.Assembly);

            return(type);
        }
        public AddinScanDataFileGenerator(AddinDatabase database, AddinRegistry registry, string rootFolder) : base(database)
        {
            this.database   = database;
            this.rootFolder = Path.GetFullPath(rootFolder);

            assemblyIndex = new AssemblyIndex();
            locator       = new AssemblyLocator(database, registry, assemblyIndex);
            scanner       = new AddinScanner(database, locator);
        }
예제 #14
0
        /// <summary>
        /// 设置主模块程序集信息
        /// </summary>
        private void SetupMainAssembly()
        {
            AssemblyInfo mainAssemblyInfo = new AssemblyInfo();

            mainAssemblyInfo.Name     = this.ModuleXml.MainAssemblyName.GetAssemblyFullNameEx();
            mainAssemblyInfo.Location = Path.Combine(this.ModuleLocation, mainAssemblyInfo.Name);
            mainAssemblyInfo.Version  = this.ModuleXml.ModuleVersion;

            AssemblyLocator.AddAssebmlyInfo(mainAssemblyInfo);
        }
예제 #15
0
        /// <summary>
        /// This type supports the Enterprise Library Manageability Extensions infrastructure and is not intended to
        /// be used directly from your code.
        /// Initializes a new instance of the <see cref="ConfigurationManageabilityProviderAttributeRetriever"/> class that
        /// will retrieve attributes from the assemblies located in the running application's base directory.
        /// </summary>
        public ConfigurationManageabilityProviderAttributeRetriever(AssemblyLocator assemblyLocator)
        {
            this.assemblyLocator = assemblyLocator;

            sectionManageabilityProviderAttributes
                = new List <ConfigurationSectionManageabilityProviderAttribute>();
            elementManageabilityProviderAttributes
                = new List <ConfigurationElementManageabilityProviderAttribute>();

            LoadRegisteredManageabilityProviders(sectionManageabilityProviderAttributes, elementManageabilityProviderAttributes);
        }
예제 #16
0
        public void CreateAndAddPageTypeClassToAppDomain(Action <TypeSpecification, PageTypeAttribute> typeSpecificationExpression)
        {
            var  attribute     = new PageTypeAttribute();
            Type pageTypeClass = PageTypeClassFactory.CreateTypeInheritingFromTypedPageData(type =>
            {
                typeSpecificationExpression(type, attribute);
                type.AddAttributeTemplate(attribute);
            });

            AssemblyLocator.Add(pageTypeClass.Assembly);
        }
예제 #17
0
        public override void OnEndOfAlgorithm()
        {
            string fileName = string.Format("TestingLSMA.csv", symbol);
            string filePath = AssemblyLocator.ExecutingDirectory() + fileName;

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            File.AppendAllText(filePath, logResult.ToString());
        }
예제 #18
0
 public ExportAdmTemplateCommand(CommandAttribute commandAttribute,
                                 ApplicationViewModel applicationViewModel,
                                 IUIServiceWpf uiService,
                                 ElementViewModel element,
                                 AssemblyLocator assemblyLocator)
     : base(commandAttribute, uiService)
 {
     this.applicationViewModel = applicationViewModel;
     this.element            = element;
     this.attributeRetriever = new ConfigurationManageabilityProviderAttributeRetriever(assemblyLocator);
 }
예제 #19
0
        string GetTestingFrameworksImports(Platform platform)
        {
            var sb = new StringBuilder();

            foreach (var assembly in new[] { "nunitlite.dll", "Xunit.NetCore.Extensions.dll", "xunit.execution.dotnet.dll" })
            {
                sb.AppendLine($"<Reference Include=\"{assembly.Replace(".dll", "")}\">");
                sb.AppendLine($"<HintPath>{AssemblyLocator.GetTestingFrameworkDllPath(assembly, platform)}</HintPath>");
                sb.AppendLine("</Reference>");
            }
            return(sb.ToString());
        }
        /// <summary>
        /// Find all the types in all assemblies that inherit from handler interface.
        /// </summary>
        public static IEnumerable <Type> GetHandlerTypes()
        {
            ReadOnlyCollection <Assembly> binFolderAssemblies = AssemblyLocator.GetBinFolderAssemblies();

            foreach (Assembly assembly in binFolderAssemblies)
            {
                foreach (Type handlerType in GetHandlerTypes(assembly))
                {
                    yield return(handlerType);
                }
            }
        }
예제 #21
0
파일: Program.cs 프로젝트: sprgn/LeanITrend
        private static double RunAlgorithm(List <string> algos, Dictionary <string, DateRange> daysDictionary)
        {
            var sum_sharpe = 0.0;

            foreach (string s in algos)
            {
                foreach (string key in daysDictionary.Keys)
                {
                    var       val       = s;
                    var       startDate = daysDictionary[key].startDate;
                    var       endDate   = daysDictionary[key].endDate;
                    AppDomain ad        = null;
                    RunClass  rc        = CreateRunClassInAppDomain(ref ad);
                    Console.WriteLine("Running algorithm {0} for: {1} to {2}", val, startDate, endDate);

                    try
                    {
                        sum_sharpe += (double)rc.Run(val, startDate, endDate);
                    }
                    catch (Exception e)
                    {
                        Log.Error(e.Message + e.StackTrace);
                    }
                    AppDomain.Unload(ad);

                    // After the Lean Engine has run and is deallocated,
                    // rename my custom mylog.csv file to include the algorithm name.
                    //  mylog.csv is written in the algorithm.  Replace with your custom logs.
                    try
                    {
                        string f          = AssemblyLocator.ExecutingDirectory();
                        string sourcefile = f + @"mylog.csv";
                        if (File.Exists(sourcefile))
                        {
                            string destfile = f + string.Format(@"mylog{0}.csv", s);
                            if (File.Exists(destfile))
                            {
                                File.Delete(destfile);
                            }
                            File.Move(sourcefile, destfile);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                    runnumber++;
                }
            }

            return(sum_sharpe);
        }
예제 #22
0
 public override void OnEndOfAlgorithm()
 {
     foreach (string symbol in Symbols)
     {
         string filename = string.Format("InjectingTest_{0}.csv", symbol);
         string filePath = AssemblyLocator.ExecutingDirectory() + filename;
         if (File.Exists(filePath))
         {
             File.Delete(filePath);
         }
         File.AppendAllText(filePath, stockLogging[symbol].ToString());
     }
 }
 public void SetUp()
 {
     outputdir = Path.GetTempFileName();
     File.Delete(outputdir);
     Directory.CreateDirectory(outputdir);
     assemblyLocator = new AssemblyLocator();
     template        = new Mock <ITemplatedProject> ();
     generator       = new BCLTestImportTargetFactory(outputdir)
     {
         AssemblyLocator  = assemblyLocator,
         TemplatedProject = template.Object
     };
 }
예제 #24
0
        /// <summary>
        /// Returns a list of tuples that contains the name of the assembly and the required hint path. If the
        /// path is null it means that the assembly is part of the distribution.
        /// </summary>
        /// <param name="platform">The platform we are working with.</param>
        /// <returns>The list of tuples (assembly name, path hint) for all the assemblies in the project.</returns>
        public (string FailureMessage, List <(string assembly, string hintPath)> Assemblies) GetAssemblyInclusionInformation(Platform platform)
        {
            (string FailureMessage, IEnumerable <string> References) = GetProjectAssemblyReferences(platform);
            if (!string.IsNullOrEmpty(FailureMessage))
            {
                return(FailureMessage, null);
            }

            var asm = References.Select(
                a => (assembly: a,
                      hintPath: AssemblyLocator.GetHintPathForReferenceAssembly(a, platform))).Union(
                TestAssemblies.Select(
                    definition => (assembly: definition.GetName(platform),
                                   hintPath: definition.GetPath(platform))))
                      .ToList();

            return(null, asm);
        }
예제 #25
0
        /// <summary>
        /// Returns the directory from the downloads where tests can be found.
        /// </summary>
        /// <returns>The test directory from downloads path.</returns>
        /// <param name="downloadsPath">Downloads path.</param>
        /// <param name="platform">Platform whose tests we require.</param>
        public string GetTestDirectoryFromDownloadsPath(Platform platform)
        {
            var downloadsPath = AssemblyLocator.GetAssembliesRootLocation(platform);

            switch (platform)
            {
            case Platform.MacOSFull:
            case Platform.MacOSModern:
                return(Path.Combine(downloadsPath, "mac-bcl", platformPathMatch [platform], "tests"));

            case Platform.iOS:
            case Platform.TvOS:
            case Platform.WatchOS:
                return(Path.Combine(downloadsPath, "ios-bcl", platformPathMatch [platform], "tests"));
            }

            return(null);
        }
예제 #26
0
        /// <summary>
        /// 设置依赖的程序集信息
        /// </summary>
        private void SetupDependencyAssembly()
        {
            string dependencyLocation = Path.Combine(this.ModuleLocation, "Libs");

            if (Directory.Exists(dependencyLocation))
            {
                string[] dllLocations = Directory.GetFiles(dependencyLocation);

                foreach (string dllLocation in dllLocations)
                {
                    AssemblyInfo assemblyInfo = new AssemblyInfo();
                    assemblyInfo.Location = dllLocation;
                    assemblyInfo.Name     = Path.GetFileName(dllLocation).GetAssemblyFullNameEx();
                    assemblyInfo.Version  = new Version(FileVersionInfo.GetVersionInfo(dllLocation).FileVersion);

                    AssemblyLocator.AddAssebmlyInfo(assemblyInfo);
                }
            }
        }
        public static Configuration CreateConfiguration(string connString, string mapAssemblyName)
        {
            //Fluently configuration using Postgre Connector and "StoreApp.Domain.Repository.dll" mapped assembly
            //Quary and Cache setted to false due to problems making quaries constantly, besides others configuration setted to make the access quick

            return(Fluently.Configure()
                   .Database(PostgreSQLConfiguration.PostgreSQL82.ConnectionString(connString))
                   .Mappings(m => m.FluentMappings.AddFromAssembly(AssemblyLocator.GetByName(mapAssemblyName)))
                   .ExposeConfiguration(c => c
                                        .SetProperty(NHibernate.Cfg.Environment.PropertyUseReflectionOptimizer, Boolean.TrueString)
                                        .SetProperty(NHibernate.Cfg.Environment.WrapResultSets, Boolean.TrueString)
                                        .SetProperty(NHibernate.Cfg.Environment.UseSecondLevelCache, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.UseQueryCache, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.UseProxyValidator, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.ShowSql, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.QueryStartupChecking, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, Boolean.FalseString)
                                        .SetProperty(NHibernate.Cfg.Environment.FormatSql, Boolean.FalseString)
                                        ).BuildConfiguration());
        }
예제 #28
0
        private static void RegisterComponents(Container container)
        {
            var assemblies = AssemblyLocator.GetSWAssemblies();
            IDictionary <Type, IList <Registration> > tempDict = new Dictionary <Type, IList <Registration> >();

            foreach (var assembly in assemblies)
            {
                var registrations = assembly.GetTypes().Where(type => typeof(IComponent).IsAssignableFrom(type));
                foreach (var registration in registrations)
                {
                    if (registration.IsInterface || registration.IsAbstract)
                    {
                        continue;
                    }
                    var attributes = registration.GetAllAttributes <ComponentAttribute>();
                    var attr       = attributes.FirstOrDefault();
                    var reg        = Lifestyle.Singleton.CreateRegistration(registration, container);
                    if (attr != null)
                    {
                        RegisterFromAttribute(attr, tempDict, reg);
                    }
                    RegisterFromInterfaces(registration, tempDict, reg);
                    RegisterClassItSelf(container, registration, reg);
                }
            }
            foreach (var entry in tempDict)
            {
                var coll        = entry.Value;
                var serviceType = entry.Key;
                if (typeof(ISingletonComponent).IsAssignableFrom(serviceType))
                {
                    container.AddRegistration(serviceType, coll.FirstOrDefault());
                    sW4.SimpleInjector.SimpleInjectorGenericFactory.RegisterNameAndType(serviceType);
                }
                else
                {
                    container.RegisterAll(serviceType, coll);
                }
            }
        }
        public SampleSignalRServer(int httpPort, int netMQPort, IEnumerable<int> subscriberPorts)
        {
            string serverUrl = string.Format("http://localhost:{0}", httpPort);
            string netMQAddress = string.Format("tcp://127.0.0.1:{0}", netMQPort);
            var subscriberAddresses = subscriberPorts
                .Select(p => string.Format("tcp://127.0.0.1:{0}", p))
                .ToArray();
            var config = new NetMQScaleoutConfiguration(netMQAddress, subscriberAddresses);

            _httpServer = WebApp.Start(serverUrl, app =>
            {
                var resolver = new DefaultDependencyResolver();
                resolver.UseNetMQServiceBus(config);
                var assemblyLocator = new AssemblyLocator();
                resolver.Register(typeof(IAssemblyLocator), () => assemblyLocator);
                var hubConfiguration = new HubConfiguration
                {
                    Resolver = resolver,
                };
                app.MapSignalR(hubConfiguration);
            });
        }
예제 #30
0
        public SampleSignalRServer(int httpPort, int netMQPort, IEnumerable <int> subscriberPorts)
        {
            string serverUrl           = string.Format("http://localhost:{0}", httpPort);
            string netMQAddress        = string.Format("tcp://127.0.0.1:{0}", netMQPort);
            var    subscriberAddresses = subscriberPorts
                                         .Select(p => string.Format("tcp://127.0.0.1:{0}", p))
                                         .ToArray();
            var config = new NetMQScaleoutConfiguration(netMQAddress, subscriberAddresses);

            _httpServer = WebApp.Start(serverUrl, app =>
            {
                var resolver = new DefaultDependencyResolver();
                resolver.UseNetMQServiceBus(config);
                var assemblyLocator = new AssemblyLocator();
                resolver.Register(typeof(IAssemblyLocator), () => assemblyLocator);
                var hubConfiguration = new HubConfiguration
                {
                    Resolver = resolver,
                };
                app.MapSignalR(hubConfiguration);
            });
        }
예제 #31
0
        public void Initialize()
        {
            AssemblyLocator.Initialize();

            MetadataTree mTree = MetadataTreeBuilder.Initialize("", "").Analyze();

            ModuleAnalyzer moduleAnalyzer = new ModuleAnalyzer(mTree);

            ReadOnlyCollection <AssemblyInfo>  preReferenceAssemblies = moduleAnalyzer.GetPreReferenceAssemblies();
            ReadOnlyCollection <ModuleXmlInfo> moduleXmlInfos         = moduleAnalyzer.GetModuleXmlInfos();

            foreach (AssemblyInfo assemblyInfo in preReferenceAssemblies)
            {
                AssemblyLocator.AddAssebmlyInfo(assemblyInfo);
            }

            foreach (ModuleXmlInfo moduleXmlInfo in moduleXmlInfos)
            {
                Module modeule = new Module(moduleXmlInfo);
                modeule.Compile();
            }
        }
예제 #32
0
        private static void CopyMinute(string symbol, out int filesCopied)
        {
            filesCopied = 0;
            string sourcefolder = @"H:\GoogleFinanceData\equity\usa\minute\" + symbol;
            string destfolder   = @"I:\Dropbox\JJ\data\equity\usa\minute\" + symbol;
            var    di           = new DirectoryInfo(sourcefolder);

            if (di.Exists)
            {
                FileInfo[] sourceFileInfos = di.GetFiles();
                if (!Directory.Exists(destfolder))
                {
                    Directory.CreateDirectory(destfolder);
                }
                FileInfo[] destFileInfos = new DirectoryInfo(destfolder).GetFiles();
                foreach (FileInfo f in sourceFileInfos)
                {
                    string destfile = destfolder + @"\" + f.Name;
                    if (!File.Exists(destfile))
                    {
                        try
                        {
                            File.Copy(f.FullName, destfile);
                        }
                        catch (Exception e)
                        {
                            using (var sw = new StreamWriter(AssemblyLocator.ExecutingDirectory() + "CopyMinuteFailed.txt", true))
                            {
                                sw.WriteLine("Minute File Not Copied {0}\n{1}\n{2}", f.Name, e.Message, e.StackTrace);
                                sw.Flush();
                                sw.Close();
                            }
                        }
                        filesCopied++;
                    }
                }
            }
        }