public bool LoadBinary(string filename) { try { Stream stream = File.Open(filename, FileMode.Open); BinaryFormatter formatter = new BinaryFormatter(); if (stream.Length > 0) { JxCustomPropertyCollection cpc = (JxCustomPropertyCollection)formatter.Deserialize(stream); foreach (JxCustomProperty customprop in cpc) { customprop.RebuildAttributes(); this.Add(customprop); } cpc = null; stream.Close(); return(true); } else { stream.Close(); return(false); } } catch (Exception) { return(false); } }
public bool LoadXml(string filename) { try { XmlSerializer serializer = new XmlSerializer(typeof(JxCustomPropertyCollection)); FileStream reader = new FileStream(filename, FileMode.Open); JxCustomPropertyCollection cpc = (JxCustomPropertyCollection)serializer.Deserialize(reader); foreach (JxCustomProperty customprop in cpc) { customprop.RebuildAttributes(); this.Add(customprop); } cpc = null; reader.Close(); return(true); } catch (Exception) { return(false); } }