/// <summary> /// Fold these in a generic... /// </summary> /// <param name="filename"></param> /// <param name="descriptionfile"></param> /// <returns></returns> public static bool SerializeDescriptionFile(string filename, DescriptionFile descriptionfile) { bool b = false; XmlSerializer nser = new XmlSerializer(typeof(DescriptionFile)); TextWriter ntext = new StreamWriter(filename); try { nser.Serialize(ntext, descriptionfile); ntext.Flush(); b = true; } catch { b = false; } finally { ntext.Dispose(); } return b; }
/// <summary> /// /// </summary> /// <param name="filename"></param> public void LoadDescriptionSettings(string filename) { colName.Items.Clear(); if (File.Exists(filename)) { descriptionfile = Functions.DeserializeDescriptionFile(filename); if (descriptionfile != null) { foreach (DescriptionItem item in descriptionfile.Items) { colName.Sorted = true; colName.Items.Add(item.Name); } } } }