public static GodzClassInfo get(uint classHash) { GodzClassInfo cp = new GodzClassInfo(); // constructs a class info that has all the properties from this class // with it's parents ClassBase temp = ClassBase.findClass(classHash); while (temp != null) { //find the GodzClassInfo for this class.... GodzClassInfo classDesc = (GodzClassInfo)mClassMap[temp.getObjectName()]; if (classDesc != null) { // append the properties int num = classDesc.cpList.Count; for (int i = 0; i < num; i++) { cp.cpList.Add(classDesc.cpList[i]); } } temp = temp.getSuperClass(); } return(cp); }
public static void init() { //connects to DB if (Editor.sqlConnection != null) { string selectString = "SELECT [ClassHash],[PropertyHash],[Description],[Editor] FROM ClassPropertyDescription"; try { SqlCommand myCommand = new SqlCommand(selectString, Editor.sqlConnection); SqlDataReader myReader = myCommand.ExecuteReader(); while (myReader.Read()) { GodzClassProperty cp = new GodzClassProperty(); Int64 tempclass = (Int64)myReader["ClassHash"]; uint classhash = (uint)tempclass; if (mClassMap[classhash] == null) { GodzClassInfo gclass = new GodzClassInfo(); mClassMap[classhash] = gclass; } Int64 temp = (Int64)myReader["PropertyHash"]; cp.property = (uint)temp; cp.Description = (String)myReader["Description"]; object type = myReader["Editor"]; if (type != null) { cp.Type = (GodzClassPropertyType)type; } else { cp.Type = GodzClassPropertyType.Default; } GodzClassInfo godzClass = (GodzClassInfo)mClassMap[classhash]; godzClass.cpList.Add(cp); } myReader.Close(); } catch (System.Data.SqlClient.SqlException exception) { Console.WriteLine(exception.ToString()); } } }
private void classPickComboBox_SelectedIndexChanged(object sender, EventArgs e) { //user selected a class... uint classhash = GodzUtil.GetHashCode((string)classPickComboBox.SelectedItem); activeClass = null; foreach (ClassBase tempClass in classes) { if (tempClass.getObjectName() == classhash) { activeClass = tempClass; break; } } //grab all the properties.... props.Clear(); activeClass.getPropertiesNonRecurse(props); propertyListBox1.Items.Clear(); foreach (ClassPropertyInfo cp in props) { propertyListBox1.Items.Add(cp.mName); } //grab the documentation for this class from the database... classInfo = (GodzClassInfo)GodzClassDescriptionRegistry.get(activeClass.getObjectName()); if (classInfo == null) { classInfo = new GodzClassInfo(); GodzClassDescriptionRegistry.put(activeClass.getObjectName(), classInfo); } dbProperties = classInfo.cpList; }
public static void put(uint classHash, GodzClassInfo cp) { mClassMap[classHash] = cp; }