public Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl, AssemblyDef asm) { Hashtable hash = new Hashtable(); Hashtable latt = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); //c.Assembly = asm.ToString(); //cg c.Name = Class; TypeDef type = asm.GetType(Class); string assemblySrt = null; assemblySrt = asm.FullName;//= c.Assembly ; //cg String fullVersion = String.Empty; if (!String.IsNullOrEmpty(assemblySrt)) { String version = assemblySrt.Split(',')[1]; fullVersion = version.Split('=')[1]; } c.ID = Class; if (cl != null) { hash = ClassToHashtable(cl); } defaults = CreateLuceneDefaults(); if (hash.Contains(c.Name)) { Class existingClass = (Class)hash[c.Name]; if (existingClass.LuceneSection != null) { defaults = existingClass.LuceneSection; latt = LuceneAttribToHashtable(existingClass.LuceneSection.Attributes); if (existingClass.Attributes != null) { c.Attributes = existingClass.Attributes; } } } c.LuceneSection = defaults; if (Attributes != null || Attributes != string.Empty) { latt = LuceneAttributesToAdd(latt, type); if (c.Attributes != null) { ConflictWithNormalAttributes(c.Attributes, latt); } c.LuceneSection.Attributes = latt.Values.Cast <LuceneAttrib>().ToArray(); } hash[c.Name] = c; return(hash); }
private LuceneAttributes CreateLuceneDefaults() { LuceneAttributes lAttribdefault = new LuceneAttributes(); lAttribdefault.LuceneType = LuceneUtil.STRING; lAttribdefault.MergeFactor = 5; lAttribdefault.LuceneAnalyzer = LuceneUtil.DefaultAnalyzers.STANDARD; lAttribdefault.TermVector = LuceneUtil.TermVectors.NO; lAttribdefault.Pattern = LuceneUtil.DEFAULT; lAttribdefault.StopWords = LuceneUtil.DEFAULT; return(lAttribdefault); }
private LuceneAttributes WriteLuceneDefaults(LuceneAttributes existing) { if (serverConfig.CacheSettings.LuceneSettings != null) { AttributeValidator.ValidateDefaultAnalyzer(Analyzer, GetDeployements(serverConfig.CacheSettings.LuceneSettings.Analyzers)); AttributeValidator.ValidateDefaultStopWords(StopWords, GetDeployements(serverConfig.CacheSettings.LuceneSettings.StopWordFiles)); AttributeValidator.ValidateDefaultPattern(Pattern, GetDeployements(serverConfig.CacheSettings.LuceneSettings.Patterns)); } AttributeValidator.ValidateDefaultTermVector(TermVector); AttributeValidator.ValidateDefaultLuceneType(LuceneType); existing.MergeFactor = MergeFactor; existing.LuceneType = LuceneType; existing.LuceneAnalyzer = Analyzer; existing.TermVector = TermVector; existing.Pattern = Pattern; existing.StopWords = StopWords; return(existing); }