private static bool PropertyRead(FileInfo file, SciTEPropertyType propertyType, Queue <string> keyQueue, string key, string var)
        {
            bool   success = false;
            string filePatternPrefix = "file.patterns.";
            string languageNameListPrefix = "language.names";
            string lang, extList;

            if (s_props != null)
            {
                switch (propertyType)
                {
                case SciTEPropertyType.Property:
                    success      = true;
                    s_props[key] = var;
                    if (key.StartsWith(languageNameListPrefix))
                    {
                        extList = s_props.Evaluate(var);
                        s_props.AddLanguageNames(var.Split(' '));
                    }
                    else if (key.StartsWith(filePatternPrefix))
                    {
                        lang = key.Substring(filePatternPrefix.Length);
                        if (lang.LastIndexOf('.') == -1)
                        {
                            extList = s_props.Evaluate(var);
                            s_props.AddFileExtentionMapping(extList, lang);
                        }
                    }
                    break;

                case SciTEPropertyType.If:
                    if (s_props.ContainsKey(var))
                    {
                        success = !Convert.ToBoolean(s_props[var]);
                    }
                    break;

                case SciTEPropertyType.Import:
                    if (!s_supressImports)
                    {
                        FileInfo fileToImport = new FileInfo(string.Format(@"{0}\{1}.properties", file.Directory.FullName, var));
                        success = fileToImport.Exists;
                    }
                    break;
                }
            }

            return(success);
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="file"></param>
        /// <param name="propertyType"></param>
        /// <param name="keyQueue"></param>
        /// <param name="key"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        private static bool PropertyRead(FileInfo file, SciTEPropertyType propertyType, Queue<string> keyQueue, string key, string var)
        {
            bool success = false;
            string filePatternPrefix = "file.patterns.";
            string languageNameListPrefix = "language.names";
            string lang, extList;

            if (s_props != null)
            {
                switch (propertyType)
                {
                    case SciTEPropertyType.Property:
                        success = true;
                        s_props[key] = var;
                        if (key.StartsWith(languageNameListPrefix))
                        {
                            extList = s_props.Evaluate(var);
                            s_props.AddLanguageNames(var.Split(' '));
                        }
                        else if (key.StartsWith(filePatternPrefix))
                        {
                            lang = key.Substring(filePatternPrefix.Length);
                            if (lang.LastIndexOf('.') == -1)
                            {
                                extList = s_props.Evaluate(var);
                                s_props.AddFileExtentionMapping(extList, lang);
                            }
                        }
                        break;
                    case SciTEPropertyType.If:
                        if (s_props.ContainsKey(var))
                        {
                            success = !Convert.ToBoolean(s_props[var]);
                        }
                        break;
                    case SciTEPropertyType.Import:
                        if (!s_supressImports)
                        {
                            FileInfo fileToImport = new FileInfo(string.Format(@"{0}\{1}.properties", file.Directory.FullName, var));
                            success = fileToImport.Exists;
                        }
                        break;
                }
            }

            return success;
        }