示例#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);
        }
示例#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);
        }
示例#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>());
            }
        }
示例#4
0
        private void InitLibraries(KeyValueConfig config)
        {
            if (_engine.DirectiveResolver != null)
            {
                return;
            }

            if (config != null)
            {
                InitLibrariesFromConfig(config);
            }
            else
            {
                InitExternalLibraries(null, null);
            }
        }
示例#5
0
        private void InitLibraries(KeyValueConfig config)
        {
            if (_librariesInitialized)
            {
                return;
            }

            if (config != null)
            {
                InitLibrariesFromConfig(config);
            }
            else
            {
                InitExternalLibraries(null, null);
            }
        }
示例#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;
        }
示例#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);
        }