static public Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl, System.Reflection.Assembly asm) { Hashtable hash = new Hashtable(); Hashtable att = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); c.Name = cParam.Class; System.Type type = asm.GetType(cParam.Class, true); string assemblySrt = null; assemblySrt = asm.FullName; c.ID = cParam.Class; if (cl != null) { hash = ClassToHashtable(cl); } if (hash.Contains(c.Name)) { Class existingClass = (Class)hash[c.Name]; att = AttribToHashtable(existingClass.Attributes); } if (cParam.Attributes != null || cParam.Attributes != string.Empty) { c.Attributes = GetClassAttributes(GetAttributes(att), type); } hash[c.Name] = c; return(hash); }
public object Clone() { Class cls = new Class(); cls.ID = ID != null ? (string)ID.Clone(): null; cls.Name = Name != null ? (string)Name.Clone(): null; cls.Attributes = Attributes != null ? (Attrib[])Attributes.Clone(): null; return cls; }
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); }
public Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl, System.Reflection.Assembly asm) { Hashtable hash = new Hashtable(); Hashtable att = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); c.Name = Class; System.Type type = asm.GetType(Class, true); 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); } if (hash.Contains(c.Name)) { Class existingClass = (Class)hash[c.Name]; att = AttribToHashtable(existingClass.Attributes); } Hashtable attributeList = new Hashtable(); foreach (PropertyInfo pInfo in asm.GetType(Class).GetProperties()) { attributeList.Add(pInfo.Name, pInfo.Name); } c.Attributes = GetClassAttributes(attributeList, type); if (c.Attributes.Count() == 0) { OutputProvider.WriteLine("No indexable property exists in '{0}'", Class); _successful = false; } hash[c.Name] = c; return(hash); }
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(); c.LuceneSection = new LuceneAttributes(); if (hash.Contains(c.Name)) { Class existingClass = (Class)hash[c.Name]; if (existingClass.LuceneSection != null) { c.LuceneSection = existingClass.LuceneSection; } } c.LuceneSection = WriteLuceneDefaults(c.LuceneSection); hash[c.Name] = c; return(hash); }
static public Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl) { Hashtable hash = new Hashtable(); Hashtable att = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); if (cl != null) { hash = ClassToHashtable(cl); } Class existingClass = null; if (cParam.Attributes == null || cParam.Attributes == string.Empty) { if (hash.Contains(cParam.Class)) { hash.Remove(cParam.Class); } else { throw new Exception("No query index found against class " + cParam.Class + "."); } } else if (cParam.Attributes != null && cParam.Attributes != string.Empty) { if (hash.Contains(cParam.Class)) { existingClass = (Class)hash[cParam.Class]; att = AttribToHashtable(existingClass.Attributes); } existingClass.Attributes = GetClassAttributes(GetAttributes(att)); hash[existingClass.Name] = existingClass; } return(hash); }
public static Class[] GetSourceClass(Hashtable pParams) { Class[] param = new Class[pParams.Count]; IDictionaryEnumerator enu = pParams.GetEnumerator(); int index = 0; while (enu.MoveNext()) { param[index] = new Class(); param[index].Name = (string)enu.Key; param[index] = (Class)enu.Value; index++; } return param; }
public static Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl) { Hashtable hash = new Hashtable(); Hashtable att = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); if (cl != null) { hash = ClassToHashtable(cl); } Class existingClass = null; if (cParam.Attributes == null || cParam.Attributes == string.Empty) { if (hash.Contains(cParam.Class)) { hash.Remove(cParam.Class); } else { throw new Exception("No query index found against class " + cParam.Class + "."); } } else if (cParam.Attributes != null && cParam.Attributes != string.Empty) { if (hash.Contains(cParam.Class)) { existingClass = (Class)hash[cParam.Class]; att = AttribToHashtable(existingClass.Attributes); } existingClass.Attributes = GetClassAttributes(GetAttributes(att)); hash[existingClass.Name] = existingClass; } return hash; }
private static Hashtable GetIndexClass(Class cls) { Hashtable settings = new Hashtable(); settings.Add("name", cls.Name); settings.Add("type", "class"); settings.Add("id", cls.ID); if (cls.Attributes != null) settings.Add("attributes", GetIndexAttributes(cls.Attributes)); return settings; }
private static Hashtable GetIndexClasses(Class[] classes) { Hashtable settings = new Hashtable(); foreach (Class cls in classes) settings.Add(cls.ID, GetIndexClass(cls)); return settings; }
private static Class GetIndexClass(Hashtable settings) { Class cls = new Class(); if (settings.ContainsKey("id")) cls.ID = settings["id"].ToString(); if (settings.ContainsKey("name")) cls.Name = settings["name"].ToString(); if (settings.ContainsKey("attributes")) cls.Attributes = GetIndexAttributes((Hashtable)settings["attributes"]); return cls; }
private static Class[] GetIndexClasses(Hashtable settings) { Class[] classes = new Class[settings.Count]; int i = 0; foreach (Hashtable cls in settings.Values) classes[i++] = GetIndexClass(cls); return classes; }
public static Hashtable GetClass(Alachisoft.NCache.Config.Dom.Class[] cl, System.Reflection.Assembly asm) { Hashtable hash = new Hashtable(); Hashtable att = new Hashtable(); Alachisoft.NCache.Config.Dom.Class c = new Alachisoft.NCache.Config.Dom.Class(); c.Name = cParam.Class; System.Type type = asm.GetType(cParam.Class, true); string assemblySrt = null; assemblySrt = asm.FullName; c.ID = cParam.Class; if (cl != null) { hash=ClassToHashtable(cl); } if(hash.Contains(c.Name)) { Class existingClass = (Class)hash[c.Name]; att = AttribToHashtable(existingClass.Attributes); } if (cParam.Attributes != null || cParam.Attributes != string.Empty) { c.Attributes = GetClassAttributes(GetAttributes(att),type); } hash[c.Name]= c; return hash; }