override public bool Parse(XmlNode node) { bool retValue = base.Parse(node); if (true == retValue) { foreach (AttributeC attrib in attributes) { if ("name" == attrib.Name) { AttributeName = attrib.Value; } else if ("assignTo" == attrib.Name) { AssignTo = attrib.Value; } else { MyLoggerC.Log("Unknown attribute named " + attrib.Name + " for element " + ElementName + "."); retValue = false; break; } } } return(retValue); }
override public bool Parse(XmlNode node) { bool retValue = base.Parse(node); if (true == retValue) { foreach (AttributeC attrib in attributes) { if ("namespace" == attrib.Name) { NameSpace = attrib.Value; } else if ("classname" == attrib.Name) { ClassName = attrib.Value; } else if ("id" == attrib.Name) { ID = ContextC.Instance.GetClassID(); } else { MyLoggerC.Log("Unknown attribute named " + attrib.Name + " for element " + ElementName + "."); retValue = false; break; } } } return(retValue); }
private void MyLoggerC_LogAdded(object sender, EventArgs e) { int length = rtb_debug.TextLength; // at end of text string ToAppend = MyLoggerC.GetLastLog(); rtb_debug.AppendText(ToAppend); if (ToAppend.Contains("Alert -")) { rtb_debug.SelectionStart = length; rtb_debug.SelectionLength = ToAppend.Length; rtb_debug.SelectionColor = Color.Red; } }
private void button1_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); XmlClassC.Instance.FileName = openFileDialog1.FileName; ContextC.Instance.ResetClassID(); if (true != XmlClassC.Instance.Parse()) { //rtb_debug.Text = XmlClassC.Instance.DebugText(); MyLoggerC.Log("Unable to parse file " + openFileDialog1.FileName + "."); } else { MyLoggerC.Log("File \"" + openFileDialog1.FileName + "\" opened."); } tvw_treeview.Nodes.Add(XmlClassC.Instance.GetTreeNode()); }
override public bool Parse(XmlNode node) { bool retValue = base.Parse(node); if (true == retValue) { foreach (AttributeC attrib in attributes) { if ("type" == attrib.Name) { AttributeType = attrib.Value; } else if ("init" == attrib.Name) { InitType = attrib.Value; } else if ("comment" == attrib.Name) { CommentType = attrib.Value; } else if ("classkey" == attrib.Name) { ClassKeyType = attrib.Value; } else if ("id" == attrib.Name) { IdType = attrib.Value; } else if ("array" == attrib.Name) { Array = attrib.Value; } else if ("validate" == attrib.Name) { Validate = attrib.Value; } else { MyLoggerC.Log("Unknown attribute named " + attrib.Name + " for element " + ElementName + "."); retValue = false; break; } } } return(retValue); }
public string GetCompleteName() { string retValue = ""; if (null == NameSpace) { MyLoggerC.Alert("Missing Namespace for a class." + Environment.NewLine); } else if ("" == NameSpace) { MyLoggerC.Alert("Namespace is empty for as class." + Environment.NewLine); } else if (null == ClassName) { MyLoggerC.Alert("Missing Classname for namespace = \"" + NameSpace + "\"." + Environment.NewLine); } else if ("" == ClassName) { MyLoggerC.Alert("Classname is empty for namespace = \"" + NameSpace + "\"." + Environment.NewLine); } else { string classObject = ""; foreach (ElementC child in children) { if ("objectname" == child.ElementName) { classObject = child.ElementValue; break; } } if ("" == classObject) { MyLoggerC.Alert("Missing objectname for namespace \"" + NameSpace + "\", and classname \"" + ClassName + "\"."); } else { retValue = NameSpace + "::" + ClassName + "::" + classObject; } } return(retValue); }
private void cbx_classkey_CheckedChanged(object sender, EventArgs e) { if (true == cbx_classkey.Checked) { ElementC parent = (ElementC)Element.Parent; foreach (ElementC child in parent.children) { ParamElementC cast = (ParamElementC)child; if (null != cast.ClassKeyType && "yes" == cast.ClassKeyType && Element.ElementValue != cast.ElementValue) { cast.ClassKeyType = null; MyLoggerC.Log("Moved classkey from parameter \"" + cast.ElementValue + "\" to parameter \"" + Element.ElementValue + "\"." + Environment.NewLine); } } Element.ClassKeyType = "yes"; cbx_classkey.Enabled = false; } else { Element.ClassKeyType = null; } }