示例#1
0
        internal static InformRealmFactory[] ConstructAll(ILogger logger, string installationsPath, string indexOutputDir)
        {
            var result = new List <InformRealmFactory>();

            foreach (string subPath in Directory.GetDirectories(installationsPath))
            {
                string nibin, i6bin;
                if (FindCompilers(Path.Combine(subPath, "Compilers"), out nibin, out i6bin))
                {
                    var version = Path.GetFileName(subPath);

                    var factory = new InformRealmFactory(
                        logger: logger,
                        name: version,
                        niCompilerPath: nibin,
                        niExtensionDir: Path.Combine(subPath, "Inform7", "Extensions"),
                        infCompilerPath: i6bin,
                        infLibraryDir: Path.Combine(subPath, "Library", "Natural"),
                        indexOutputDir: indexOutputDir);

                    result.Add(factory);
                }
            }

            return(result.ToArray());
        }
示例#2
0
        private static void RegisterRealmFactories(Container container, ServerConfig serverConfig, ILogger logger)
        {
            var informRealmFactories = InformRealmFactory.ConstructAll(
                logger: logger,
                installationsPath: Properties.Settings.Default.NiInstallationsPath,
                indexOutputDir: serverConfig.IndexPath);

            container.RegisterCollection <InformRealmFactory>(informRealmFactories);

            var allRealmFactories = new List <RealmFactory>();

            allRealmFactories.AddRange(informRealmFactories);
            container.RegisterCollection <RealmFactory>(allRealmFactories);
        }