public DB() { try { ex = new ExcludedItems(); XmlSerializer xs = new XmlSerializer( typeof( XmlItem[] ), new XmlRootAttribute( "ArrayOfXmlItem" ) ); using ( FileStream myFileStream = new FileStream( @"aodb.xml", FileMode.Open ) ) { XmlItem[] i; i = ( XmlItem[] ) xs.Deserialize( myFileStream ); items = new List<Item>(); foreach(XmlItem xi in i) { if(!ex.ids.Contains(xi.aoid) && xi.test()) items.Add(xi.toItem()); } } } catch(Exception fail) { MessageBox.Show(fail.ToString()); } }
public DB() { try { ex = new ExcludedItems(); XmlSerializer xs = new XmlSerializer(typeof(XmlItem[]), new XmlRootAttribute("ArrayOfXmlItem")); using (FileStream myFileStream = new FileStream(@"aodb.xml", FileMode.Open)) { XmlItem[] i; i = ( XmlItem[] )xs.Deserialize(myFileStream); items = new List <Item>(); foreach (XmlItem xi in i) { if (!ex.ids.Contains(xi.aoid) && xi.test()) { items.Add(xi.toItem()); } } } } catch (Exception fail) { MessageBox.Show(fail.ToString()); } }
private void init(System.Object sender, System.EventArgs e) { // Parts of the init that are expected to take some time ex = new ExcludedItems(); db = new DB(); }