public void convert(System.Object sender, System.EventArgs e) { //progressBar1.Value = 0; //label1.Text = "Creating XML..."; XmlItem i; try { xmlItems = new List <XmlItem>(); foreach (DataRow dr in items.Rows) { int aoid = Convert.ToInt32(dr["aoid"]); int ql = Convert.ToInt32(dr["ql"]); string name = dr["name"].ToString(); string type = dr["type"].ToString(); int icon = Convert.ToInt32(dr["icon"]); int islot = Convert.ToInt32(dr["islot"]); i = new XmlItem(aoid, name, ql, type, icon, islot); // Hook=14 is PerformOnWear, Type=53 is skills as opposed to textures, etc effects = db.Query(String.Format("SELECT value1,value2 FROM tblItemEffects WHERE aoid={0} AND hook=14 AND type=53;", aoid)); List <XmlEffect> tmpEffects = new List <XmlEffect>(); foreach (DataRow de in effects.Rows) { int skill = Convert.ToInt32(de["value1"]); long val = Convert.ToInt64(de["value2"]); XmlEffect xe = new XmlEffect(skill, val); tmpEffects.Add(xe); } i.addEffects(tmpEffects); // Type6 is ToWear, Type8 ToWield reqs = db.Query(String.Format("SELECT sequence, attribute, value, operator, op_modifier FROM tblItemReqs WHERE aoid={0} AND (type=6 OR type=8)", aoid)); List <XmlRequirement> tmpReqs = new List <XmlRequirement>(); foreach (DataRow dq in reqs.Rows) { int sequence = Convert.ToInt32(dq["sequence"]); int attribute = Convert.ToInt32(dq["attribute"]); long val = Convert.ToInt64(dq["value"]); int op = Convert.ToInt32(dq["operator"]); int op_mod = Convert.ToInt32(dq["op_modifier"]); XmlRequirement xr = new XmlRequirement(attribute, op, val, op_mod, sequence); tmpReqs.Add(xr); } i.addReqs(tmpReqs); xmlItems.Add(i); converter.ReportProgress(xmlItems.Count / items.Rows.Count); } } catch (Exception fail) { MessageBox.Show(fail.ToString()); } }
public void convert(System.Object sender, System.EventArgs e) { //progressBar1.Value = 0; //label1.Text = "Creating XML..."; XmlItem i; try { xmlItems = new List<XmlItem>(); foreach(DataRow dr in items.Rows) { int aoid = Convert.ToInt32(dr["aoid"]); int ql = Convert.ToInt32(dr["ql"]); string name = dr["name"].ToString(); string type = dr["type"].ToString(); int icon = Convert.ToInt32(dr["icon"]); int islot = Convert.ToInt32(dr["islot"]); i = new XmlItem(aoid,name,ql,type,icon,islot); // Hook=14 is PerformOnWear, Type=53 is skills as opposed to textures, etc effects = db.Query(String.Format("SELECT value1,value2 FROM tblItemEffects WHERE aoid={0} AND hook=14 AND type=53;",aoid)); List<XmlEffect> tmpEffects = new List<XmlEffect>(); foreach(DataRow de in effects.Rows) { int skill = Convert.ToInt32(de["value1"]); long val = Convert.ToInt64(de["value2"]); XmlEffect xe = new XmlEffect(skill,val); tmpEffects.Add(xe); } i.addEffects(tmpEffects); // Type6 is ToWear, Type8 ToWield reqs = db.Query(String.Format("SELECT sequence, attribute, value, operator, op_modifier FROM tblItemReqs WHERE aoid={0} AND (type=6 OR type=8)",aoid)); List<XmlRequirement> tmpReqs = new List<XmlRequirement>(); foreach(DataRow dq in reqs.Rows) { int sequence = Convert.ToInt32(dq["sequence"]); int attribute = Convert.ToInt32(dq["attribute"]); long val = Convert.ToInt64(dq["value"]); int op = Convert.ToInt32(dq["operator"]); int op_mod = Convert.ToInt32(dq["op_modifier"]); XmlRequirement xr = new XmlRequirement(attribute,op,val,op_mod,sequence); tmpReqs.Add(xr); } i.addReqs(tmpReqs); xmlItems.Add(i); converter.ReportProgress(xmlItems.Count / items.Rows.Count); } } catch(Exception fail) { MessageBox.Show(fail.ToString()); } }