Ejemplo n.º 1
0
        private void InitLibrariesFromConfig(string configFile)
        {
            const string SYSTEM_LIB_KEY     = "lib.system";
            const string ADDITIONAL_LIB_KEY = "lib.additional";

            var config = KeyValueConfig.Read(configFile);

            string sysDir = config[SYSTEM_LIB_KEY];

            if (sysDir != null && !System.IO.Path.IsPathRooted(sysDir))
            {
                var confDir = System.IO.Path.GetDirectoryName(configFile);
                sysDir = System.IO.Path.GetFullPath(
                    System.IO.Path.Combine(confDir, sysDir));
            }

            string additionalDirsList = config[ADDITIONAL_LIB_KEY];

            string[] addDirs = null;
            if (additionalDirsList != null)
            {
                addDirs = additionalDirsList.Split(';');
            }

            InitExternalLibraries(sysDir, addDirs);
        }
Ejemplo n.º 2
0
        private void InitLibrariesFromConfig(KeyValueConfig config)
        {
            string sysDir             = config[EngineConfigProvider.SYSTEM_LIB_KEY];
            string additionalDirsList = config[EngineConfigProvider.ADDITIONAL_LIB_KEY];

            string[] addDirs = null;

            if (additionalDirsList != null)
            {
                addDirs = additionalDirsList.Split(';');
            }

            InitExternalLibraries(sysDir, addDirs);
        }
Ejemplo n.º 3
0
        private void ReadDefaultConfig()
        {
            var defaultCfgPath = DefaultConfigFilePath();

            if (defaultCfgPath != null)
            {
                var dict = ReadConfigFile(defaultCfgPath);
                _currentConfig = new KeyValueConfig(dict);
            }
            else
            {
                _currentConfig = new KeyValueConfig(new Dictionary <string, string>());
            }
        }
Ejemplo n.º 4
0
        private void InitLibraries(KeyValueConfig config)
        {
            if (_engine.DirectiveResolver != null)
            {
                return;
            }

            if (config != null)
            {
                InitLibrariesFromConfig(config);
            }
            else
            {
                InitExternalLibraries(null, null);
            }
        }
Ejemplo n.º 5
0
        private void InitLibraries(KeyValueConfig config)
        {
            if (_librariesInitialized)
            {
                return;
            }

            if (config != null)
            {
                InitLibrariesFromConfig(config);
            }
            else
            {
                InitExternalLibraries(null, null);
            }
        }
Ejemplo n.º 6
0
        public static KeyValueConfig Read(StreamReader reader)
        {
            var conf = new KeyValueConfig();
            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                if (String.IsNullOrWhiteSpace(line) || line[0] == '#')
                    continue;

                var keyValue = line.Split(new[] { '=' }, 2);
                if (keyValue.Length != 2)
                    continue;

                conf._values[keyValue[0].Trim()] = keyValue[1].Trim();
            }

            return conf;
        }
Ejemplo n.º 7
0
        public static KeyValueConfig Read(StreamReader reader)
        {
            var conf = new KeyValueConfig();

            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                if (String.IsNullOrWhiteSpace(line) || line[0] == '#')
                {
                    continue;
                }

                var keyValue = line.Split(new[] { '=' }, 2);
                if (keyValue.Length != 2)
                {
                    continue;
                }

                conf._values[keyValue[0].Trim()] = keyValue[1].Trim();
            }

            return(conf);
        }